瀏覽代碼

Merge branch 'dev/20200812_1.4.2' into debug

rengb 4 年之前
父節點
當前提交
725ae1cb04

+ 3 - 1
doc/021.20200812v1.4.2/qc_initv1.4.2.sql

@@ -1,4 +1,6 @@
 use `qc`;
 
 ALTER TABLE `qc_cases_entry_hospital` ADD   `score_run` decimal(5,1) DEFAULT NULL COMMENT '扣分值(运行质控)' AFTER `score`;
-ALTER TABLE `qc_cases_entry_hospital` ADD   `is_used_run` int(3) DEFAULT NULL COMMENT '0-未启用 1-启用(运行质控)' AFTER `is_used`;
+ALTER TABLE `qc_cases_entry_hospital` ADD   `is_used_run` int(3) DEFAULT NULL COMMENT '0-未启用 1-启用(运行质控)' AFTER `is_used`;
+
+update qc_cases_entry_hospital set is_used_run = is_used, score_run=score;

+ 43 - 16
src/main/java/com/diagbot/entity/QcCasesEntryHospital.java

@@ -61,20 +61,29 @@ public class QcCasesEntryHospital implements Serializable {
     private Long hospitalId;
 
     /**
-     * 扣分值
+     * 终末扣分值
      */
     private BigDecimal score;
 
+    /**
+     * 运行扣分值
+     */
+    private BigDecimal scoreRun;
+
     /**
      * 条目提示信息
      */
     private String msg;
 
     /**
-     * 0-未启用 1-启用
+     * 终末质控0-未启用 1-启用
      */
     private Integer isUsed;
 
+    /**
+     * 运行质控0-未启用 1-启用
+     */
+    private Integer isUsedRun;
     /**
      * 单项否决(1-单项否决 0-非)
      */
@@ -177,22 +186,40 @@ public class QcCasesEntryHospital implements Serializable {
         this.remark = remark;
     }
 
+    public BigDecimal getScoreRun() {
+        return scoreRun;
+    }
+
+    public void setScoreRun(BigDecimal scoreRun) {
+        this.scoreRun = scoreRun;
+    }
+
+    public Integer getIsUsedRun() {
+        return isUsedRun;
+    }
+
+    public void setIsUsedRun(Integer isUsedRun) {
+        this.isUsedRun = isUsedRun;
+    }
+
     @Override
     public String toString() {
         return "QcCasesEntryHospital{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", casesEntryId=" + casesEntryId +
-            ", hospitalId=" + hospitalId +
-            ", score=" + score +
-            ", msg=" + msg +
-            ", isUsed=" + isUsed +
-            ", isReject=" + isReject +
-            ", remark=" + remark +
-        "}";
+                "id=" + id +
+                ", isDeleted='" + isDeleted + '\'' +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator='" + creator + '\'' +
+                ", modifier='" + modifier + '\'' +
+                ", casesEntryId=" + casesEntryId +
+                ", hospitalId=" + hospitalId +
+                ", score=" + score +
+                ", scoreRun=" + scoreRun +
+                ", msg='" + msg + '\'' +
+                ", isUsed=" + isUsed +
+                ", isUsedRun=" + isUsedRun +
+                ", isReject=" + isReject +
+                ", remark='" + remark + '\'' +
+                '}';
     }
 }

+ 5 - 1
src/main/java/com/diagbot/facade/AlgorithmFacade.java

@@ -6,6 +6,7 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.BigDecimalUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.AlgorithmVO;
 import com.diagbot.vo.MedQcresultCasesVO;
 import com.diagbot.vo.QcResultAlgVO;
@@ -117,7 +118,10 @@ public class AlgorithmFacade {
                 .multiply(new BigDecimal(100))
                 .divide(new BigDecimal(120), 1, RoundingMode.HALF_UP);
         // 判断是否是百分制
-        if (sysHospitalSetFacade.getScoreType(algorithmVO.getHospitalId()).equals("1")) {
+        if (sysHospitalSetFacade.getScoreType(algorithmVO.getHospitalId()).equals("1")
+                ||(algorithmVO.getHospitalId().intValue() == 1
+                && StringUtil.isNotBlank(algorithmVO.getIsPlacefile())
+                && algorithmVO.getIsPlacefile().equals("0"))) {
             res = cal(algorithmVO);
         }
         return res;

+ 6 - 3
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -554,7 +554,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         setCodeData(outputInfo, codeList, codeToInfoMap);
 
         // 计算分值并保存结果至数据库
-        Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO);
+        Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO, queryVo.getBehospitalInfo().getIsPlacefile());
         AlgorithmDTO algorithmDTO = (AlgorithmDTO)resMap.get("algorithmDTO");
         Date date = (Date)resMap.get("date");
 
@@ -1008,7 +1008,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         // 如果是1,说明已是终末质控,不再保存质控结果数据;如果是0,则保存质控结果数据
         if ("0".equals(analyzeRunVO.getIsPlacefile())) {
             // 计算分值并保存结果至数据库
-            Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO);
+            Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO, queryVo.getBehospitalInfo().getIsPlacefile());
         }
 
         // 返回缺陷提示信息
@@ -1201,7 +1201,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @return
      */
     public Map<String, Object> calScoreAndSave(OutputInfo outputInfo, List<String> codeList,
-                                               Map<String, String> codeToInfoMap, AnalyzeVO analyzeVO) {
+                                               Map<String, String> codeToInfoMap, AnalyzeVO analyzeVO,
+                                               String isPlacefile) {
         Long hospitalId = analyzeVO.getHospitalId();
         List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
         if (ListUtil.isNotEmpty(codeList)) {
@@ -1209,6 +1210,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
             qcResultAlgQueryVO.setCodeList(codeList);
             qcResultAlgQueryVO.setHospitalId(hospitalId);
+            qcResultAlgQueryVO.setIsPlacefile(isPlacefile);
             qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
         }
 
@@ -1227,6 +1229,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         algorithmVO.setHospitalId(hospitalId);
         algorithmVO.setBehospitalCode(analyzeVO.getBehospitalCode());
         algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
+        algorithmVO.setIsPlacefile(isPlacefile);
         AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
 
         //保存

+ 6 - 2
src/main/java/com/diagbot/facade/QcCasesEntryHospitalFacade.java

@@ -62,14 +62,18 @@ public class QcCasesEntryHospitalFacade extends QcCasesEntryHospitalServiceImpl
                 .eq("hospital_id", Long.valueOf(SysUserUtils.getCurrentHospitalID()))
                 .set("modifier", SysUserUtils.getCurrentPrincipleID())
                 .set("gmt_modified", DateUtil.now());
-        qcCasesEntry.set(qcCasesEntryUpdataVO.getScore() != null,
+        qcCasesEntry.set("1".equals(qcCasesEntryUpdataVO.getIsPlacefile()) && qcCasesEntryUpdataVO.getScore() != null,
                 "score", qcCasesEntryUpdataVO.getScore());
         qcCasesEntry.set(qcCasesEntryUpdataVO.getMsg() != null,
                 "msg", qcCasesEntryUpdataVO.getMsg());
-        qcCasesEntry.set(qcCasesEntryUpdataVO.getIsUsed() != null,
+        qcCasesEntry.set("1".equals(qcCasesEntryUpdataVO.getIsPlacefile()) && qcCasesEntryUpdataVO.getIsUsed() != null,
                 "is_used", qcCasesEntryUpdataVO.getIsUsed());
         qcCasesEntry.set(qcCasesEntryUpdataVO.getIsReject() != null,
                 "is_reject", qcCasesEntryUpdataVO.getIsReject());
+        qcCasesEntry.set("0".equals(qcCasesEntryUpdataVO.getIsPlacefile()) && qcCasesEntryUpdataVO.getScore() != null,
+                "score_run", qcCasesEntryUpdataVO.getScore());
+        qcCasesEntry.set("0".equals(qcCasesEntryUpdataVO.getIsPlacefile()) && qcCasesEntryUpdataVO.getIsUsed() != null,
+                "is_used_run", qcCasesEntryUpdataVO.getIsUsed());
         return update(new QcCasesEntryHospital(), qcCasesEntry);
     }
 

+ 4 - 3
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -69,13 +69,13 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
 
         Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
         //验证病历的存在性
-        Integer mrcnt
-                = behospitalInfoFacade.count(
+        List<BehospitalInfo> behospitalInfos
+                = behospitalInfoFacade.list(
                 new QueryWrapper<BehospitalInfo>()
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("hospital_id", hospitalId)
                         .eq("behospital_code", qcresultVO.getBehospitalCode()));
-        if (mrcnt < 1) {
+        if (behospitalInfos.size() != 1) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "该医院下该病历号不存在!");
         }
         //验证是否评估过
@@ -106,6 +106,7 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
         algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
         algorithmVO.setHospitalId(hospitalId);
         algorithmVO.setBehospitalCode(qcresultVO.getBehospitalCode());
+        algorithmVO.setIsPlacefile(behospitalInfos.get(0).getIsPlacefile());
         AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
         //更新质控评分结果信息
         AnalyzeVO analyzeVO = new AnalyzeVO();

+ 2 - 0
src/main/java/com/diagbot/vo/AlgorithmVO.java

@@ -30,4 +30,6 @@ public class AlgorithmVO {
     //是否病案首页
     private Boolean isHomePage = false;
     //-------长兴特殊算分用结束-----------
+
+    private String isPlacefile = "1";
 }

+ 1 - 0
src/main/java/com/diagbot/vo/QcCasesEntryFindVO.java

@@ -22,4 +22,5 @@ public class QcCasesEntryFindVO {
     private String entryName;//条目名
     @NotNull(message = "请输入病人住院ID")
     private String behospitalCode;//病人住院ID
+    private String isPlacefile = "1";
 }

+ 1 - 0
src/main/java/com/diagbot/vo/QcCasesEntryHospitalVO.java

@@ -20,6 +20,7 @@ public class QcCasesEntryHospitalVO extends Page {
     private Long casesId;
     private String name;
     private Integer isReject;
+    private String isPlacefile = "1";
     private Integer isUsed;
     private Integer ruleType;
 }

+ 1 - 0
src/main/java/com/diagbot/vo/QcCasesEntryUpdataVO.java

@@ -22,6 +22,7 @@ public class QcCasesEntryUpdataVO {
     private String msg;
     @NotNull(message = "请输分值")
     private Double score;
+    private String isPlacefile = "1";
     @NotNull(message = "请输单项否决")
     private Integer isReject;
     @NotNull(message = "请输启用标志")

+ 1 - 0
src/main/java/com/diagbot/vo/QcResultAlgQueryVO.java

@@ -17,4 +17,5 @@ public class QcResultAlgQueryVO {
     private Long hospitalId;
     //有问题的编码
     private List<String> codeList;
+    private String isPlacefile;
 }

+ 1 - 1
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -478,7 +478,7 @@
         IFNULL(a.doctor_name, ''),
         IFNULL(a.beh_doctor_name, ''),
         IFNULL(a.director_doctor_name, '')
-        ) LIKE CONCAT('%', u1.linkman, '%')
+        ) = CONCAT('%', u1.linkman, '%')
         ) t
         LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON t.behospital_code = g.behospital_code

+ 45 - 7
src/main/resources/mapper/QcCasesEntryHospitalMapper.xml

@@ -26,9 +26,23 @@
         a.cases_name As casesName,
         a.name as name,
         b.msg As msg,
-        b.score as score,
+        <choose>
+            <when test='isPlacefile == "0"'>
+                b.score_run AS score,
+            </when>
+            <otherwise>
+                b.score AS score,
+            </otherwise>
+        </choose>
+        <choose>
+            <when test='isPlacefile == "0"'>
+                b.is_used_run AS isUsed,
+            </when>
+            <otherwise>
+                b.is_used AS isUsed,
+            </otherwise>
+        </choose>
         b.is_reject As isReject,
-        b.is_used AS isUsed,
         a.rule_type
         from
         qc_cases_entry a
@@ -45,12 +59,22 @@
         <if test="name != null and name != ''">
             AND UPPER(a.name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')
         </if>
+        <choose>
+            <when test='isUsed != null and isPlacefile == "0"'>
+            AND b.is_used_run =#{isUsed}
+            </when>
+            <otherwise>
+            AND b.is_used =#{isUsed}
+            </otherwise>
+         </choose>
+
         <if test="isReject != null ">
             AND b.is_reject = #{isReject}
         </if>
-        <if test="isUsed != null ">
-            AND b.is_used =#{isUsed}
-        </if>
+<!--        <if test="isUsed != null ">-->
+<!--            AND b.is_used =#{isUsed}-->
+<!--        </if>-->
+
         <if test="ruleType != null">
             AND a.rule_type = #{ruleType}
         </if>
@@ -65,7 +89,14 @@
         a.hospital_id AS hospitalId,
         b. NAME AS entryName,
         a.msg AS msg,
-        a.score AS score,
+        <choose>
+            <when test='isPlacefile == "0"'>
+                a.score_run AS score,
+            </when>
+            <otherwise>
+                a.score AS score,
+            </otherwise>
+        </choose>
         a.is_reject AS isReject,
         c.score AS caseScore
         FROM
@@ -79,7 +110,14 @@
         AND a.cases_entry_id = b.id
         AND c.cases_id = b.cases_id
         AND c.hospital_id = a.hospital_id
-        AND a.is_used = 1
+        <choose>
+            <when test='isPlacefile == "0"'>
+                AND a.is_used_run = 1
+            </when>
+            <otherwise>
+                AND a.is_used = 1
+            </otherwise>
+        </choose>
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>

+ 9 - 2
src/main/resources/mapper/QcCasesEntryMapper.xml

@@ -40,7 +40,7 @@
         AND t2.case_entry_id = t3.cases_entry_id
         AND t1.hospital_id = t3.hospital_id
         AND t3.cases_entry_id = t4.id
-        AND t3.is_used = 1
+        AND ((t1.is_placefile='0' and t3.is_used_run=1) or (t1.is_placefile='1' and t3.is_used=1))
         AND t1.is_deleted = 'N'
         AND t2.is_deleted = 'N'
         AND t3.is_deleted = 'N'
@@ -61,7 +61,14 @@
             t4.cases_id AS casesId,
             t4.score AS casesScore,
             t1.cases_entry_id AS casesEntryId,
-            t1.score AS score,
+            <choose>
+                <when test='isPlacefile != null and isPlacefile =="0"'>
+                    t1.score_run AS score,
+                </when>
+                <otherwise>
+                    t1.score AS score,
+                </otherwise>
+            </choose>
             t1.msg AS msg,
             t1.is_reject AS isReject,
             t2.code