fix: 健康管理系统,统计页面接口开发及功能完善。
This commit is contained in:
@@ -41,10 +41,24 @@ public class StatisticAnalysisController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("健康总览-健康总览信息")
|
@ApiOperation("健康总览-健康总览信息")
|
||||||
@GetMapping("/healthAnalysis")
|
@GetMapping("/healthAnalysis")
|
||||||
public Map<String,Object> getDebitAccountsInfo(){
|
public Map<String,Object> getHealthAnalysis(){
|
||||||
Map<String, Object> resultMap = iStatisticAnalysisService.getHealthAnalysisInfo();
|
Map<String, Object> resultMap = iStatisticAnalysisService.getHealthAnalysisInfo();
|
||||||
return AjaxResult.success(resultMap);
|
return AjaxResult.success(resultMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("档案统计分析")
|
||||||
|
@GetMapping("/recordAnalysis")
|
||||||
|
public Map<String,Object> getRecordAnalysis(AnalysisDto analysisDto){
|
||||||
|
Map<String, Object> resultMap = iStatisticAnalysisService.getRecordAnalysis(analysisDto);
|
||||||
|
return AjaxResult.success(resultMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("就医统计分析")
|
||||||
|
@GetMapping("/doctorAnalysis")
|
||||||
|
public Map<String,Object> getDoctorAnalysis(AnalysisDto analysisDto){
|
||||||
|
Map<String, Object> resultMap = iStatisticAnalysisService.getDoctorAnalysis(analysisDto);
|
||||||
|
return AjaxResult.success(resultMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class HealthDoctorRecordDto extends BaseEntity implements Serializable
|
|||||||
|
|
||||||
/** 健康档案 */
|
/** 健康档案 */
|
||||||
@ApiModelProperty(value="健康档案")
|
@ApiModelProperty(value="健康档案")
|
||||||
private String healthRecordId;
|
private Long healthRecordId;
|
||||||
|
|
||||||
/** 就诊时间 */
|
/** 就诊时间 */
|
||||||
@ApiModelProperty(value="就诊时间")
|
@ApiModelProperty(value="就诊时间")
|
||||||
|
|||||||
@@ -46,4 +46,8 @@ public class HealthRecordDto extends BaseEntity implements Serializable
|
|||||||
@ApiModelProperty(value="结束日期")
|
@ApiModelProperty(value="结束日期")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
/** 主表ID */
|
||||||
|
@ApiModelProperty(value="主表ID")
|
||||||
|
private Long healthRecordId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,6 @@ public class HealthDoctorRecordVo extends HealthDoctorRecord
|
|||||||
@Excel(name = "健康档案")
|
@Excel(name = "健康档案")
|
||||||
private String healthRecordName;
|
private String healthRecordName;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,16 @@ public class HealthRecordVo extends HealthRecord
|
|||||||
@ApiModelProperty(value="持续时间")
|
@ApiModelProperty(value="持续时间")
|
||||||
private String duration;
|
private String duration;
|
||||||
|
|
||||||
|
private String doctorCount;
|
||||||
|
|
||||||
|
private String doctorCost;
|
||||||
|
|
||||||
|
private String marDayCount;
|
||||||
|
|
||||||
|
private String marCount;
|
||||||
|
|
||||||
|
private String feverDayCount;
|
||||||
|
|
||||||
|
private String processCount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.ruoyi.health.mapper;
|
package com.ruoyi.health.mapper;
|
||||||
|
|
||||||
import com.ruoyi.common.datascope.annotation.DataScope;
|
import com.ruoyi.common.datascope.annotation.DataScope;
|
||||||
|
import com.ruoyi.health.domain.dto.HealthDoctorRecordDto;
|
||||||
import com.ruoyi.health.domain.dto.HealthMarRecordDto;
|
import com.ruoyi.health.domain.dto.HealthMarRecordDto;
|
||||||
import com.ruoyi.health.domain.dto.HealthRecordDto;
|
import com.ruoyi.health.domain.dto.HealthRecordDto;
|
||||||
|
import com.ruoyi.health.domain.vo.HealthDoctorRecordVo;
|
||||||
import com.ruoyi.health.domain.vo.HealthMarRecordVo;
|
import com.ruoyi.health.domain.vo.HealthMarRecordVo;
|
||||||
|
import com.ruoyi.health.domain.vo.HealthRecordVo;
|
||||||
import com.ruoyi.health.domain.vo.HealthStaticPersonVo;
|
import com.ruoyi.health.domain.vo.HealthStaticPersonVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@@ -27,7 +30,7 @@ public interface StatisticAnalysisMapper {
|
|||||||
* @return 收支集合
|
* @return 收支集合
|
||||||
*/
|
*/
|
||||||
@DataScope(businessAlias = "hmr")
|
@DataScope(businessAlias = "hmr")
|
||||||
public int selectHospitalCount(HealthRecordDto dto);
|
public int selectHospitalCount(HealthMarRecordDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用药记录
|
* 查询用药记录
|
||||||
@@ -35,7 +38,7 @@ public interface StatisticAnalysisMapper {
|
|||||||
* @return 收支集合
|
* @return 收支集合
|
||||||
*/
|
*/
|
||||||
@DataScope(businessAlias = "hmr")
|
@DataScope(businessAlias = "hmr")
|
||||||
public int selectDoctorCount(HealthRecordDto dto);
|
public int selectDoctorCount(HealthMarRecordDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用药记录
|
* 查询用药记录
|
||||||
@@ -43,7 +46,7 @@ public interface StatisticAnalysisMapper {
|
|||||||
* @return 收支集合
|
* @return 收支集合
|
||||||
*/
|
*/
|
||||||
@DataScope(businessAlias = "hmr")
|
@DataScope(businessAlias = "hmr")
|
||||||
public int selectDistinctMedicalCount(HealthRecordDto dto);
|
public int selectDistinctMedicalCount(HealthMarRecordDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用药记录
|
* 查询用药记录
|
||||||
@@ -70,7 +73,7 @@ public interface StatisticAnalysisMapper {
|
|||||||
* @return 收支集合
|
* @return 收支集合
|
||||||
*/
|
*/
|
||||||
@DataScope(businessAlias = "hmr")
|
@DataScope(businessAlias = "hmr")
|
||||||
public int selectMarDayCount(HealthRecordDto dto);
|
public int selectMarDayCount(HealthMarRecordDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用药记录
|
* 查询用药记录
|
||||||
@@ -80,6 +83,15 @@ public interface StatisticAnalysisMapper {
|
|||||||
@DataScope(businessAlias = "hmr")
|
@DataScope(businessAlias = "hmr")
|
||||||
public int selectFeverDayCount(HealthRecordDto dto);
|
public int selectFeverDayCount(HealthRecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hr")
|
||||||
|
public List<HealthRecordVo> selectHealthRecordCostList (HealthRecordDto dto);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用药记录
|
* 查询用药记录
|
||||||
*
|
*
|
||||||
@@ -89,4 +101,64 @@ public interface StatisticAnalysisMapper {
|
|||||||
public List<HealthStaticPersonVo> selectStaticPersonList (HealthRecordDto dto);
|
public List<HealthStaticPersonVo> selectStaticPersonList (HealthRecordDto dto);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hr")
|
||||||
|
public List<HealthRecordVo> selectHealthRecordList (HealthRecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hmr")
|
||||||
|
public List<HealthDoctorRecordVo> selectDoctorRecordList(HealthDoctorRecordDto dto);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hmr")
|
||||||
|
public int selectMarCount(HealthMarRecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hmr")
|
||||||
|
public int selectProcessCount(HealthMarRecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hmr")
|
||||||
|
public List<HealthDoctorRecordVo> selectDoctorStaticList(HealthDoctorRecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hmr")
|
||||||
|
public List<HealthDoctorRecordVo> selectHospitalStaticList(HealthDoctorRecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用药记录
|
||||||
|
*
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "hmr")
|
||||||
|
public List<HealthDoctorRecordVo> selectDepartStaticList(HealthDoctorRecordDto dto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,10 @@ public interface IStatisticAnalysisService {
|
|||||||
|
|
||||||
public Map<String, Object> getHealthAnalysisInfo();
|
public Map<String, Object> getHealthAnalysisInfo();
|
||||||
|
|
||||||
|
|
||||||
|
public Map<String, Object> getRecordAnalysis(AnalysisDto analysisDto);
|
||||||
|
|
||||||
|
public Map<String, Object> getDoctorAnalysis(AnalysisDto analysisDto);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.ruoyi.health.service.impl;
|
package com.ruoyi.health.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.core.utils.MillisecondsConverter;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.security.utils.DictUtils;
|
import com.ruoyi.common.security.utils.DictUtils;
|
||||||
import com.ruoyi.health.domain.dto.*;
|
import com.ruoyi.health.domain.dto.*;
|
||||||
@@ -37,14 +39,13 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
|||||||
@Resource
|
@Resource
|
||||||
private HealthRecordMapper healthRecordMapper;
|
private HealthRecordMapper healthRecordMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HealthProcessRecordMapper healthProcessRecordMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getMarAnalysis(AnalysisDto analysisDto) {
|
public Map<String, Object> getMarAnalysis(AnalysisDto analysisDto) {
|
||||||
//返回数据
|
//返回数据
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
DecimalFormat decimalFormat = new DecimalFormat("#.###");
|
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
||||||
SimpleDateFormat dateFormatSecond = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
|
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
|
||||||
//月查询
|
//月查询
|
||||||
if(analysisDto.getType().equals("2")){
|
if(analysisDto.getType().equals("2")){
|
||||||
@@ -382,22 +383,26 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
|||||||
//活动总数
|
//活动总数
|
||||||
List<HealthActivityVo> activityVoList= healthActivityMapper.selectHealthActivityList(new HealthActivityDto());
|
List<HealthActivityVo> activityVoList= healthActivityMapper.selectHealthActivityList(new HealthActivityDto());
|
||||||
map.put("activityCount",activityVoList.size());
|
map.put("activityCount",activityVoList.size());
|
||||||
map.put("activityCost",activityVoList.stream().mapToDouble(HealthActivityVo::getTotalCost).sum());
|
//活动费用
|
||||||
|
String activityCost=decimalFormat.format(activityVoList.stream().mapToDouble(HealthActivityVo::getTotalCost).sum());
|
||||||
|
map.put("activityCost",activityCost);
|
||||||
//就医总数
|
//就医总数
|
||||||
List<HealthDoctorRecordVo> healthDoctorRecordList=healthDoctorRecordMapper.selectHealthDoctorRecordList(new HealthDoctorRecordDto());
|
List<HealthDoctorRecordVo> healthDoctorRecordList=healthDoctorRecordMapper.selectHealthDoctorRecordList(new HealthDoctorRecordDto());
|
||||||
map.put("doctorCount",healthDoctorRecordList.size());
|
map.put("doctorCount",healthDoctorRecordList.size());
|
||||||
map.put("doctorCost",healthDoctorRecordList.stream().mapToDouble(HealthDoctorRecordVo::getTotalCost).sum());
|
//就医费用
|
||||||
|
String doctorCost=decimalFormat.format(healthDoctorRecordList.stream().mapToDouble(HealthDoctorRecordVo::getTotalCost).sum());
|
||||||
|
map.put("doctorCost",doctorCost);
|
||||||
//医院总数
|
//医院总数
|
||||||
map.put("hospitalCount",statisticAnalysisMapper.selectHospitalCount(new HealthRecordDto()));
|
map.put("hospitalCount",statisticAnalysisMapper.selectHospitalCount(new HealthMarRecordDto()));
|
||||||
|
|
||||||
//医生总数
|
//医生总数
|
||||||
map.put("doctorTotalCount",statisticAnalysisMapper.selectDoctorCount(new HealthRecordDto()));
|
map.put("doctorTotalCount",statisticAnalysisMapper.selectDoctorCount(new HealthMarRecordDto()));
|
||||||
//用药天数
|
//用药天数
|
||||||
map.put("marDayCount",statisticAnalysisMapper.selectMarDayCount(new HealthRecordDto()));
|
map.put("marDayCount",statisticAnalysisMapper.selectMarDayCount(new HealthMarRecordDto()));
|
||||||
//用药次数
|
//用药次数
|
||||||
map.put("marCount",marRecordMapper.selectHealthMarRecordList(new HealthMarRecordDto()).size());
|
map.put("marCount",marRecordMapper.selectHealthMarRecordList(new HealthMarRecordDto()).size());
|
||||||
//用药类别
|
//用药类别
|
||||||
map.put("medicalTypeCount",statisticAnalysisMapper.selectDistinctMedicalCount(new HealthRecordDto()));
|
map.put("medicalTypeCount",statisticAnalysisMapper.selectDistinctMedicalCount(new HealthMarRecordDto()));
|
||||||
|
|
||||||
List<HealthTemperatureRecordVo> temperatureRecordVoList=temperatureRecordMapper.selectHealthTemperatureRecordList(new HealthTemperatureRecordDto());
|
List<HealthTemperatureRecordVo> temperatureRecordVoList=temperatureRecordMapper.selectHealthTemperatureRecordList(new HealthTemperatureRecordDto());
|
||||||
//测量体温次数
|
//测量体温次数
|
||||||
@@ -429,5 +434,302 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
|||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getRecordAnalysis(AnalysisDto analysisDto) {
|
||||||
|
//返回数据
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||||
|
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
|
||||||
|
//月查询
|
||||||
|
if(analysisDto.getType().equals("2")){
|
||||||
|
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
|
||||||
|
// String endTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),0));
|
||||||
|
// String startTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),-24));
|
||||||
|
// analysisDto.setStartTime(startTime);
|
||||||
|
// analysisDto.setEndTime(endTime);
|
||||||
|
}else {
|
||||||
|
analysisDto.setStartTime(analysisDto.getStartTime()+"-01");
|
||||||
|
if(analysisDto.getEndTime().equals(formatterMonth.format(new Date()))){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("dd");
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-"+sdf.format(new Date()));
|
||||||
|
}else {
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-31");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//年查询
|
||||||
|
}else if(analysisDto.getType().equals("3")){
|
||||||
|
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
|
||||||
|
// String endTime=dateFormat.format(DateUtils.getNowDate());
|
||||||
|
// String startTime=dateFormat.format(DateUtils.addYears(DateUtils.getNowDate(),-5));
|
||||||
|
// analysisDto.setStartTime(startTime);
|
||||||
|
// analysisDto.setEndTime(endTime);
|
||||||
|
}else {
|
||||||
|
analysisDto.setStartTime(analysisDto.getStartTime()+"-01-01");
|
||||||
|
SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
|
||||||
|
if(analysisDto.getEndTime().equals(sdfYear.format(new Date()))){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-"+sdf.format(new Date()));
|
||||||
|
}else {
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-12-31");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HealthRecordDto recordDto=new HealthRecordDto();
|
||||||
|
recordDto.setEndTime(analysisDto.getEndTime());
|
||||||
|
recordDto.setStartTime(analysisDto.getStartTime());
|
||||||
|
recordDto.setPersonId(analysisDto.getId());
|
||||||
|
recordDto.setHealthRecordId(analysisDto.getRecordId());
|
||||||
|
//健康档案总数
|
||||||
|
List<HealthRecordVo> recordVoList=healthRecordMapper.selectHealthRecordList(recordDto);
|
||||||
|
long duration=0L;
|
||||||
|
int healthRecordCount=recordVoList.size();
|
||||||
|
for (HealthRecordVo recordVo : recordVoList) {
|
||||||
|
Date startDate=recordVo.getOccurTime();
|
||||||
|
Date endDate=new Date();
|
||||||
|
if(recordVo.getRehabilitationTime()!=null){
|
||||||
|
endDate=recordVo.getRehabilitationTime();
|
||||||
|
}
|
||||||
|
duration+=(endDate.getTime()-startDate.getTime());
|
||||||
|
}
|
||||||
|
//平均康复周期
|
||||||
|
if(healthRecordCount>0){
|
||||||
|
MillisecondsConverter converter = new MillisecondsConverter(duration/healthRecordCount);
|
||||||
|
map.put("perDuration",converter.getConvertDayHourResult());
|
||||||
|
}else {
|
||||||
|
map.put("perDuration","0,0");
|
||||||
|
}
|
||||||
|
//建档次数
|
||||||
|
map.put("healthRecordCount",healthRecordCount);
|
||||||
|
|
||||||
|
HealthMarRecordDto marDto=new HealthMarRecordDto();
|
||||||
|
//获取数据
|
||||||
|
marDto.setEndTime(analysisDto.getEndTime());
|
||||||
|
marDto.setStartTime(analysisDto.getStartTime());
|
||||||
|
marDto.setPersonId(analysisDto.getId());
|
||||||
|
marDto.setHealthRecordId(analysisDto.getRecordId());
|
||||||
|
|
||||||
|
//过程记录次数
|
||||||
|
map.put("processRecordCount",statisticAnalysisMapper.selectProcessCount(marDto));
|
||||||
|
|
||||||
|
//用药总次数
|
||||||
|
int marCount=0;
|
||||||
|
List<HealthMarRecordVo> marTypeList=statisticAnalysisMapper.selectMarTypeList(marDto);
|
||||||
|
for (HealthMarRecordVo vo:marTypeList
|
||||||
|
){
|
||||||
|
if (null != vo.getType()) {
|
||||||
|
vo.setName(DictUtils.getDictLabel("mar_type", vo.getType().toString()));
|
||||||
|
}else{
|
||||||
|
vo.setName("未分类");
|
||||||
|
}
|
||||||
|
marCount+=vo.getCount();
|
||||||
|
}
|
||||||
|
//用药总次数
|
||||||
|
map.put("marCount",marCount);
|
||||||
|
|
||||||
|
|
||||||
|
//医院总数
|
||||||
|
map.put("hospitalCount",statisticAnalysisMapper.selectHospitalCount(marDto));
|
||||||
|
|
||||||
|
//医生总数
|
||||||
|
map.put("doctorTotalCount",statisticAnalysisMapper.selectDoctorCount(marDto));
|
||||||
|
|
||||||
|
|
||||||
|
HealthDoctorRecordDto doctorDto=new HealthDoctorRecordDto();
|
||||||
|
//获取数据
|
||||||
|
doctorDto.setEndTime(analysisDto.getEndTime());
|
||||||
|
doctorDto.setStartTime(analysisDto.getStartTime());
|
||||||
|
doctorDto.setPersonId(analysisDto.getId());
|
||||||
|
doctorDto.setHealthRecordId(analysisDto.getRecordId());
|
||||||
|
List<HealthDoctorRecordVo> healthDoctorRecordList=statisticAnalysisMapper.selectDoctorRecordList(doctorDto);
|
||||||
|
//就医次数
|
||||||
|
map.put("doctorCount",healthDoctorRecordList.size());
|
||||||
|
//就医费用
|
||||||
|
String doctorCost=decimalFormat.format(healthDoctorRecordList.stream().mapToDouble(HealthDoctorRecordVo::getTotalCost).sum());
|
||||||
|
map.put("doctorCost",doctorCost);
|
||||||
|
|
||||||
|
//用药天数
|
||||||
|
map.put("marDayCount",statisticAnalysisMapper.selectMarDayCount(marDto));
|
||||||
|
//用药次数
|
||||||
|
map.put("marCount",statisticAnalysisMapper.selectMarCount(marDto));
|
||||||
|
|
||||||
|
//发烧天数
|
||||||
|
map.put("feverDayCount",statisticAnalysisMapper.selectFeverDayCount(recordDto));
|
||||||
|
|
||||||
|
|
||||||
|
//按档案统计
|
||||||
|
List<HealthRecordVo> recordList=statisticAnalysisMapper.selectHealthRecordList(recordDto);
|
||||||
|
for (HealthRecordVo recordVo : recordList) {
|
||||||
|
String daysBetween="";
|
||||||
|
if(recordVo.getRehabilitationTime()!=null){
|
||||||
|
daysBetween = DateUtils.timeDistance(recordVo.getRehabilitationTime(),recordVo.getOccurTime());
|
||||||
|
}else {
|
||||||
|
daysBetween = DateUtils.timeDistance(new Date(),recordVo.getOccurTime());
|
||||||
|
}
|
||||||
|
recordVo.setDuration(daysBetween);
|
||||||
|
}
|
||||||
|
//列表
|
||||||
|
map.put("recordList",recordList);
|
||||||
|
//
|
||||||
|
List<HealthRecordVo> recordCostList=statisticAnalysisMapper.selectHealthRecordCostList(recordDto);
|
||||||
|
ArrayList<Map<String, Object>> recordCost = new ArrayList<>();
|
||||||
|
for (HealthRecordVo vo:recordCostList
|
||||||
|
) {
|
||||||
|
Map<String, Object> datamap = new HashMap<>();
|
||||||
|
datamap.put("time", vo.getName());
|
||||||
|
datamap.put("value", vo.getDoctorCost());
|
||||||
|
recordCost.add(datamap);
|
||||||
|
}
|
||||||
|
//列表
|
||||||
|
map.put("recordCostList",recordCost);
|
||||||
|
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getDoctorAnalysis(AnalysisDto analysisDto) {
|
||||||
|
//返回数据
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
|
||||||
|
//月查询
|
||||||
|
if(analysisDto.getType().equals("2")){
|
||||||
|
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
|
||||||
|
// String endTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),0));
|
||||||
|
// String startTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),-24));
|
||||||
|
// analysisDto.setStartTime(startTime);
|
||||||
|
// analysisDto.setEndTime(endTime);
|
||||||
|
}else {
|
||||||
|
analysisDto.setStartTime(analysisDto.getStartTime()+"-01");
|
||||||
|
if(analysisDto.getEndTime().equals(formatterMonth.format(new Date()))){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("dd");
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-"+sdf.format(new Date()));
|
||||||
|
}else {
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-31");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//年查询
|
||||||
|
}else if(analysisDto.getType().equals("3")){
|
||||||
|
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
|
||||||
|
// String endTime=dateFormat.format(DateUtils.getNowDate());
|
||||||
|
// String startTime=dateFormat.format(DateUtils.addYears(DateUtils.getNowDate(),-5));
|
||||||
|
// analysisDto.setStartTime(startTime);
|
||||||
|
// analysisDto.setEndTime(endTime);
|
||||||
|
}else {
|
||||||
|
analysisDto.setStartTime(analysisDto.getStartTime()+"-01-01");
|
||||||
|
SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
|
||||||
|
if(analysisDto.getEndTime().equals(sdfYear.format(new Date()))){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-"+sdf.format(new Date()));
|
||||||
|
}else {
|
||||||
|
analysisDto.setEndTime(analysisDto.getEndTime()+"-12-31");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HealthMarRecordDto marDto=new HealthMarRecordDto();
|
||||||
|
//获取数据
|
||||||
|
marDto.setEndTime(analysisDto.getEndTime());
|
||||||
|
marDto.setStartTime(analysisDto.getStartTime());
|
||||||
|
marDto.setPersonId(analysisDto.getId());
|
||||||
|
marDto.setHealthRecordId(analysisDto.getRecordId());
|
||||||
|
|
||||||
|
//过程记录次数
|
||||||
|
map.put("processRecordCount",statisticAnalysisMapper.selectProcessCount(marDto));
|
||||||
|
|
||||||
|
|
||||||
|
HealthDoctorRecordDto doctorDto=new HealthDoctorRecordDto();
|
||||||
|
//获取数据
|
||||||
|
doctorDto.setEndTime(analysisDto.getEndTime());
|
||||||
|
doctorDto.setStartTime(analysisDto.getStartTime());
|
||||||
|
doctorDto.setPersonId(analysisDto.getId());
|
||||||
|
doctorDto.setHealthRecordId(analysisDto.getRecordId());
|
||||||
|
List<HealthDoctorRecordVo> healthDoctorRecordList=healthDoctorRecordMapper.selectHealthDoctorRecordList(doctorDto);
|
||||||
|
//就医次数
|
||||||
|
map.put("doctorCount",healthDoctorRecordList.size());
|
||||||
|
//就医费用
|
||||||
|
String doctorCost=decimalFormat.format(healthDoctorRecordList.stream().mapToDouble(HealthDoctorRecordVo::getTotalCost).sum());
|
||||||
|
map.put("doctorCost",doctorCost);
|
||||||
|
//门诊次数
|
||||||
|
map.put("clinicCount",healthDoctorRecordList.stream().filter((doctor->doctor.getType().equals("1"))).count());
|
||||||
|
//急诊次数
|
||||||
|
map.put("emergencyCount",healthDoctorRecordList.stream().filter((doctor->doctor.getType().equals("2"))).count());
|
||||||
|
//住院次数
|
||||||
|
map.put("hospitalizedCount",healthDoctorRecordList.stream().filter((doctor->doctor.getType().equals("3"))).count());
|
||||||
|
//输液次数
|
||||||
|
map.put("infusionCount",healthDoctorRecordList.stream().filter((doctor->doctor.getType().equals("4"))).count());
|
||||||
|
//线上门诊
|
||||||
|
map.put("onlineCount",healthDoctorRecordList.stream().filter((doctor->doctor.getType().equals("5"))).count());
|
||||||
|
|
||||||
|
|
||||||
|
//按档案统计
|
||||||
|
List<HealthRecordVo> recordList=statisticAnalysisMapper.selectHealthRecordList(new HealthRecordDto());
|
||||||
|
for (HealthRecordVo recordVo : recordList) {
|
||||||
|
String daysBetween="";
|
||||||
|
if(recordVo.getRehabilitationTime()!=null){
|
||||||
|
daysBetween = DateUtils.timeDistance(recordVo.getRehabilitationTime(),recordVo.getOccurTime());
|
||||||
|
}else {
|
||||||
|
daysBetween = DateUtils.timeDistance(new Date(),recordVo.getOccurTime());
|
||||||
|
}
|
||||||
|
recordVo.setDuration(daysBetween);
|
||||||
|
}
|
||||||
|
//列表
|
||||||
|
map.put("recordList",recordList);
|
||||||
|
//
|
||||||
|
|
||||||
|
List<HealthDoctorRecordVo> hospitalStaticList=statisticAnalysisMapper.selectHospitalStaticList(doctorDto);
|
||||||
|
//列表
|
||||||
|
if(hospitalStaticList.size()>0) {
|
||||||
|
map.put("commonHospital", hospitalStaticList.get(0).getHospitalName());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
map.put("commonHospital", "--");
|
||||||
|
}
|
||||||
|
List<HealthDoctorRecordVo> doctorStaticList=statisticAnalysisMapper.selectDoctorStaticList(doctorDto);
|
||||||
|
//列表
|
||||||
|
map.put("doctorStaticList",doctorStaticList);
|
||||||
|
if(doctorStaticList.size()>0) {
|
||||||
|
//列表
|
||||||
|
map.put("commonDoctor",doctorStaticList.get(0).getDoctor());
|
||||||
|
}else {
|
||||||
|
map.put("commonDoctor","--");
|
||||||
|
}
|
||||||
|
List<HealthDoctorRecordVo> departStaticList=statisticAnalysisMapper.selectDepartStaticList(doctorDto);
|
||||||
|
|
||||||
|
if(departStaticList.size()>0) {
|
||||||
|
//列表
|
||||||
|
map.put("commonDepartments",departStaticList.get(0).getDepartments());
|
||||||
|
}else {
|
||||||
|
map.put("commonDepartments","--");
|
||||||
|
}
|
||||||
|
//列表
|
||||||
|
map.put("departStaticList",departStaticList);
|
||||||
|
//列表
|
||||||
|
map.put("hospitalStaticList",hospitalStaticList);
|
||||||
|
ArrayList<Map<String, Object>> recordCost = new ArrayList<>();
|
||||||
|
//列表
|
||||||
|
map.put("doctorTableList",healthDoctorRecordList);
|
||||||
|
Collections.reverse(healthDoctorRecordList);
|
||||||
|
for (HealthDoctorRecordVo vo:healthDoctorRecordList
|
||||||
|
) {
|
||||||
|
Map<String, Object> datamap = new HashMap<>();
|
||||||
|
datamap.put("time", dateFormat.format(vo.getVisitingTime()));
|
||||||
|
datamap.put("value", vo.getTotalCost());
|
||||||
|
recordCost.add(datamap);
|
||||||
|
}
|
||||||
|
//列表
|
||||||
|
map.put("doctorCostList",recordCost);
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="hospitalName != null and hospitalName != ''"> and a.hospital_name like '%'|| #{hospitalName}||'%'</if>
|
<if test="hospitalName != null and hospitalName != ''"> and a.hospital_name like '%'|| #{hospitalName}||'%'</if>
|
||||||
<if test="departments != null and departments != ''"> and a.departments = #{departments}</if>
|
<if test="departments != null and departments != ''"> and a.departments = #{departments}</if>
|
||||||
<if test="doctor != null and doctor != ''"> and a.doctor = #{doctor}</if>
|
<if test="doctor != null and doctor != ''"> and a.doctor = #{doctor}</if>
|
||||||
<if test="healthRecordId != null and healthRecordId != ''"> and a.health_record_id = #{healthRecordId}</if>
|
<if test="healthRecordId != null"> and a.health_record_id = #{healthRecordId}</if>
|
||||||
<if test="visitingTime != null "> and a.visiting_time = #{visitingTime}</if>
|
<if test="visitingTime != null "> and a.visiting_time = #{visitingTime}</if>
|
||||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||||
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="state != null and state != ''"> and a.state = #{state}</if>
|
<if test="state != null and state != ''"> and a.state = #{state}</if>
|
||||||
<if test="etiology != null and etiology != ''"> and a.etiology = #{etiology}</if>
|
<if test="etiology != null and etiology != ''"> and a.etiology = #{etiology}</if>
|
||||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||||
|
<if test="healthRecordId != null "> and a.id = #{healthRecordId}</if>
|
||||||
<if test="endTime!=null and endTime !=''">
|
<if test="endTime!=null and endTime !=''">
|
||||||
and #{endTime}>=to_char(a.occur_time, 'yyyy-MM-dd')
|
and #{endTime}>=to_char(a.occur_time, 'yyyy-MM-dd')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -84,31 +84,64 @@
|
|||||||
order by hmb."short_name" desc
|
order by hmb."short_name" desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectHospitalCount" parameterType="HealthRecordDto" resultType="int">
|
<select id="selectHospitalCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||||
select
|
select
|
||||||
count(distinct hospital_name)
|
count(distinct hospital_name)
|
||||||
from
|
from
|
||||||
health_doctor_record hmr
|
health_doctor_record hmr
|
||||||
where 1=1
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectDoctorCount" parameterType="HealthRecordDto" resultType="int">
|
<select id="selectDoctorCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||||
select
|
select
|
||||||
count(distinct doctor )
|
count(distinct doctor )
|
||||||
from
|
from
|
||||||
health_doctor_record hmr
|
health_doctor_record hmr
|
||||||
where 1=1
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDistinctMedicalCount" parameterType="HealthRecordDto" resultType="int">
|
<select id="selectDistinctMedicalCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||||
select
|
select
|
||||||
count(distinct medicine_id )
|
count(distinct medicine_id )
|
||||||
from
|
from
|
||||||
health_mar_record hmr
|
health_mar_record hmr
|
||||||
where 1=1
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
@@ -119,13 +152,14 @@
|
|||||||
count(hmr."type" ) as count
|
count(hmr."type" ) as count
|
||||||
from
|
from
|
||||||
health_mar_record hmr
|
health_mar_record hmr
|
||||||
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
<where>
|
<where>
|
||||||
hmr.del_flag = '0'
|
hmr.del_flag = '0'
|
||||||
<if test="endTime!=null and endTime !=''">
|
<if test="endTime!=null and endTime !=''">
|
||||||
and #{endTime}>=to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
</if>
|
</if>
|
||||||
<if test="startTime!=null and startTime !=''">
|
<if test="startTime!=null and startTime !=''">
|
||||||
and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime}
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
@@ -143,13 +177,14 @@
|
|||||||
count(to_char(hmr.dosing_time, 'yyyy-MM-dd')) as count
|
count(to_char(hmr.dosing_time, 'yyyy-MM-dd')) as count
|
||||||
from
|
from
|
||||||
health_mar_record hmr
|
health_mar_record hmr
|
||||||
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
<where>
|
<where>
|
||||||
hmr.del_flag = '0'
|
hmr.del_flag = '0'
|
||||||
<if test="endTime!=null and endTime !=''">
|
<if test="endTime!=null and endTime !=''">
|
||||||
and #{endTime}>=to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
</if>
|
</if>
|
||||||
<if test="startTime!=null and startTime !=''">
|
<if test="startTime!=null and startTime !=''">
|
||||||
and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime}
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
@@ -161,12 +196,23 @@
|
|||||||
order by to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
order by to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMarDayCount" parameterType="HealthRecordDto" resultType="int">
|
<select id="selectMarDayCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||||
select
|
select
|
||||||
count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') )
|
count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') )
|
||||||
from
|
from
|
||||||
health_mar_record hmr
|
health_mar_record hmr
|
||||||
where 1=1
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
@@ -176,7 +222,18 @@
|
|||||||
count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') )
|
count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') )
|
||||||
from
|
from
|
||||||
health_temperature_record hmr
|
health_temperature_record hmr
|
||||||
where hmr.temperature>=37
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0' and hmr.temperature>=37
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
@@ -266,4 +323,280 @@
|
|||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHealthRecordCostList" parameterType="HealthRecordDto" resultType="com.ruoyi.health.domain.vo.HealthRecordVo">
|
||||||
|
select
|
||||||
|
(
|
||||||
|
select
|
||||||
|
case
|
||||||
|
when sum(hdr.total_cost) is null then 0
|
||||||
|
else sum(hdr.total_cost)
|
||||||
|
end
|
||||||
|
from
|
||||||
|
health_doctor_record hdr
|
||||||
|
where
|
||||||
|
hdr.health_record_id = hr.id
|
||||||
|
and hdr.del_flag = '0') as doctorCost,
|
||||||
|
hr.id ,
|
||||||
|
hr."name",
|
||||||
|
hr.person_id
|
||||||
|
from
|
||||||
|
health_record hr
|
||||||
|
<where>
|
||||||
|
hr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hr.id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
order by hr.occur_time
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHealthRecordList" parameterType="HealthRecordDto" resultType="com.ruoyi.health.domain.vo.HealthRecordVo">
|
||||||
|
select
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(distinct hdr.hospital_name)
|
||||||
|
from
|
||||||
|
health_doctor_record hdr
|
||||||
|
where
|
||||||
|
hdr.health_record_id = hr.id
|
||||||
|
and hdr.del_flag = '0') as hospitalCount,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(distinct hdr.doctor)
|
||||||
|
from
|
||||||
|
health_doctor_record hdr
|
||||||
|
where
|
||||||
|
hdr.health_record_id = hr.id
|
||||||
|
and hdr.del_flag = '0') as doctorTotalCount,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(*)
|
||||||
|
from
|
||||||
|
health_doctor_record hdr
|
||||||
|
where
|
||||||
|
hdr.health_record_id = hr.id
|
||||||
|
and hdr.del_flag = '0') as doctorCount,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
case
|
||||||
|
when sum(hdr.total_cost) is null then 0
|
||||||
|
else sum(hdr.total_cost)
|
||||||
|
end
|
||||||
|
from
|
||||||
|
health_doctor_record hdr
|
||||||
|
where
|
||||||
|
hdr.health_record_id = hr.id
|
||||||
|
and hdr.del_flag = '0') as doctorCost,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') )
|
||||||
|
from
|
||||||
|
health_mar_record hmr
|
||||||
|
where
|
||||||
|
hmr.health_record_id = hr.id
|
||||||
|
and hmr.del_flag = '0') as marDayCount,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(*)
|
||||||
|
from
|
||||||
|
health_mar_record hmr
|
||||||
|
where
|
||||||
|
hmr.health_record_id = hr.id
|
||||||
|
and hmr.del_flag = '0') as marCount,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(*)
|
||||||
|
from
|
||||||
|
health_process_record hmr
|
||||||
|
where
|
||||||
|
hmr.health_record_id = hr.id
|
||||||
|
and hmr.del_flag = '0') as processCount,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(distinct hmr."medicine_id")
|
||||||
|
from
|
||||||
|
health_mar_record hmr
|
||||||
|
where
|
||||||
|
hmr.health_record_id = hr.id
|
||||||
|
and hmr.del_flag = '0') as marTypeCount,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') )
|
||||||
|
from
|
||||||
|
health_temperature_record hmr
|
||||||
|
where
|
||||||
|
hmr.health_record_id = hr.id
|
||||||
|
and hmr.temperature >= 37) as feverDayCount,
|
||||||
|
hr.id ,
|
||||||
|
hr."name",
|
||||||
|
hr.occur_time as occurTime,
|
||||||
|
hr.rehabilitation_time as rehabilitationTime,
|
||||||
|
hr.person_id as personId
|
||||||
|
from
|
||||||
|
health_record hr
|
||||||
|
|
||||||
|
<where>
|
||||||
|
hr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hr.id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
order by hr.occur_time desc
|
||||||
|
</select>
|
||||||
|
<select id="selectDoctorRecordList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||||
|
select
|
||||||
|
hmr.id,
|
||||||
|
hmr.health_record_id as healthRecordId,
|
||||||
|
hmr.total_cost as totalCost
|
||||||
|
from
|
||||||
|
health_doctor_record hmr
|
||||||
|
left join health_record hr on
|
||||||
|
hr.id = hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hr.id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMarCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||||
|
select
|
||||||
|
count(*)
|
||||||
|
from
|
||||||
|
health_mar_record hmr
|
||||||
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectProcessCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||||
|
select
|
||||||
|
count(*)
|
||||||
|
from
|
||||||
|
health_process_record hmr
|
||||||
|
left join health_record hr on hr.id=hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHospitalStaticList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||||
|
select
|
||||||
|
count(hmr.hospital_name) as count,
|
||||||
|
hmr.hospital_name as hospitalName
|
||||||
|
from
|
||||||
|
health_doctor_record hmr
|
||||||
|
left join health_record hr on
|
||||||
|
hr.id = hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hmr.visiting_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hmr.visiting_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
group by hmr.hospital_name
|
||||||
|
order by count(hmr.hospital_name) desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDoctorStaticList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||||
|
select
|
||||||
|
count(hmr.doctor) as count,
|
||||||
|
hmr.doctor,
|
||||||
|
hmr.hospital_name as hospitalName
|
||||||
|
from
|
||||||
|
health_doctor_record hmr
|
||||||
|
left join health_record hr on
|
||||||
|
hr.id = hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hmr.visiting_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hmr.visiting_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
group by hmr.hospital_name,hmr.doctor
|
||||||
|
order by count(hmr.doctor) desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDepartStaticList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||||
|
select
|
||||||
|
count(hmr.departments) as count,
|
||||||
|
hmr.departments as departments
|
||||||
|
from
|
||||||
|
health_doctor_record hmr
|
||||||
|
left join health_record hr on
|
||||||
|
hr.id = hmr.health_record_id
|
||||||
|
<where>
|
||||||
|
hmr.del_flag = '0'
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and #{endTime}>=to_char(hmr.visiting_time, 'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime !=''">
|
||||||
|
and to_char(hmr.visiting_time, 'yyyy-MM-dd')>=#{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="healthRecordId != null"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||||
|
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||||
|
</where>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
group by hmr.departments
|
||||||
|
order by count(hmr.departments) desc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user