From 6d4065b10d9d4800d14f108af602dda99d1dbc7d Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Thu, 19 Dec 2024 16:02:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=81=A5=E5=BA=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=EF=BC=8C=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91=E5=8F=8A=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StatisticAnalysisController.java | 16 +- .../domain/dto/HealthDoctorRecordDto.java | 2 +- .../health/domain/dto/HealthRecordDto.java | 4 + .../domain/vo/HealthDoctorRecordVo.java | 2 + .../health/domain/vo/HealthRecordVo.java | 12 + .../mapper/StatisticAnalysisMapper.java | 80 +++- .../service/IStatisticAnalysisService.java | 6 + .../service/impl/StatisticAnalysisImpl.java | 320 +++++++++++++++- .../health/HealthDoctorRecordMapper.xml | 2 +- .../mapper/health/HealthRecordMapper.xml | 1 + .../mapper/health/StatisticAnalysisMapper.xml | 359 +++++++++++++++++- 11 files changed, 775 insertions(+), 29 deletions(-) diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/StatisticAnalysisController.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/StatisticAnalysisController.java index f5e1e53..e0c5c97 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/StatisticAnalysisController.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/StatisticAnalysisController.java @@ -41,10 +41,24 @@ public class StatisticAnalysisController extends BaseController { @ApiOperation("健康总览-健康总览信息") @GetMapping("/healthAnalysis") - public Map getDebitAccountsInfo(){ + public Map getHealthAnalysis(){ Map resultMap = iStatisticAnalysisService.getHealthAnalysisInfo(); return AjaxResult.success(resultMap); } + @ApiOperation("档案统计分析") + @GetMapping("/recordAnalysis") + public Map getRecordAnalysis(AnalysisDto analysisDto){ + Map resultMap = iStatisticAnalysisService.getRecordAnalysis(analysisDto); + return AjaxResult.success(resultMap); + } + + @ApiOperation("就医统计分析") + @GetMapping("/doctorAnalysis") + public Map getDoctorAnalysis(AnalysisDto analysisDto){ + Map resultMap = iStatisticAnalysisService.getDoctorAnalysis(analysisDto); + return AjaxResult.success(resultMap); + } + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthDoctorRecordDto.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthDoctorRecordDto.java index 8936417..2993f7a 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthDoctorRecordDto.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthDoctorRecordDto.java @@ -34,7 +34,7 @@ public class HealthDoctorRecordDto extends BaseEntity implements Serializable /** 健康档案 */ @ApiModelProperty(value="健康档案") - private String healthRecordId; + private Long healthRecordId; /** 就诊时间 */ @ApiModelProperty(value="就诊时间") diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthRecordDto.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthRecordDto.java index 398e7b3..1e8d43e 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthRecordDto.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/dto/HealthRecordDto.java @@ -46,4 +46,8 @@ public class HealthRecordDto extends BaseEntity implements Serializable @ApiModelProperty(value="结束日期") private String endTime; + /** 主表ID */ + @ApiModelProperty(value="主表ID") + private Long healthRecordId; + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthDoctorRecordVo.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthDoctorRecordVo.java index a395cc2..bb6c652 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthDoctorRecordVo.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthDoctorRecordVo.java @@ -25,4 +25,6 @@ public class HealthDoctorRecordVo extends HealthDoctorRecord @Excel(name = "健康档案") private String healthRecordName; + private Integer count; + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthRecordVo.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthRecordVo.java index 214711c..f98a30b 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthRecordVo.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/domain/vo/HealthRecordVo.java @@ -24,4 +24,16 @@ public class HealthRecordVo extends HealthRecord @ApiModelProperty(value="持续时间") private String duration; + private String doctorCount; + + private String doctorCost; + + private String marDayCount; + + private String marCount; + + private String feverDayCount; + + private String processCount; + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/StatisticAnalysisMapper.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/StatisticAnalysisMapper.java index d89ea22..dc5cbec 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/StatisticAnalysisMapper.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/StatisticAnalysisMapper.java @@ -1,9 +1,12 @@ package com.ruoyi.health.mapper; 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.HealthRecordDto; +import com.ruoyi.health.domain.vo.HealthDoctorRecordVo; import com.ruoyi.health.domain.vo.HealthMarRecordVo; +import com.ruoyi.health.domain.vo.HealthRecordVo; import com.ruoyi.health.domain.vo.HealthStaticPersonVo; import org.apache.ibatis.annotations.Mapper; @@ -27,7 +30,7 @@ public interface StatisticAnalysisMapper { * @return 收支集合 */ @DataScope(businessAlias = "hmr") - public int selectHospitalCount(HealthRecordDto dto); + public int selectHospitalCount(HealthMarRecordDto dto); /** * 查询用药记录 @@ -35,7 +38,7 @@ public interface StatisticAnalysisMapper { * @return 收支集合 */ @DataScope(businessAlias = "hmr") - public int selectDoctorCount(HealthRecordDto dto); + public int selectDoctorCount(HealthMarRecordDto dto); /** * 查询用药记录 @@ -43,7 +46,7 @@ public interface StatisticAnalysisMapper { * @return 收支集合 */ @DataScope(businessAlias = "hmr") - public int selectDistinctMedicalCount(HealthRecordDto dto); + public int selectDistinctMedicalCount(HealthMarRecordDto dto); /** * 查询用药记录 @@ -70,7 +73,7 @@ public interface StatisticAnalysisMapper { * @return 收支集合 */ @DataScope(businessAlias = "hmr") - public int selectMarDayCount(HealthRecordDto dto); + public int selectMarDayCount(HealthMarRecordDto dto); /** * 查询用药记录 @@ -80,6 +83,15 @@ public interface StatisticAnalysisMapper { @DataScope(businessAlias = "hmr") public int selectFeverDayCount(HealthRecordDto dto); + /** + * 查询用药记录 + * + * @return 收支集合 + */ + @DataScope(businessAlias = "hr") + public List selectHealthRecordCostList (HealthRecordDto dto); + + /** * 查询用药记录 * @@ -89,4 +101,64 @@ public interface StatisticAnalysisMapper { public List selectStaticPersonList (HealthRecordDto dto); + /** + * 查询用药记录 + * + * @return 收支集合 + */ + @DataScope(businessAlias = "hr") + public List selectHealthRecordList (HealthRecordDto dto); + + /** + * 查询用药记录 + * + * @return 收支集合 + */ + @DataScope(businessAlias = "hmr") + public List 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 selectDoctorStaticList(HealthDoctorRecordDto dto); + + /** + * 查询用药记录 + * + * @return 收支集合 + */ + @DataScope(businessAlias = "hmr") + public List selectHospitalStaticList(HealthDoctorRecordDto dto); + + /** + * 查询用药记录 + * + * @return 收支集合 + */ + @DataScope(businessAlias = "hmr") + public List selectDepartStaticList(HealthDoctorRecordDto dto); + + + + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IStatisticAnalysisService.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IStatisticAnalysisService.java index a2ccb15..a5a5c50 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IStatisticAnalysisService.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IStatisticAnalysisService.java @@ -17,4 +17,10 @@ public interface IStatisticAnalysisService { public Map getHealthAnalysisInfo(); + + public Map getRecordAnalysis(AnalysisDto analysisDto); + + public Map getDoctorAnalysis(AnalysisDto analysisDto); + + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/StatisticAnalysisImpl.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/StatisticAnalysisImpl.java index e5ee2f9..9d36e08 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/StatisticAnalysisImpl.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/StatisticAnalysisImpl.java @@ -1,5 +1,7 @@ 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.security.utils.DictUtils; import com.ruoyi.health.domain.dto.*; @@ -37,14 +39,13 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService { @Resource private HealthRecordMapper healthRecordMapper; + @Resource + private HealthProcessRecordMapper healthProcessRecordMapper; @Override public Map getMarAnalysis(AnalysisDto analysisDto) { //返回数据 HashMap 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"); //月查询 if(analysisDto.getType().equals("2")){ @@ -382,22 +383,26 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService { //活动总数 List activityVoList= healthActivityMapper.selectHealthActivityList(new HealthActivityDto()); 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 healthDoctorRecordList=healthDoctorRecordMapper.selectHealthDoctorRecordList(new HealthDoctorRecordDto()); 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("medicalTypeCount",statisticAnalysisMapper.selectDistinctMedicalCount(new HealthRecordDto())); + map.put("medicalTypeCount",statisticAnalysisMapper.selectDistinctMedicalCount(new HealthMarRecordDto())); List temperatureRecordVoList=temperatureRecordMapper.selectHealthTemperatureRecordList(new HealthTemperatureRecordDto()); //测量体温次数 @@ -429,5 +434,302 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService { return map; } + @Override + public Map getRecordAnalysis(AnalysisDto analysisDto) { + //返回数据 + HashMap 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 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 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 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 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 recordCostList=statisticAnalysisMapper.selectHealthRecordCostList(recordDto); + ArrayList> recordCost = new ArrayList<>(); + for (HealthRecordVo vo:recordCostList + ) { + Map 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 getDoctorAnalysis(AnalysisDto analysisDto) { + //返回数据 + HashMap 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 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 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 hospitalStaticList=statisticAnalysisMapper.selectHospitalStaticList(doctorDto); + //列表 + if(hospitalStaticList.size()>0) { + map.put("commonHospital", hospitalStaticList.get(0).getHospitalName()); + } + else { + map.put("commonHospital", "--"); + } + List doctorStaticList=statisticAnalysisMapper.selectDoctorStaticList(doctorDto); + //列表 + map.put("doctorStaticList",doctorStaticList); + if(doctorStaticList.size()>0) { + //列表 + map.put("commonDoctor",doctorStaticList.get(0).getDoctor()); + }else { + map.put("commonDoctor","--"); + } + List 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> recordCost = new ArrayList<>(); + //列表 + map.put("doctorTableList",healthDoctorRecordList); + Collections.reverse(healthDoctorRecordList); + for (HealthDoctorRecordVo vo:healthDoctorRecordList + ) { + Map datamap = new HashMap<>(); + datamap.put("time", dateFormat.format(vo.getVisitingTime())); + datamap.put("value", vo.getTotalCost()); + recordCost.add(datamap); + } + //列表 + map.put("doctorCostList",recordCost); + + return map; + } } diff --git a/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthDoctorRecordMapper.xml b/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthDoctorRecordMapper.xml index c346a27..c05a54e 100644 --- a/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthDoctorRecordMapper.xml +++ b/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthDoctorRecordMapper.xml @@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and a.hospital_name like '%'|| #{hospitalName}||'%' and a.departments = #{departments} and a.doctor = #{doctor} - and a.health_record_id = #{healthRecordId} + and a.health_record_id = #{healthRecordId} and a.visiting_time = #{visitingTime} and a.person_id = #{personId} and a.type = #{type} diff --git a/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthRecordMapper.xml b/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthRecordMapper.xml index 83eff3c..f4dc03b 100644 --- a/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthRecordMapper.xml +++ b/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthRecordMapper.xml @@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and a.state = #{state} and a.etiology = #{etiology} and a.person_id = #{personId} + and a.id = #{healthRecordId} and #{endTime}>=to_char(a.occur_time, 'yyyy-MM-dd') diff --git a/ruoyi-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml b/ruoyi-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml index 42a1409..c796b1a 100644 --- a/ruoyi-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml +++ b/ruoyi-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml @@ -84,31 +84,64 @@ order by hmb."short_name" desc - select count(distinct hospital_name) from health_doctor_record hmr - where 1=1 + left join health_record hr on hr.id=hmr.health_record_id + + hmr.del_flag = '0' + + and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd') + + + and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime} + + and hmr.health_record_id = #{healthRecordId} + and hmr.person_id = #{personId} + ${params.dataScope} - select count(distinct doctor ) from health_doctor_record hmr - where 1=1 + left join health_record hr on hr.id=hmr.health_record_id + + hmr.del_flag = '0' + + and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd') + + + and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime} + + and hmr.health_record_id = #{healthRecordId} + and hmr.person_id = #{personId} + ${params.dataScope} - select count(distinct medicine_id ) from health_mar_record hmr - where 1=1 + left join health_record hr on hr.id=hmr.health_record_id + + hmr.del_flag = '0' + + and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd') + + + and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime} + + and hmr.health_record_id = #{healthRecordId} + and hmr.person_id = #{personId} + ${params.dataScope} @@ -119,13 +152,14 @@ count(hmr."type" ) as count from health_mar_record hmr + left join health_record hr on hr.id=hmr.health_record_id hmr.del_flag = '0' - and #{endTime}>=to_char(hmr.dosing_time, 'yyyy-MM-dd') + and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd') - and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime} + and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime} and hmr.health_record_id = #{healthRecordId} and hmr.person_id = #{personId} @@ -143,13 +177,14 @@ count(to_char(hmr.dosing_time, 'yyyy-MM-dd')) as count from health_mar_record hmr + left join health_record hr on hr.id=hmr.health_record_id hmr.del_flag = '0' - and #{endTime}>=to_char(hmr.dosing_time, 'yyyy-MM-dd') + and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd') - and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime} + and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime} and hmr.health_record_id = #{healthRecordId} and hmr.person_id = #{personId} @@ -161,12 +196,23 @@ order by to_char(hmr.dosing_time, 'yyyy-MM-dd') - select count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') ) from health_mar_record hmr - where 1=1 + left join health_record hr on hr.id=hmr.health_record_id + + hmr.del_flag = '0' + + and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd') + + + and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime} + + and hmr.health_record_id = #{healthRecordId} + and hmr.person_id = #{personId} + ${params.dataScope} @@ -176,7 +222,18 @@ count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') ) from health_temperature_record hmr - where hmr.temperature>=37 + left join health_record hr on hr.id=hmr.health_record_id + + hmr.del_flag = '0' and hmr.temperature>=37 + + and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd') + + + and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime} + + and hmr.health_record_id = #{healthRecordId} + and hmr.person_id = #{personId} + ${params.dataScope} @@ -266,4 +323,280 @@ ${params.dataScope} + + + + + + + + + + + + + + + \ No newline at end of file