chengyao 4 роки тому
батько
коміт
4c19761e22

+ 1 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -239,6 +239,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/export/qualityControlExport").permitAll()
                 .antMatchers("/consoleByDept/qualityControlByDept").permitAll()
                 .antMatchers("/print/export/qualityControlExportByDept").permitAll()
+                .antMatchers("/console/getMedManageIndex").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

+ 1 - 1
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -283,13 +283,13 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/export/qualityControlExport", request)
                 || matchers("/consoleByDept/qualityControlByDept", request)
                 || matchers("/print/export/qualityControlExportByDept", request)
+                || matchers("/console/getMedManageIndex", request)
                 || matchers("/", request)) {
             return true;
         }
         return false;
     }
 
-
     private boolean matchers(String url, HttpServletRequest request) {
         AntPathRequestMatcher matcher = new AntPathRequestMatcher(url);
         if (matcher.matches(request)) {

+ 60 - 0
src/main/java/com/diagbot/dto/MedManageParamsDTO.java

@@ -0,0 +1,60 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 病案管理指标病历
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-04-13
+ */
+@Data
+public class MedManageParamsDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
+
+    /**
+     * 质控的条目
+     */
+    private String casesEntryId;
+
+
+   // 医嘱项目名称
+    private String daItemName;
+
+    //医嘱频率
+    private String da_frequency;
+
+    //医嘱处方类型
+    private String doctorAdviceType;
+
+    /**
+     * 住院科室名称
+     */
+    private String behDeptName;
+
+    /**
+     * 入院时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date behospitalDate;
+
+    /**
+     * 出院时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date leaveHospitalDate;
+
+
+}

+ 3 - 3
src/main/java/com/diagbot/dto/MedQualityControlDTO.java

@@ -18,19 +18,19 @@ public class MedQualityControlDTO {
      * 住院病案管理人员月均负担出院患者病历数
      */
     @Excel(name = "住院病案管理人员月均负担出院患者病历数", width = 12, orderNum = "1")
-    private Double managerMouthNum = 0d;
+    private Double managerBeNum = 0d;
 
     /**
      * 病案编码管理人员月均负担出院患者病历数
      */
     @Excel(name = "病案编码管理人员月均负担出院患者病历数", width = 12, orderNum = "2")
-    private Double coderMouthNum= 0d;
+    private Double coderBeNum= 0d;
 
     /**
      * 门诊病案管理人员月均负担出院患者病历数
      */
     @Excel(name = "门诊病案管理人员月均负担出院患者病历数", width = 12, orderNum = "3")
-    private Double secManagerMouthNum= 0d;
+    private Double secManagerBeNum= 0d;
 
     /**
      * 入院记录24小时内完成量

+ 8 - 13
src/main/java/com/diagbot/entity/MedManagementInfo.java

@@ -2,19 +2,18 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
-import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 
+import java.time.LocalDateTime;
 import java.io.Serializable;
 
 /**
  * <p>
- * 病案管理人员表
+ * 病案管理人员统计
  * </p>
  *
  * @author zhoutg
- * @since 2021-04-06
+ * @since 2021-04-13
  */
 @Data
 public class MedManagementInfo implements Serializable {
@@ -29,29 +28,25 @@ public class MedManagementInfo implements Serializable {
      */
     private Long hospitalId;
 
-
-
     /**
      * 0:门诊病案管理人员  1:住院病案管理人员 2:病案编码人员
      */
-    private Integer positionId;
-
+    private String positionId;
 
     /**
-     * 单位时间数据接入开始时间
+     * 开始时间
      */
     private LocalDateTime startDate;
 
     /**
-     * 单位时间数据接入结束时间
+     * 结束时间
      */
     private LocalDateTime endDate;
 
     /**
-     * 单位时间管理人员实际工作总月
+     * 单位时间内管理人员总人
      */
-    @TableField("workMouth")
-    private Double workMouth;
+    private Double workPerson;
 
     /**
      * 是否删除,N:未删除,Y:删除

+ 15 - 5
src/main/java/com/diagbot/enums/QualityContent.java

@@ -17,8 +17,8 @@ public class QualityContent {
     public static final String CYJLWWC_24H = "2635出院记录未在患者出院24小时内完成";
     public static final String BASYWWC_24H = "3110病案首页未在患者出院24小时内完成";
     /**
-    * 医嘱类型
-    */
+     * 医嘱类型
+     */
     public static final String STANDING_ORDER = "长期医嘱";
     public static final String STAT_ORDER = "临时医嘱";
     /**
@@ -26,17 +26,27 @@ public class QualityContent {
      */
     public static List<String> Antimicrobial_Drug_List = Arrays.asList(
             "呋喃妥因", "呋喃唑酮", "盐酸小檗碱", "大蒜素", "鱼腥草素钠", "磺胺嘧啶", "甲氧苄啶", "复方磺胺甲恶唑",
-            "磺胺嘧啶银", "磺胺嘧啶锌", "盐酸四环素", "盐酸土霉素","盐酸多西环素", "盐酸米诺环素","盐酸美他环素", "硫酸庆大霉素", "硫酸链霉素"
+            "磺胺嘧啶银", "磺胺嘧啶锌", "盐酸四环素", "盐酸土霉素", "盐酸多西环素", "盐酸米诺环素", "盐酸美他环素", "硫酸庆大霉素", "硫酸链霉素"
     );
     /**
      * 化疗药物目录
      */
     public static List<String> Chemotherapy_Drug_List = Arrays.asList(
             "注射用盐酸表柔比星", "注射用盐酸吡柔比星", "注射用环磷酰胺", "卡铂注射液", "注射用奥沙利铂", "注射用阿糖胞苷", "注射用盐酸吉西他滨", "注射用甲氨蝶呤",
-            "注射用盐酸伊立替康", "紫杉醇注射液", "注射用培美曲塞二钠", "高三尖杉酯碱注射液","注射用硫酸长春地辛", "多西他赛注射液","注射用曲普瑞林", "注射用盐酸博来霉素", "注射用地西他滨",
-            "盐酸伊立替康注射液","注射用盐酸托泊替康","注射用氟尿嘧啶","注射用达卡巴嗪","醋酸戈舍瑞林缓释植入剂","顺铂注射液"
+            "注射用盐酸伊立替康", "紫杉醇注射液", "注射用培美曲塞二钠", "高三尖杉酯碱注射液", "注射用硫酸长春地辛", "多西他赛注射液", "注射用曲普瑞林", "注射用盐酸博来霉素", "注射用地西他滨",
+            "盐酸伊立替康注射液", "注射用盐酸托泊替康", "注射用氟尿嘧啶", "注射用达卡巴嗪", "醋酸戈舍瑞林缓释植入剂", "顺铂注射液"
     );
 
+    /**
+     * 抢救药物  维护修改
+     */
+
+    public static List<String> Rescue_Drug_List = Arrays.asList(
+            "尼可刹米","可拉明","盐酸洛贝林","山梗菜碱","肾上腺素","阿拉明", "重酒石酸间羟胺", "多巴胺", "利血平", "25%硫酸镁注射液", "垂体后叶素","注射用血凝酶", "阿托品","氯解磷定注射液","盐酸纳洛酮","异丙嗪", "非那更","地西泮", "安定","20%甘露醇");
+    public static List<String> getRescue_Drug_List() {
+        return Rescue_Drug_List;
+    }
 }
 
 
+

+ 40 - 0
src/main/java/com/diagbot/enums/TimeContent.java

@@ -0,0 +1,40 @@
+package com.diagbot.enums;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 新指标常用常量
+ */
+public class TimeContent {
+
+    public static List<String> HolidaysTimeList = Arrays.asList(
+            "2021-01-01", "2021-01-02", "2021-01-03",//元旦
+            "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17",//春节
+            "2021-04-03", "2021-04-04", "2021-04-05",//清明节
+            "2021-05-01",  "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05",//劳动节
+            "2021-06-12",  "2021-06-13", "2021-06-14",//端午节
+            "2021-09-19", "2021-09-20", "2021-09-21",//中秋节
+            "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07",//国庆节
+
+            "2021-01-09", "2021-01-10", "2021-01-16", "2021-01-17", "2021-01-23", "2021-01-24", "2021-01-30", "2021-01-31",//一月周末假日
+            "2021-02-06", "2021-02-21", "2021-02-27", "2021-02-28", //二月周末假日
+            "2021-03-06", "2021-03-07", "2021-03-13", "2021-03-14", "2021-03-20", "2021-03-21", "2021-03-27", "2021-03-28",//三月周末假日
+            "2021-04-10", "2021-04-11", "2021-04-17", "2021-04-18", "2021-04-24", //四月周末假日
+            "2021-05-09", "2021-05-15", "2021-05-16", "2021-05-22", "2021-05-23", "2021-05-29", "2021-05-30",//五月周末假日
+            "2021-06-05", "2021-06-06", "2021-06-19", "2021-06-20", "2021-06-26", "2021-06-27",//六月周末假日
+            "2021-07-03", "2021-07-04", "2021-07-10", "2021-07-11", "2021-07-17", "2021-07-18", "2021-07-24", "2021-07-25","2021-07-31",//七月周末假日
+            "2021-08-01", "2021-08-07", "2021-08-08", "2021-08-14", "2021-08-15", "2021-08-21", "2021-08-22", "2021-08-28", "2021-08-29",//八月周末假日
+            "2021-09-04", "2021-09-05", "2021-09-11", "2021-09-12", "2021-09-25",//九月周末假日
+            "2021-10-10", "2021-10-16", "2021-10-17", "2021-10-23", "2021-10-24", "2021-10-30", "2021-10-31", //十月周末假日
+            "2021-11-06", "2021-11-07", "2021-11-13", "2021-11-14", "2021-11-20", "2021-11-21", "2021-11-27", "2021-11-28",//十一月周末假日
+            "2021-12-04", "2021-12-06", "2021-12-11", "2021-12-12", "2021-12-18", "2021-12-19", "2021-12-25", "2021-12-26" //十二周末假日
+    );
+
+    public static List<String> getHolidaysTimeList() {
+        return HolidaysTimeList;
+    }
+}
+
+
+

+ 134 - 70
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -10,6 +10,8 @@ import com.diagbot.aggregate.ResultStatisticsAggregate;
 import com.diagbot.dto.*;
 import com.diagbot.entity.*;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.QualityContent;
+import com.diagbot.enums.TimeContent;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.MedManagementInfoService;
@@ -20,6 +22,7 @@ import com.google.common.collect.Lists;
 import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
@@ -35,6 +38,8 @@ import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.diagbot.enums.QualityContent.Rescue_Drug_List;
+
 /**
  * @Description:
  * @Author:zhaops
@@ -2281,6 +2286,7 @@ public class ConsoleFacade {
      * @return
      */
     public MedQualityControlDTO getMedManageIndex(FilterVO filterVO) {
+        filterFacade.filterVOSet(filterVO);
         MedQualityControlDTO medQualityControlDTO = new MedQualityControlDTO();
         Map<String, Object> baseIndex = behospitalInfoFacade.getBaseIndex(filterVO);
         //指标一、二、三、二十七
@@ -2291,43 +2297,72 @@ public class ConsoleFacade {
         medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
         //指标十八
         filterVO.setFlagStr("1");
-                             entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
-        medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
+        List<MedManageParamsDTO> medManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
+         medQualityControlDTO = rescueMethod(medManageParams,medQualityControlDTO,entryCountMap);
+
         //指标十九
         medQualityControlDTO = getfileSecAmount(filterVO,medQualityControlDTO, baseIndex);
+        //指标十四
+        filterVO.setFlagStr("2");
+                             entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
+        medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
+        //指标十六
+        filterVO.setFlagStr("3");
+        entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
+        medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
 
         return medQualityControlDTO;
     }
 
+    private MedQualityControlDTO rescueMethod(List<MedManageParamsDTO> medManageParams,MedQualityControlDTO medQualityControlDTO,Map<String, Object> entryCountMap){
+        List<MedManageParamsDTO> manageList= new ArrayList<>();
+        for (int i = 0; i < medManageParams.size(); i++) {
+            List<String> rescueDrugList = QualityContent.getRescue_Drug_List();
+            for (String str : rescueDrugList) {
+                if(medManageParams.get(i).getDaItemName().contains(str)){
+                    manageList.add(medManageParams.get(i));
+                }
+            }
+        }
 
+        //接受抢救的质控病历总数
+        double count = manageList.stream().map(MedManageParamsDTO::getBehospitalCode).distinct().count();
+        String wardRoundAmountStr = entryCountMap.get("WardRoundAmount").toString();
+        if(entryCountMap.containsKey("WardRoundAmount") && StringUtils.isNotEmpty(wardRoundAmountStr)){
+            //指标十七
+            DecimalFormat df = new DecimalFormat("#0.00");
+            double WardRoundAmount = Double.parseDouble(wardRoundAmountStr);
+            double retData = 0d;
+            if(count!=0d){
+                 retData = Double.parseDouble(df.format(WardRoundAmount * 100 / count));
+            }
+            medQualityControlDTO.setWardRoundNum(retData);
+            medQualityControlDTO.setWardRoundStr(retData+"%");
+        };
+        return medQualityControlDTO;
+    };
     private MedQualityControlDTO ruleIndexMethod(FilterVO filterVO,MedQualityControlDTO medQualityControlDTO, Map<String, Object> baseIndex, Map<String, Object> entryCountMap){
-        if(filterVO.getFlagStr().equals("0") && entryCountMap.containsKey("WardRoundAmount") && baseIndex.containsKey("thrMouthNum") && entryCountMap.get("WardRoundAmount").toString()!="0"){
+        if(filterVO.getFlagStr().equals("0") && entryCountMap.containsKey("WardRoundAmount") && baseIndex.containsKey("thrWorkNum") && ! entryCountMap.get("WardRoundAmount").toString().equals("0")){
             //指标十七
-            double wardRoundDo = currencyCal(baseIndex.get("thrMouthNum"), entryCountMap.get("WardRoundAmount"));
+            double wardRoundDo = currencyCal(baseIndex.get("thrWorkNum"), entryCountMap.get("WardRoundAmount"));
             medQualityControlDTO.setWardRoundNum(wardRoundDo);
             medQualityControlDTO.setWardRoundStr(wardRoundDo+"%");
 
         };
-        if(filterVO.getFlagStr().equals("1") && entryCountMap.containsKey("rescueNumDe") && entryCountMap.containsKey("rescueAmount") && entryCountMap.get("rescueNumDe").toString()!="0"){
-            //指标十八
-            double rescueDo = currencyCal(entryCountMap.get("rescueNumDe"), entryCountMap.get("rescueAmount"));
-            medQualityControlDTO.setRescueNum(rescueDo);
-            medQualityControlDTO.setRescueStr(rescueDo+"%");
-        }
         return medQualityControlDTO;
     }
 
     private double currencyCal(Object objFir,Object objSec){
-        DecimalFormat df = new DecimalFormat("0.0");
+        DecimalFormat df = new DecimalFormat("#0.00");
         double firDouble = Double.parseDouble(objFir.toString()) - Double.parseDouble(objSec.toString());
-        double thrMouthNum = Double.parseDouble(objFir.toString());
-        double retData = Double.parseDouble(df.format(firDouble * 100 / thrMouthNum));
+        double thrWorkNum = Double.parseDouble(objFir.toString());
+        double retData = Double.parseDouble(df.format(firDouble * 100 / thrWorkNum));
         return retData;
     };
 
     private MedQualityControlDTO getfileSecAmount(FilterVO filterVO,MedQualityControlDTO medQualityControlDTO, Map<String, Object> baseIndex){
         QueryWrapper<BehospitalInfo> query = new QueryWrapper<>();
-        DecimalFormat df = new DecimalFormat("0.0");
+        DecimalFormat df = new DecimalFormat("#0.00");
         query.eq("hospital_id", filterVO.getHospitalId())
                 .eq("is_deleted", IsDeleteEnum.N)
                 // .eq("is_placefile", filterVO.getIsPlacefile())
@@ -2338,15 +2373,15 @@ public class ConsoleFacade {
         Iterator<BehospitalInfo> iterator = list.iterator();
         while (iterator.hasNext()){
             BehospitalInfo beh = iterator.next();
-            Boolean flag = getTrueSecFile(beh.getBehospitalDate(), beh.getLeaveHospitalDate());
-            //true删除元素
+            Boolean flag = getTrueSecFile(beh.getBehospitalDate(), beh.getLeaveHospitalDate(), TimeContent.getHolidaysTimeList());
+            //时间截止则删除元素
             if(!flag){
                 iterator.remove();
             }
         }
         double count = list.stream().distinct().map(BehospitalInfo::getBedCode).count();
-        if(StringUtils.isNotEmpty( baseIndex.get("firMouthNum").toString()) && ! baseIndex.get("firMouthNum").toString().equals("0") ){
-            double retNum =count* 100/Double.parseDouble(baseIndex.get("firMouthNum").toString());
+        if(StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString()) && ! baseIndex.get("firWorkNum").toString().equals("0") ){
+            double retNum =count* 100/Double.parseDouble(baseIndex.get("firWorkNum").toString());
             double firGradeStr = Double.parseDouble(df.format(retNum));
             medQualityControlDTO.setLeaveSecFileStr(firGradeStr+"%");
         }
@@ -2355,96 +2390,125 @@ public class ConsoleFacade {
         return medQualityControlDTO;
     };
 
-    private Boolean getTrueSecFile(Date date1,Date date2){
-        Calendar cal1 = Calendar.getInstance();
-        Calendar cal2 = Calendar.getInstance();
-        //计算截止日期
-        Calendar cal3 = Calendar.getInstance();
+    private Boolean getTrueSecFile(Date date1,Date date2, List<String> holidaysTimeList){
+        Date date = date1;
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        DateTimeFormatter dateTimeFormatterThr = DateTimeFormatter.ofPattern("HH:mm:ss");
-        cal1.setTime(date1);
-        cal2.setTime(date2);
-        cal3.setTime(date1);
-        int holidays = 0;
-        //确定一个 大日期
-        if(cal1.compareTo(cal2) > 0){
-            Calendar temp = cal1;
-            cal1 = cal2;
-            cal2 = temp;
-            temp = null;
-        }
-        while(cal1.compareTo(cal2)<=0){
-            //将时间卡在周六和周天时候取出周末的日期
-            if(cal1.get(Calendar.DAY_OF_WEEK)==1||cal1.get(Calendar.DAY_OF_WEEK)==7){
-                holidays++;
-                System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat simpleDateFormatRe = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar cal = null;
+        int count = 0;
+        try {
+            String format = simpleDateFormatRe.format(date1);
+            date1 = simpleDateFormatRe.parse(simpleDateFormatRe.format(date1));
+            date2 = simpleDateFormatRe.parse(simpleDateFormatRe.format(date2));
+            cal = Calendar.getInstance();
+            cal.setTime(date);
+            count = 0;
+            for (String str : holidaysTimeList) {
+                Date date3 = simpleDateFormatRe.parse(str);
+                if(date3.after(date1) && date3.before(date2)){
+                    count++;
+                }
             }
-            cal1.add(Calendar.DAY_OF_YEAR,1);
+        } catch (ParseException e) {
+            e.printStackTrace();
         }
-        cal3.add(Calendar.DAY_OF_YEAR,holidays+2);
-        String format1 = new SimpleDateFormat("yyyy-MM-dd").format(cal3.getTime());
-        LocalDateTime of = LocalDateTime.of(1949, 10, 01, 16, 00,01);
-        String format2 = of.format(dateTimeFormatterThr);
-        String endTime = format1 +" "+ format2;
+        cal.add(Calendar.DAY_OF_YEAR,count+2);
+        String endTime = simpleDateFormat.format(cal.getTime());
         LocalDateTime ldt = LocalDateTime.parse(endTime,dateTimeFormatter);
         ZoneId zone = ZoneId.systemDefault();
         Instant instant = ldt.atZone(zone).toInstant();
         Date endDate = Date.from(instant);
-        //true表示未截止
-       if(endDate.after(date2)){
-           return true;
-       }
-       return false;
+        if(endDate.after(date2)){
+            return true;
+        }
+        return false;
     }
 
 
      private MedQualityControlDTO ManageIndexMethod(MedQualityControlDTO medQualityControlDTO, Map<String, Object> baseIndex,FilterVO filterVO){
+         FilterVO timeVo = new FilterVO();
+         BeanUtils.copyProperties(filterVO,timeVo);
          QueryWrapper<MedManagementInfo> query = new QueryWrapper<>();
-         DecimalFormat df = new DecimalFormat("0.0");
+         DecimalFormat df = new DecimalFormat("0.00");
+         timeTrans(timeVo);
          query.eq("hospital_id", filterVO.getHospitalId())
                  .eq("is_deleted", IsDeleteEnum.N)
-                 //指标1、2、3与是否归档没有直接关系 出院时间在单位时间内即可
-                 // .eq("is_placefile", filterVO.getIsPlacefile())
                  .isNotNull("start_date")
                  .isNotNull("end_date")
-                 .ge("start_date",filterVO.getStartDate())
-                 .le("end_date",filterVO.getEndDate());
+                 .ge("start_date",timeVo.getStartDate())
+                 .le("end_date",timeVo.getEndDate());
 
          List<MedManagementInfo> list = medManagementInfoService.list(query);
-         //单位时间同期门诊病案管理人员实际工作总月数
-         Double firMouth  = list.stream().filter(obj->obj.getPositionId()==0).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
+         //单位时间同期门诊病案管理人员实际工作总月数  Double  =
+         Optional<Double> firOp = list.stream().filter(obj -> obj.getPositionId().equals("3")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
+         Double firMouth = 0d;
+         if(firOp.isPresent()){
+              firMouth = firOp.get();
+         }
          //单位时间同期住院病案管理人员实际工作总月数
-         Double secMouth = list.stream().filter(obj->obj.getPositionId()==1).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
+         Optional<Double> secOp = list.stream().filter(obj->obj.getPositionId().equals("1")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
+         Double secMouth = 0d;
+         if(secOp.isPresent()){
+             secMouth = secOp.get();
+         }
          //单位时间同期病案编码管理人员实际工作总月数
-         Double thrMouth = list.stream().filter(obj->obj.getPositionId()==2).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
+         Optional<Double> thrOp = list.stream().filter(obj->obj.getPositionId().equals("2")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
+         Double thrMouth = 0d;
+         if(thrOp.isPresent()){
+             thrMouth = thrOp.get();
+         }
          Double firRecord = 0d;
 
          //指标一
-         if(secMouth != 0d && secMouth != null && StringUtils.isNotEmpty( baseIndex.get("firMouthNum").toString())){
-             medQualityControlDTO.setManagerMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("firMouthNum").toString())/secMouth));
+         if(secMouth != 0d && secMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
+             medQualityControlDTO.setManagerBeNum(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString())/secMouth));
          }
          //指标三
-         if(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firMouthNum").toString())){
-             medQualityControlDTO.setCoderMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("firMouthNum").toString())/thrMouth));
+         if(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
+             medQualityControlDTO.setCoderBeNum(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString())/thrMouth));
          }
 
-         if(firMouth != 0d && firMouth != null  && StringUtils.isNotEmpty( baseIndex.get("secMouthNum").toString())){
+         if(firMouth != 0d && firMouth != null  && StringUtils.isNotEmpty( baseIndex.get("secWorkNum").toString())){
          //指标二
-             medQualityControlDTO.setSecManagerMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("secMouthNum").toString())/firMouth));
+             medQualityControlDTO.setSecManagerBeNum(Math.ceil(Double.parseDouble(baseIndex.get("secWorkNum").toString())/firMouth));
          }
 
          //指标二十七 -甲级病历率
-         if(StringUtils.isNotEmpty( baseIndex.get("forMouthNum").toString())){
-             firRecord =Double.parseDouble(baseIndex.get("forMouthNum").toString());
+         if(StringUtils.isNotEmpty( baseIndex.get("forWorkNum").toString())){
+             firRecord =Double.parseDouble(baseIndex.get("forWorkNum").toString());
          }
-         if( firRecord != 0d && StringUtils.isNotEmpty( baseIndex.get("sixMouthNum").toString()) ){
-             double retNum = Double.parseDouble(baseIndex.get("sixMouthNum").toString()) * 100 / firRecord;
+         if( firRecord != 0d && StringUtils.isNotEmpty( baseIndex.get("sixWorkNum").toString()) ){
+             double retNum = Double.parseDouble(baseIndex.get("sixWorkNum").toString()) * 100 / firRecord;
              double firGradeStr = Double.parseDouble(df.format(retNum));
              medQualityControlDTO.setFirGradeStr(firGradeStr+"%");
          }
 
          return medQualityControlDTO;
      };
+   private void timeTrans(FilterVO filterVO){
+       SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
+       Calendar cal1 = Calendar.getInstance();
+       Calendar cal2 = Calendar.getInstance();
+       try {
+           cal1.setTime(myFormatter.parse(filterVO.getStartDate()));
+           cal2.setTime(myFormatter.parse(filterVO.getEndDate()));
+       } catch (ParseException e) {
+           e.printStackTrace();
+       }
+
+       cal1.set(Calendar.DAY_OF_MONTH, 1);
+       cal2.set(Calendar.DAY_OF_MONTH, 1);
+       cal2.set(Calendar.DATE, 1);
+       cal2.roll(Calendar.DATE, -1);
+       String startTime = myFormatter.format(cal1.getTime());
+       startTime = startTime+" 00:00:00";
+       String endTime = myFormatter.format(cal2.getTime());
+       endTime = endTime+" 23:59:59";
+       filterVO.setStartDate(startTime);
+       filterVO.setEndDate(endTime);
+   };
+
 
     /**
      * 质控核查质控评分页(内页)

+ 10 - 0
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -644,6 +644,16 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public Map<String,Object> getCountByEntry( FilterVO filterVO);
 
+    /**
+     * 病案管理规则质控病历参数查询
+     *
+     * @param filterVO
+     * @return
+     */
+
+    public  List<MedManageParamsDTO> getMedManageParams( FilterVO filterVO);
+
+
     /**
      * 质控核查质控评分页(内页)
      *

+ 4 - 10
src/main/java/com/diagbot/mapper/MedManagementInfoMapper.java

@@ -2,21 +2,15 @@ package com.diagbot.mapper;
 
 import com.diagbot.entity.MedManagementInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.diagbot.entity.FilterRecordVO;
-import org.apache.ibatis.annotations.Param;
-
-import java.time.LocalDateTime;
-import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
- * 病案管理人员表 Mapper 接口
+ * 病案管理人员统计表 Mapper 接口
  * </p>
  *
- * @author zhanghang
- * @since 2021-03-25
+ * @author zhoutg
+ * @since 2021-04-13
  */
 public interface MedManagementInfoMapper extends BaseMapper<MedManagementInfo> {
-    List<Map<String, Object>> medicalRecordIndicator(@Param("filterRecordVO") FilterRecordVO filterRecordVO, @Param("start") LocalDateTime start, @Param("end") LocalDateTime end);
+
 }

+ 10 - 0
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -100,6 +100,16 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     public Map<String,Object> getCountByEntry( FilterVO filterVO);
 
+    /**
+     * 病案管理规则质控病历参数查询
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<MedManageParamsDTO> getMedManageParams( FilterVO filterVO);
+
+
+
 
     /**
      * 出院总人数统计-科室-首页

+ 3 - 7
src/main/java/com/diagbot/service/MedManagementInfoService.java

@@ -1,19 +1,15 @@
 package com.diagbot.service;
 
-import com.diagbot.dto.MedQualityControlDTO;
 import com.diagbot.entity.MedManagementInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.entity.FilterRecordVO;
-
-import java.util.List;
 
 /**
  * <p>
- * 病案管理人员表 服务类
+ * 病案管理人员统计表 服务类
  * </p>
  *
- * @author zhanghang
- * @since 2021-03-25
+ * @author zhoutg
+ * @since 2021-04-13
  */
 public interface MedManagementInfoService extends IService<MedManagementInfo> {
 

+ 11 - 0
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -1040,6 +1040,17 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.getCountByEntry(filterVO);
     }
 
+    /**
+     * 病案管理规则质控病历参数查询
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public  List<MedManageParamsDTO> getMedManageParams( FilterVO filterVO) {
+        return baseMapper.getMedManageParams(filterVO);
+    }
+
     /**
      * 质控核查质控评分页(内页)
      *

+ 3 - 17
src/main/java/com/diagbot/service/impl/MedManagementInfoServiceImpl.java

@@ -1,34 +1,20 @@
 package com.diagbot.service.impl;
 
-
-import com.diagbot.dto.MedQualityControlDTO;
 import com.diagbot.entity.MedManagementInfo;
 import com.diagbot.mapper.MedManagementInfoMapper;
 import com.diagbot.service.MedManagementInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-import com.diagbot.util.ListUtil;
-import com.diagbot.entity.FilterRecordVO;
-
 import org.springframework.stereotype.Service;
 
-
-import java.time.Duration;
-import java.time.LocalDateTime;
-
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-
 /**
  * <p>
- * 病案管理人员表 服务实现类
+ * 病案管理人员统计表 服务实现类
  * </p>
  *
- * @author zhanghang
- * @since 2021-03-25
+ * @author zhoutg
+ * @since 2021-04-13
  */
 @Service
 public class MedManagementInfoServiceImpl extends ServiceImpl<MedManagementInfoMapper, MedManagementInfo> implements MedManagementInfoService {
 
-
 }

+ 1 - 1
src/main/java/com/diagbot/vo/FilterVO.java

@@ -69,7 +69,7 @@ public class FilterVO {
     private String isPlacefile = "1";
 
     /**
-     * 辅助标识
+     * 辅助标识(0-查房 1:抢救)
      */
     private String flagStr = "0";
 }

+ 10 - 0
src/main/java/com/diagbot/web/ConsoleController.java

@@ -844,4 +844,14 @@ public class ConsoleController {
         return RespDTO.onSuc(consoleFacade.getMedicalCheckTitle());
     }
 
+    @ApiOperation(value = " 病案管理指标(内页)[by:cy]",
+            notes = "startDate:单位开始时间<br>" +
+                    "endDate:单位结束时间<br>")
+    @PostMapping("/getMedManageIndex")
+    @SysLogger("getMedManageIndex")
+    public RespDTO<MedQualityControlDTO> getMedManageIndex(@RequestBody FilterVO filterVO) {
+        MedQualityControlDTO data = consoleFacade.getMedManageIndex(filterVO);
+        return RespDTO.onSuc(data);
+    }
+
 }

+ 3 - 3
src/main/java/com/diagbot/web/MedManagementInfoController.java

@@ -7,11 +7,11 @@ import org.springframework.stereotype.Controller;
 
 /**
  * <p>
- * 病案管理人员表 前端控制器
+ * 病案管理人员统计表 前端控制器
  * </p>
  *
- * @author zhanghang
- * @since 2021-03-25
+ * @author zhoutg
+ * @since 2021-04-13
  */
 @Controller
 @RequestMapping("/medManagementInfo")

+ 74 - 26
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -717,46 +717,51 @@
     <!--获取同期管理人员实际工作月数明细-->
     <select id="getBaseIndex"  parameterType="com.diagbot.vo.FilterVO" resultType="java.util.Map">
         select
-        f1.firMouthNum,
-        f2.secMouthNum,
-        f3.thrMouthNum,
-        f3.forMouthNum,
-        f3.fivMouthNum,
-        f3.sixMouthNum
+        f1.firWorkNum,
+        f2.secWorkNum,
+        f3.thrWorkNum,
+        f3.forWorkNum,
+        f3.fivWorkNum,
+        f3.sixWorkNum
         from (
-        SELECT  count(*)  as firMouthNum
+        SELECT  count(*)  as firWorkNum
         FROM
         med_behospital_info a
         WHERE
         a.is_deleted = 'N'
+        AND a.is_placefile = 1
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
+        <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="startDate != null and startDate != ''">
             <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
         </if>
         <if test="endDate != null and endDate != ''">
             <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
         </if>)f1,
-            ( SELECT count(*) AS secMouthNum
+            ( SELECT count(*) AS secWorkNum
         FROM
-        med_behospital_info a
+        med_outpatient_info a
         WHERE
         a.is_deleted = 'N'
         <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.gmt_create >= #{startDate}]]>
+            <![CDATA[ AND a.visit_date >= #{startDate}]]>
         </if>
         <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.gmt_create <= #{endDate}]]>
+            <![CDATA[ AND a.visit_date <= #{endDate}]]>
         </if>
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>)f2,(
            select
-        count(case when  <![CDATA[m.behospital_date >= #{startDate}]]>  and  <![CDATA[m.behospital_date <= #{endDate}]]> then m.behospital_code else null end) as thrMouthNum,
-        count(case when  <![CDATA[m.leave_hospital_date >= #{startDate}]]>  and  <![CDATA[m.leave_hospital_date <= #{endDate}]]> then m.behospital_code else null end) as forMouthNum,
-        count(case when  <![CDATA[m.behospital_date >= #{startDate}]]> and <![CDATA[m.leave_hospital_date <= #{endDate}]]> and m.is_placefile = 1 then m.behospital_code else null end) as fivMouthNum,
-        count(case when  <![CDATA[m.behospital_date >= #{startDate}]]> and <![CDATA[m.leave_hospital_date <= #{endDate}]]> and m.level = '甲' then m.behospital_code else null end) as sixMouthNum
+        count(case when  <![CDATA[m.behospital_date >= #{startDate}]]>  and  <![CDATA[m.behospital_date <= #{endDate}]]>
+        and m.is_placefile = 0 then m.behospital_code else null end) as thrWorkNum,
+        count(case when  <![CDATA[m.leave_hospital_date >= #{startDate}]]>  and  <![CDATA[m.leave_hospital_date <= #{endDate}]]>  and m.is_placefile = 1 then m.behospital_code else null end) as forWorkNum,
+        count(case when  <![CDATA[m.behospital_date >= #{startDate}]]> and <![CDATA[m.leave_hospital_date <= #{endDate}]]>
+        and m.is_placefile = 1 then m.behospital_code else null end) as fivWorkNum,
+        count(case when  <![CDATA[m.behospital_date >= #{startDate}]]> and <![CDATA[m.leave_hospital_date <= #{endDate}]]>
+        and m.is_placefile = 1 and m.level = '甲' then m.behospital_code else null end) as sixWorkNum
            from(
            SELECT DISTINCT a.*,b.level
             FROM
@@ -783,17 +788,15 @@
         SELECT
         true as flagNum
         <if test="flagStr != null and flagStr == 0 ">
-            ,count(DISTINCT case when  <![CDATA[f1.behospital_date >= #{startDate}]]>  and  <![CDATA[f1.behospital_date <= #{endDate}]]> and (f1.cases_entry_id = 2655 or f1.cases_entry_id = 2654) then f1.behospital_code end) as WardRoundAmount
-        </if>
-        <if test="flagStr != null and flagStr == 1 ">
-        ,count(DISTINCT case when  <![CDATA[f1.behospital_date >= #{startDate}]]>  and  <![CDATA[f1.behospital_date <= #{endDate}]]> and (f1.cases_entry_id = 2852) then f1.behospital_code end) as rescueAmount
-        ,count(DISTINCT f1.behospital_code) AS rescueNumDe
+            ,count(DISTINCT case when f1.cases_entry_id = 2655 or f1.cases_entry_id = 2654 or f1.cases_entry_id = 2468 then f1.behospital_code end) as WardRoundAmount
         </if>
         from(
         select
         a.behospital_code,
+        a.is_placefile,
         a.hospital_id,
         a.behospital_date,
+        a.leave_hospital_date,
         c.cases_entry_id
         FROM
         med_behospital_info a,
@@ -810,19 +813,64 @@
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
         AND c.cases_entry_id = d.id
-        AND a.qc_type_id != 0
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="flagStr != null and flagStr == 0 ">
+            AND <![CDATA[a.leave_hospital_date >= #{startDate}]]>
+            AND  <![CDATA[a.leave_hospital_date <= #{endDate}]]>
+            AND  a.is_placefile = 1
+        </if>
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>)f1
+    </select>
+
+    <!-- 病案管理规则质控缺陷病历总数查询-->
+    <select id="getMedManageParams"  parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.MedManageParamsDTO">
+        SELECT
+        f1.*,
+        f2.da_item_name as daItemName,
+        f2.da_frequency as da_frequency,
+        f2.doctor_advice_type as doctorAdviceType,
+        f2.da_start_date
+        from(
+        SELECT
+        a.hospital_id as hospitalId,
+        a.behospital_code as behospitalCode,
+        a.behospital_date as behospitalDate,
+        a.leave_hospital_date as leaveHospitalDate,
+        c.cases_entry_id as casesEntryId
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND c.cases_entry_id = d.id
+        <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="flagStr != null and flagStr == 1 ">
-            ,  str_rescue_note f2
-            where
-            f2.is_deleted = 'N'
-            AND f1.hospital_id = f2.hospital_id
-            AND f1.behospital_code = f2.behospital_code
+            AND <![CDATA[a.leave_hospital_date >= #{startDate}]]>
+            AND  <![CDATA[a.leave_hospital_date <= #{endDate}]]>
+            AND  a.is_placefile = 1
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>)f1,
+        med_doctor_advice f2
+        WHERE
+        f2.is_deleted = 'N'
+        AND f1.hospitalId = f2.hospital_id
+        AND f1.behospitalCode = f2.behospital_code
         </if>
     </select>
 
+
     <!-- 各科室缺陷占比-全院-首页 -->
     <select id="entryByDept" parameterType="com.diagbot.vo.FilterVO"
             resultType="com.diagbot.dto.NumDTO">

+ 11 - 11
src/main/resources/mapper/MedManagementInfoMapper.xml

@@ -4,17 +4,17 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.diagbot.entity.MedManagementInfo">
-        <id column="id" property="id"/>
-        <result column="hospital_id" property="hospitalId"/>
-        <result column="position_id" property="positionId"/>
-        <result column="name" property="name"/>
-        <result column="start_date" property="startDate"/>
-        <result column="end_date" property="endDate"/>
-        <result column="is_deleted" property="isDeleted"/>
-        <result column="gmt_create" property="gmtCreate"/>
-        <result column="gmt_modified" property="gmtModified"/>
-        <result column="creator" property="creator"/>
-        <result column="modifier" property="modifier"/>
+        <id column="id" property="id" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="position_id" property="positionId" />
+        <result column="start_date" property="startDate" />
+        <result column="end_date" property="endDate" />
+        <result column="work_person" property="workPerson" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
     </resultMap>
 
     <select id="medicalRecordIndicator" parameterType="com.diagbot.entity.FilterRecordVO" resultType="java.util.Map">