Bläddra i källkod

Merge remote-tracking branch 'origin/dev/20210326_2.0.3' into dev/20210326_2.0.3

# Conflicts:
#	src/main/java/com/diagbot/facade/ConsoleFacade.java
zhanghang 4 år sedan
förälder
incheckning
dbdbb3f848

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

@@ -4,6 +4,8 @@ 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.io.Serializable;
 
 /**
@@ -14,6 +16,7 @@ import java.io.Serializable;
  * @author zhoutg
  * @since 2021-04-06
  */
+@Data
 public class MedManagementInfo implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -26,33 +29,26 @@ public class MedManagementInfo implements Serializable {
      */
     private Long hospitalId;
 
-    /**
-     * 0:门诊  1:住院  2:住院+门诊
-     */
-    private Integer department;
 
-    /**
-     * 职务id
-     */
-    private Integer positionId;
 
     /**
      * 0:门诊病案管理人员  1:住院病案管理人员 2:病案编码人员
      */
-    private Integer position;
+    private Integer positionId;
+
 
     /**
-     * 数据接入开始时间
+     * 单位时间数据接入开始时间
      */
     private LocalDateTime startDate;
 
     /**
-     * 数据接入结束时间
+     * 单位时间数据接入结束时间
      */
     private LocalDateTime endDate;
 
     /**
-     * 同期管理人员实际工作总月数
+     * 单位时间管理人员实际工作总月数
      */
     @TableField("workMouth")
     private Double workMouth;
@@ -82,114 +78,4 @@ public class MedManagementInfo implements Serializable {
      */
     private String modifier;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public Long getHospitalId() {
-        return hospitalId;
-    }
-
-    public void setHospitalId(Long hospitalId) {
-        this.hospitalId = hospitalId;
-    }
-    public Integer getDepartment() {
-        return department;
-    }
-
-    public void setDepartment(Integer department) {
-        this.department = department;
-    }
-    public Integer getPositionId() {
-        return positionId;
-    }
-
-    public void setPositionId(Integer positionId) {
-        this.positionId = positionId;
-    }
-    public Integer getPosition() {
-        return position;
-    }
-
-    public void setPosition(Integer position) {
-        this.position = position;
-    }
-    public LocalDateTime getStartDate() {
-        return startDate;
-    }
-
-    public void setStartDate(LocalDateTime startDate) {
-        this.startDate = startDate;
-    }
-    public LocalDateTime getEndDate() {
-        return endDate;
-    }
-
-    public void setEndDate(LocalDateTime endDate) {
-        this.endDate = endDate;
-    }
-    public Double getWorkMouth() {
-        return workMouth;
-    }
-
-    public void setWorkMouth(Double workMouth) {
-        this.workMouth = workMouth;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public LocalDateTime getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(LocalDateTime gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-    public LocalDateTime getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(LocalDateTime gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-
-    @Override
-    public String toString() {
-        return "MedManagementInfo{" +
-            "id=" + id +
-            ", hospitalId=" + hospitalId +
-            ", department=" + department +
-            ", positionId=" + positionId +
-            ", position=" + position +
-            ", startDate=" + startDate +
-            ", endDate=" + endDate +
-            ", workMouth=" + workMouth +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-        "}";
-    }
 }

+ 107 - 0
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -12,6 +12,7 @@ import com.diagbot.entity.*;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.service.MedManagementInfoService;
 import com.diagbot.service.MedQcresultDetailService;
 import com.diagbot.util.*;
 import com.diagbot.vo.*;
@@ -25,7 +26,11 @@ import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.DateFormat;
 import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.Duration;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -61,6 +66,12 @@ public class ConsoleFacade {
     private QcCasesEntryFacade qcCasesEntryFacade;
     @Autowired
     private LeaveHosStatisticsAggregate leaveHosStatisticsAggregate;
+    @Autowired
+    @Qualifier("medManagementInfoServiceImpl")
+    private MedManagementInfoService medManagementInfoService;
+    @Autowired
+    @Qualifier("medQcresultDetailServiceImpl")
+    private MedQcresultDetailService medQcresultDetailService;
 
     //region-----------------------聚合接口开始-------------------------------
 
@@ -2245,6 +2256,102 @@ public class ConsoleFacade {
         return behospitalInfoFacade.hmImproveMRPage(qcResultShortPageVO);
     }
 
+    /**
+     * 病案管理指标(内页)
+     * @param filterVO
+     * @return
+     */
+    public MedQualityControlDTO getMedManageIndex(FilterVO filterVO) {
+        MedQualityControlDTO medQualityControlDTO = new MedQualityControlDTO();
+        Map<String, Object> baseIndex = behospitalInfoFacade.getBaseIndex(filterVO);
+        //指标一、二、三、二十七
+        medQualityControlDTO = ManageIndexMethod(medQualityControlDTO, baseIndex, filterVO);
+        filterVO.setFlagStr("0");
+        Map<String, Object> entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
+        //指标十七
+        medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
+        //指标十八
+        filterVO.setFlagStr("1");
+                             entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
+        medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
+
+        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"){
+            //指标十七
+            double wardRoundDo = currencyCal(baseIndex.get("thrMouthNum"), 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");
+        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));
+        return retData;
+    };
+
+
+     private MedQualityControlDTO ManageIndexMethod(MedQualityControlDTO medQualityControlDTO, Map<String, Object> baseIndex,FilterVO filterVO){
+         QueryWrapper<MedManagementInfo> query = new QueryWrapper<>();
+         DecimalFormat df = new DecimalFormat("0.0");
+         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());
+
+         List<MedManagementInfo> list = medManagementInfoService.list(query);
+         //单位时间同期门诊病案管理人员实际工作总月数
+         Double firMouth  = list.stream().filter(obj->obj.getPositionId()==0).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
+         //单位时间同期住院病案管理人员实际工作总月数
+         Double secMouth = list.stream().filter(obj->obj.getPositionId()==1).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
+         //单位时间同期病案编码管理人员实际工作总月数
+         Double thrMouth = list.stream().filter(obj->obj.getPositionId()==2).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).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(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firMouthNum").toString())){
+             medQualityControlDTO.setCoderMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("firMouthNum").toString())/thrMouth));
+         }
+
+         if(firMouth != 0d && firMouth != null  && StringUtils.isNotEmpty( baseIndex.get("secMouthNum").toString())){
+         //指标二
+             medQualityControlDTO.setSecManagerMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("secMouthNum").toString())/firMouth));
+         }
+
+         //指标二十七 -甲级病历率
+         if(StringUtils.isNotEmpty( baseIndex.get("forMouthNum").toString())){
+             firRecord =Double.parseDouble(baseIndex.get("forMouthNum").toString());
+         }
+         if( firRecord != 0d && StringUtils.isNotEmpty( baseIndex.get("sixMouthNum").toString()) ){
+             double retNum = Double.parseDouble(baseIndex.get("sixMouthNum").toString()) * 100 / firRecord;
+             double firGradeStr = Double.parseDouble(df.format(retNum));
+             medQualityControlDTO.setFirGradeStr(firGradeStr+"%");
+         }
+
+         return medQualityControlDTO;
+     };
 
     /**
      * 质控核查质控评分页(内页)

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

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

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

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

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

@@ -1028,6 +1028,18 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     public Map<String,Object> getBaseIndex( FilterVO filterVO) {
         return baseMapper.getBaseIndex(filterVO);
     }
+
+    /**
+     * 病案管理规则质控参数查询
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public Map<String,Object> getCountByEntry( FilterVO filterVO) {
+        return baseMapper.getCountByEntry(filterVO);
+    }
+
     /**
      * 质控核查质控评分页(内页)
      *

+ 5 - 0
src/main/java/com/diagbot/vo/FilterVO.java

@@ -67,4 +67,9 @@ public class FilterVO {
      * 是否归档(0:未归档,1:已归档)
      */
     private String isPlacefile = "1";
+
+    /**
+     * 辅助标识
+     */
+    private String flagStr = "0";
 }

+ 45 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -778,6 +778,51 @@
             )f3
     </select>
 
+    <!-- 病案管理规则质控缺陷病历总数查询-->
+    <select id="getCountByEntry"  parameterType="com.diagbot.vo.FilterVO" resultType="java.util.Map">
+        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
+        </if>
+        from(
+        select
+        a.behospital_code,
+        a.hospital_id,
+        a.behospital_date,
+        c.cases_entry_id
+        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
+        AND a.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>)f1
+        <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
+        </if>
+    </select>
+
     <!-- 各科室缺陷占比-全院-首页 -->
     <select id="entryByDept" parameterType="com.diagbot.vo.FilterVO"
             resultType="com.diagbot.dto.NumDTO">

+ 2 - 4
src/main/resources/mapper/MedManagementInfoMapper.xml

@@ -6,12 +6,10 @@
     <resultMap id="BaseResultMap" type="com.diagbot.entity.MedManagementInfo">
         <id column="id" property="id"/>
         <result column="hospital_id" property="hospitalId"/>
-        <result column="department" property="department"/>
         <result column="position_id" property="positionId"/>
-        <result column="position" property="position"/>
         <result column="name" property="name"/>
-        <result column="hire_date" property="hireDate"/>
-        <result column="resignation_time" property="resignationTime"/>
+        <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"/>