Sfoglia il codice sorgente

Merge branch 'dev/20220105_2.2.0_通用版_申诉驳回' into test

songxinlu 3 anni fa
parent
commit
bbae4feb3a

+ 40 - 27
src/main/java/com/diagbot/facade/MedAppealExamineInfoManagementFacade.java

@@ -25,6 +25,7 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.MedAppealExamineInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.ApprovedVo;
 import com.diagbot.vo.GetAppealReviewVO;
@@ -74,9 +75,10 @@ public class MedAppealExamineInfoManagementFacade extends MedAppealExamineInfoSe
                     .eq("mode_id", modeId)
                     .groupBy("mode_id")
             );
-            qcResultAlgVO.setCasesId(qcCasesEntry.getCasesId());
+            if(qcCasesEntry!=null) {
+                qcResultAlgVO.setCasesId(qcCasesEntry.getCasesId());
+            }
         }
-        qcresultVO.setOptResultAlgVO(qcResultAlgVO);
         //获取处理方式
         String handling = approvedVo.getExampleOperation();
         if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.UP_OR_DEL.getKey())) {
@@ -87,6 +89,8 @@ public class MedAppealExamineInfoManagementFacade extends MedAppealExamineInfoSe
             //调用删除接口
             qcresultVO.setDelStatus(0);
             qcresultVO.setType(4);
+            qcResultAlgVO.setId(detail.getId());
+            qcresultVO.setOptResultAlgVO(qcResultAlgVO);
             AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
             if (analyzeDTORespDTO.getIsSuccess()) {
                 approvedVo.setQcresultDetailId(detail.getId());
@@ -117,9 +121,10 @@ public class MedAppealExamineInfoManagementFacade extends MedAppealExamineInfoSe
             }
             //调用修改接口
             qcresultVO.setType(3);
+            qcResultAlgVO.setId(detail.getId());
+            qcresultVO.setOptResultAlgVO(qcResultAlgVO);
             AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
             if (analyzeDTORespDTO.getIsSuccess()) {
-                approvedVo.setQcresultDetailId(detail.getId());
                 Boolean appealInfo = updateAppealInfo(approvedVo);
                 MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
                 medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.UP_OR_UP.getKey());
@@ -183,37 +188,46 @@ public class MedAppealExamineInfoManagementFacade extends MedAppealExamineInfoSe
         if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.RECOVER.getKey())) {
             qcresultVO.setType(4);
             qcresultVO.setDelStatus(1);
+            //判断条目是否以恢复
+            QcresultDetail qcresultDetail = getQcresultDetail(approvedVo);
+            if (qcresultDetail != null) {
+                throw new CommonException(CommonErrorCode.IS_EXISTS, "该条目已恢复,无法进行审核操作,请走驳回流程。");
+            }
+
             //调用删除恢复接口
-            QcresultDetail qcresultDetail = qcresultDetailFacade.getOne(new QueryWrapper<QcresultDetail>()
+            List<QcresultDetail> qcresultDetails = qcresultDetailFacade.list(new QueryWrapper<QcresultDetail>()
                     .eq("hospital_id", approvedVo.getHospitalId())
                     .eq("behospital_code", approvedVo.getBehospitalCode())
                     .eq("cases_entry_id", approvedVo.getQcResultAlgVO().getCasesEntryId())
+                    .eq("is_deleted",IsDeleteEnum.Y.getKey())
                     .eq("grade_type", 2)
+                    .orderByDesc("gmt_create")
             );
-            if (qcresultDetail == null) {
-                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "该条目已删除,无法进行审核操作,请走驳回流程。");
-            }
-            AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
-            if (analyzeDTORespDTO.getIsSuccess()) {
-                approvedVo.setQcresultDetailId(qcresultDetail.getId());
-                Boolean appealInfo = updateAppealInfo(approvedVo);
-                MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
-                medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.RECOVER.getKey());
-                medAppealExamineInfo.setExampleStatus(ExampleStatusEnum.ADOPT_EXAMPLE.getKey());
-                medAppealExamineInfo.setRemark(qcResultAlgVO.getExplainInfo());
-                medAppealExamineInfo.setGmtCreate(dateTime);
-                boolean update = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
-                        .eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .eq("appeal_info_id", approvedVo.getId())
-                        .eq("check_id", approvedVo.getAppealId())
-                );
-                if (appealInfo && update) {
-                    return true;
+            if(ListUtil.isNotEmpty(qcresultDetails)){
+                qcResultAlgVO.setId(qcresultDetails.get(0).getId());
+                qcresultVO.setOptResultAlgVO(qcResultAlgVO);
+                AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
+                if (analyzeDTORespDTO.getIsSuccess()) {
+                    approvedVo.setQcresultDetailId(qcresultDetails.get(0).getId());
+                    Boolean appealInfo = updateAppealInfo(approvedVo);
+                    MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
+                    medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.RECOVER.getKey());
+                    medAppealExamineInfo.setExampleStatus(ExampleStatusEnum.ADOPT_EXAMPLE.getKey());
+                    medAppealExamineInfo.setRemark(qcResultAlgVO.getExplainInfo());
+                    medAppealExamineInfo.setGmtCreate(dateTime);
+                    boolean update = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
+                            .eq("is_deleted", IsDeleteEnum.N.getKey())
+                            .eq("appeal_info_id", approvedVo.getId())
+                            .eq("check_id", approvedVo.getAppealId())
+                    );
+                    if (appealInfo && update) {
+                        return true;
+                    } else {
+                        throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
+                    }
                 } else {
-                    throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
+                    throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "恢复失败!");
                 }
-            } else {
-                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "恢复失败!");
             }
         }
         if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.ADD_NO_EXIST.getKey())) {
@@ -236,7 +250,6 @@ public class MedAppealExamineInfoManagementFacade extends MedAppealExamineInfoSe
         }
         throw new CommonException(CommonErrorCode.NOT_EXISTS, "无此类型处理方式!");
     }
-
     public Boolean updateAppealInfo(ApprovedVo approvedVo) {
         MedAppealInfo medAppealInfo = new MedAppealInfo();
         medAppealInfo.setQcresultDetailId(approvedVo.getQcresultDetailId());