Browse Source

Merge branch 'dev/20201210_1.4.9' into innerDevelop

chengyao 4 years ago
parent
commit
890c69bdbd

+ 104 - 36
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -46,6 +46,7 @@ import org.springframework.stereotype.Component;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -156,6 +157,9 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     MedTransferRecordFacade medTransferRecordFacade;
     MedTransferRecordFacade medTransferRecordFacade;
     @Autowired
     @Autowired
     MedNurseFacade medNurseFacade;
     MedNurseFacade medNurseFacade;
+    @Autowired
+    SysHospitalSetFacade sysHospitalSetFacade;
+
 
 
 
 
     /**
     /**
@@ -974,7 +978,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         analyzeVO.setHospitalId(hospitalId);
         analyzeVO.setHospitalId(hospitalId);
 
 
         // 处理公共数据
         // 处理公共数据
-
             QueryVo  queryVo = dealCommonData(hospitalId, analyzeVO);
             QueryVo  queryVo = dealCommonData(hospitalId, analyzeVO);
         queryVo.setUseCrfCache(analyzeVO.isUseCrfCache());
         queryVo.setUseCrfCache(analyzeVO.isUseCrfCache());
         //  调用质控接口
         //  调用质控接口
@@ -1566,23 +1569,57 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     /**
     /**
      * 评分api
      * 评分api
      *
      *
-     * @param analyzeApiVO
+     * @param analyzeRunVO
      * @return
      * @return
      */
      */
-    public Map<String, Object> analyzeApi(AnalyzeApiVO analyzeApiVO) {
-        AnalyzeVO analyzeVO = new AnalyzeVO();
-        BeanUtil.copyProperties(analyzeApiVO, analyzeVO);
-        // 评分
-        analyze(analyzeVO);
-        // 获取结果
-        GetDetailVO getDetailVO = new GetDetailVO();
-        getDetailVO.setHospitalId(analyzeApiVO.getHospitalId());
-        getDetailVO.setBehospitalCode(analyzeApiVO.getBehospitalCode());
-        getDetailVO.setNeedGroup(analyzeApiVO.getNeedGroup());
-        return getByBehospitalCodeApi(getDetailVO);
+    public AnalyzeRunDTO analyzeApi(AnalyzeRunVO analyzeRunVO) {
+        List<MsgDTO> msgDTOList = this.getMsgByBehospitalCode(analyzeRunVO);
+        //返回参数组装
+        AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
+
+        QcresultInfo qcresultInfo = qcresultInfoFacade.getOne(new QueryWrapper<QcresultInfo>()
+                .eq("behospital_code", analyzeRunVO.getBehospitalCode())
+                .eq("hospital_id", analyzeRunVO.getHospitalId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .select("behospital_code", "level", "score_res"));
+        BigDecimal bigDecimal = new BigDecimal(0);
+        BigDecimal res = new BigDecimal(120);
+        BigDecimal resPr = new BigDecimal(100);
+        String reNum = "0";
+        SysHospitalSet sysHospitalSet
+                = sysHospitalSetFacade.getOne(new QueryWrapper<SysHospitalSet>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id", analyzeRunVO.getHospitalId())
+                , false);
+        if (null != sysHospitalSet
+                && sysHospitalSet.getValue().equals("1")) {
+            //百分制
+            reNum = "1";
+        }
+        if(null != qcresultInfo){
+            analyzeRunDTO.setLevel(qcresultInfo.getLevel()==null?"":qcresultInfo.getLevel());
+            analyzeRunDTO.setScoreRes(qcresultInfo.getScoreRes() ==null ? bigDecimal : qcresultInfo.getScoreRes());
+            if("1".equals(reNum)) {
+                bigDecimal = resPr.subtract(analyzeRunDTO.getScoreRes());
+            }else if("0".equals(reNum)){
+                bigDecimal = res.subtract(analyzeRunDTO.getScoreRes().multiply(new BigDecimal(120))
+                          .divide(new BigDecimal(100), 1, RoundingMode.HALF_UP));
+            }
+            //缺陷总数
+            Long num = msgDTOList
+                    .stream()
+                    .filter(Objects::nonNull)
+                    .count();
+            analyzeRunDTO.setNum(num);
+            analyzeRunDTO.setNumScore(bigDecimal);
+            analyzeRunDTO.setMsgDTOList(msgDTOList);
+        }
+        return analyzeRunDTO;
     }
     }
 
 
 
 
+
+
     /**
     /**
      * 获取明细api
      * 获取明细api
      *
      *
@@ -1668,31 +1705,62 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @return
      * @return
      */
      */
     public AnalyzeRunDTO analyzeRun(AnalyzeRunVO analyzeRunVO) {
     public AnalyzeRunDTO analyzeRun(AnalyzeRunVO analyzeRunVO) {
-        List<MsgDTO> msgDTOList = this.getMsgByBehospitalCode(analyzeRunVO);
+        Long modeId = analyzeRunVO.getModeId();
+        analyzeRunVO.setModeId(null);
+        AnalyzeVO analyzeVO = new AnalyzeVO();
+        BeanUtil.copyProperties(analyzeRunVO, analyzeVO);
+        Long hospitalId = analyzeVO.getHospitalId();
+
+        // 处理公共数据
+            QueryVo queryVo = dealCommonData(hospitalId, analyzeVO);
+        //  调用质控接口
+        Response<OutputInfo> response = qcServiceClient.extract(queryVo);
+        if (response == null || response.getData() == null) {
+            if (null == response) {
+                throw new CommonException(CommonErrorCode.RPC_ERROR, "远程质控接口没有返回数据!【" + analyzeVO.getBehospitalCode() + "】");
+            } else {
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        "远程质控接口没有返回数据!【" + analyzeVO.getBehospitalCode() + "】错误原因:" + response.getMsg());
+            }
+        }
+        OutputInfo outputInfo = response.getData();
+        // 质控编码列表
+        List<String> codeList = new ArrayList<>();
+        // code和info的映射map
+        Map<String, String> codeToInfoMap = new LinkedHashMap<>();
+        // 对codeList 和 codeToInfoMap进行赋值
+        setCodeData(outputInfo, codeList, codeToInfoMap);
+
+        // 如果是1,说明已是终末质控,不再保存质控结果数据;如果是0,则保存质控结果数据
+        if ("0".equals(analyzeRunVO.getIsPlacefile())) {
+            // 计算分值并保存结果至数据库
+            Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO, queryVo.getBehospitalInfo().getIsPlacefile());
+        }
+
+        // 返回缺陷提示信息
+        List<MsgDTO> msgDTOList = new ArrayList<>();
+        if (ListUtil.isNotEmpty(codeList)) {
+            AnalyzeCodeVO analyzeCodeVO = new AnalyzeCodeVO();
+            analyzeCodeVO.setCodeList(codeList);
+            analyzeCodeVO.setHospitalId(hospitalId);
+            analyzeCodeVO.setModeId(modeId);
+            // 获取缺陷条目信息
+            msgDTOList = getMsgByEntryCode(analyzeCodeVO);
+            // 设置info信息
+            if (codeToInfoMap != null && !codeToInfoMap.isEmpty()) {
+                for (MsgDTO msgDTO : msgDTOList) {
+                    String info = codeToInfoMap.get(msgDTO.getCode());
+                    if (StringUtil.isNotBlank(info)) {
+                        msgDTO.setInfo(info);
+                    }
+                }
+            }
+        }
+
         //返回参数组装
         //返回参数组装
         AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
         AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
-        //缺陷总扣分
-        BigDecimal numScore = msgDTOList
-                .stream()
-                .map(MsgDTO::getScore)
-                .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-        //缺陷总数
-        Long num = msgDTOList
-                .stream()
-                .filter(Objects::nonNull)
-                .count();
-        analyzeRunDTO.setNum(num);
-        analyzeRunDTO.setNumScore(numScore);
-        QcresultInfo qcresultInfo = qcresultInfoFacade.getOne(new QueryWrapper<QcresultInfo>()
-                .eq("behospital_code", analyzeRunVO.getBehospitalCode())
-                .eq("hospital_id", analyzeRunVO.getHospitalId())
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .select("behospital_code", "level", "score_res"));
-        BigDecimal bigDecimal = new BigDecimal(0);
-        if(null != qcresultInfo){
-            analyzeRunDTO.setLevel(qcresultInfo.getLevel()==null?"":qcresultInfo.getLevel());
-            analyzeRunDTO.setScoreRes(qcresultInfo.getScoreRes() ==null ? bigDecimal : qcresultInfo.getScoreRes());
-        }
+        // analyzeRunDTO.setScoreRes(algorithmDTO.getScore());
+        // analyzeRunDTO.setLevel(algorithmDTO.getLevel());
         analyzeRunDTO.setMsgDTOList(msgDTOList);
         analyzeRunDTO.setMsgDTOList(msgDTOList);
         return analyzeRunDTO;
         return analyzeRunDTO;
     }
     }

+ 2 - 2
src/main/java/com/diagbot/web/BehospitalInfoController.java

@@ -122,8 +122,8 @@ public class BehospitalInfoController {
     @SysLogger("analyze_api")
     @SysLogger("analyze_api")
     @Transactional
     @Transactional
     //    @ApiIgnore
     //    @ApiIgnore
-    public RespDTO<Map<String, Object>> analyzeApi(@RequestBody AnalyzeApiVO analyzeApiVO) {
-        return RespDTO.onSuc(behospitalInfoFacade.analyzeApi(analyzeApiVO));
+    public RespDTO<AnalyzeRunDTO> analyzeApi(@RequestBody AnalyzeRunVO analyzeRunVO) {
+        return RespDTO.onSuc(behospitalInfoFacade.analyzeApi(analyzeRunVO));
     }
     }
 
 
 
 

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

@@ -734,8 +734,8 @@
             and a.is_placefile = #{isPlacefile}
             and a.is_placefile = #{isPlacefile}
         </if>
         </if>
         AND (
         AND (
-        ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' AND b.newborn_day != '-' )
-        OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' AND b.newborn_month != '-' )
+        ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' AND b.newborn_day != '-' AND b.newborn_day != '—')
+        OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' AND b.newborn_month != '-' AND b.newborn_month != '—')
         )
         )
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="hospitalId != null and hospitalId != ''">
         <if test="hospitalId != null and hospitalId != ''">
@@ -945,8 +945,8 @@
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = b.behospital_code
         AND a.beh_dept_id = c.dept_id
         AND a.beh_dept_id = c.dept_id
         AND (
         AND (
-        ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' AND b.newborn_day != '-' )
-        OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' AND b.newborn_month != '-' )
+        ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' AND b.newborn_day != '-'AND b.newborn_day != '—' )
+        OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' AND b.newborn_month != '-' AND b.newborn_month != '—')
         )
         )
         <if test="isPlacefile != null and isPlacefile != ''">
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
             and a.is_placefile = #{isPlacefile}
@@ -5400,8 +5400,8 @@
             AND t1.hospital_id = t2.hospital_id
             AND t1.hospital_id = t2.hospital_id
             AND t1.behospital_code = t2.behospital_code
             AND t1.behospital_code = t2.behospital_code
             AND (
             AND (
-            ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-' )
-            OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-' )
+            ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' )
+            OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
             )
             )
         </if>
         </if>
         <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
         <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">