Преглед изворни кода

Merge branch 'dev/20210625_v3.1_权限' into dev/20220228_v3.0.1通用版_渠道管理第一期

rengb пре 3 година
родитељ
комит
9d88fda98c
16 измењених фајлова са 303 додато и 77 уклоњено
  1. 1 0
      gateway-service/src/main/resources/bootstrap.yml
  2. 4 0
      report-service/src/main/java/com/lantone/report/dto/GetAppealReviewDTO.java
  3. 6 2
      report-service/src/main/java/com/lantone/report/dto/GetComplaintRecordDTO.java
  4. 13 0
      report-service/src/main/java/com/lantone/report/entity/AppealExamineInfo.java
  5. 23 6
      report-service/src/main/java/com/lantone/report/facade/MedAppealExamineInfoManagementFacade.java
  6. 51 23
      report-service/src/main/java/com/lantone/report/facade/MedAppealInfoManagementFacade.java
  7. 9 0
      report-service/src/main/java/com/lantone/report/mapper/AppealExamineInfoMapper.java
  8. 3 0
      report-service/src/main/java/com/lantone/report/vo/AddAppealInfoVO.java
  9. 2 0
      report-service/src/main/java/com/lantone/report/vo/CancelAppealInfoVO.java
  10. 7 4
      report-service/src/main/java/com/lantone/report/vo/GetAppealInfoVO.java
  11. 7 1
      report-service/src/main/java/com/lantone/report/vo/GetAuditNumberVO.java
  12. 31 0
      report-service/src/main/java/com/lantone/report/vo/GetComplaintDetailMsgVO.java
  13. 9 1
      report-service/src/main/java/com/lantone/report/web/MedAppealExamineInfoManagementController.java
  14. 127 31
      report-service/src/main/resources/mapper/AppealExamineInfoMapper.xml
  15. 8 9
      report-service/src/main/resources/mapper/AppealInfoMapper.xml
  16. 2 0
      report-service/src/main/resources/mapper/base/BaseAppealExamineInfoMapper.xml

+ 1 - 0
gateway-service/src/main/resources/bootstrap.yml

@@ -113,6 +113,7 @@ secure:
       - "/report-service/medAppealExamineInInfoManage/getAuditNumber"
       - "/report-service/medAppealExamineInInfoManage/rejected"
       - "/report-service/medAppealExamineInInfoManage/getApprovedView"
+      - "/report-service/medAppealExamineInInfoManage/getComplaintDetailMsg"
       - "/report-service/medAppealInfoManage/addAppealInfo"
       - "/report-service/medAppealInfoManage/getReviewer"
       - "/report-service/medAppealInfoManage/getAppealOperationType"

+ 4 - 0
report-service/src/main/java/com/lantone/report/dto/GetAppealReviewDTO.java

@@ -64,4 +64,8 @@ public class GetAppealReviewDTO {
     @ApiModelProperty(value = "状态")
     private String exampleStatus;
 
+    @ApiModelProperty(value = "模块id")
+    private Long modeId;
+
+
 }

+ 6 - 2
report-service/src/main/java/com/lantone/report/dto/GetComplaintRecordDTO.java

@@ -10,6 +10,7 @@ import java.util.Date;
 
 /**
  * 申述记录
+ *
  * @Description:
  * @author: cy
  * @time: 2020/9/4 14:59
@@ -34,7 +35,7 @@ public class GetComplaintRecordDTO {
     private String behDeptName;
 
     @ApiModelProperty(value = "申述申诉时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date claimantGmtCreate;
 
     @ApiModelProperty(value = "病人住院序号")
@@ -62,7 +63,7 @@ public class GetComplaintRecordDTO {
     private String checkName;
 
     @ApiModelProperty(value = "审核时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date checkGmtCreate;
 
     @ApiModelProperty(value = "操作类型")
@@ -85,4 +86,7 @@ public class GetComplaintRecordDTO {
 
     @ApiModelProperty(value = "模块id")
     private Long modeId;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
 }

+ 13 - 0
report-service/src/main/java/com/lantone/report/entity/AppealExamineInfo.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -50,6 +51,12 @@ public class AppealExamineInfo implements Serializable {
     @TableField("example_operation")
     private String exampleOperation;
 
+    /**
+     * 审核分值
+     */
+    @TableField("value")
+    private BigDecimal value;
+
     /**
      * 处理结果
      */
@@ -62,6 +69,12 @@ public class AppealExamineInfo implements Serializable {
     @TableField("reject_reason")
     private String rejectReason;
 
+    /**
+     * 提示信息
+     */
+    @TableField("msg")
+    private String msg;
+
     /**
      * 是否删除,N:未删除,Y:删除
      */

+ 23 - 6
report-service/src/main/java/com/lantone/report/facade/MedAppealExamineInfoManagementFacade.java

@@ -11,13 +11,16 @@ import com.lantone.report.dto.GetAppealReviewDTO;
 import com.lantone.report.dto.GetComplaintRecordDTO;
 import com.lantone.report.entity.AppealExamineInfo;
 import com.lantone.report.entity.AppealInfo;
+import com.lantone.report.entity.QcresultDetail;
 import com.lantone.report.enums.AppealOperationTypeEnum;
 import com.lantone.report.enums.ExampleStatusEnum;
 import com.lantone.report.facade.base.AppealExamineInfoFacade;
 import com.lantone.report.facade.base.AppealInfoFacade;
+import com.lantone.report.facade.base.QcresultDetailFacade2;
 import com.lantone.report.vo.GetAppealInfoVO;
 import com.lantone.report.vo.GetAppealReviewVO;
 import com.lantone.report.vo.GetAuditNumberVO;
+import com.lantone.report.vo.GetComplaintDetailMsgVO;
 import com.lantone.report.vo.GetComplaintRecordVO;
 import com.lantone.report.vo.RejectedVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +45,8 @@ public class MedAppealExamineInfoManagementFacade {
     private AppealInfoFacade appealInfoFacade;
     @Autowired
     MedAppealInfoManagementFacade medAppealInfoManagementFacade;
+    @Autowired
+    QcresultDetailFacade2 qcresultDetailFacade2;
 
     /**
      * 申诉记录列表
@@ -103,12 +108,7 @@ public class MedAppealExamineInfoManagementFacade {
      * @return
      */
     public Integer getAuditNumber(GetAuditNumberVO getAuditNumberVO) {
-        Integer count = appealExamineInfoFacade.getBaseMapper().selectCount(new QueryWrapper<AppealExamineInfo>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("check_id", getAuditNumberVO.getId())
-                .eq("example_status", 0)
-        );
-        return count;
+        return appealExamineInfoFacade.getBaseMapper().getAuditNumber(getAuditNumberVO);
     }
 
     /**
@@ -127,10 +127,27 @@ public class MedAppealExamineInfoManagementFacade {
             if (AppealOperationTypeEnum.ADD_NO_EXIST.getKey().equals(appealInfo.getAppealOperationType())) {
                 getAppealInfoVO.setAppealExplain(appealInfo.getAppealExplain());
             }
+            getAppealInfoVO.setModeId(appealInfo.getModeId());
         }
         //3.获取申诉审核记录
         getAppealInfoDTO.setAppealExamineRecordDTOList(appealInfoFacade.getBaseMapper().getAppealExamineRecords(getAppealInfoVO));
         return getAppealInfoDTO;
     }
 
+    /**
+     * 获取该申诉记录最新缺陷详情
+     *
+     * @param getComplaintDetailMsgVO
+     * @return
+     */
+    public QcresultDetail getComplaintDetailMsg(GetComplaintDetailMsgVO getComplaintDetailMsgVO) {
+        QcresultDetail qcresultDetail = qcresultDetailFacade2.getOne(new QueryWrapper<QcresultDetail>()
+                .eq("behospital_code", getComplaintDetailMsgVO.getBehospitalCode())
+                .eq("id", getComplaintDetailMsgVO.getId())
+                .eq("cases_entry_id", getComplaintDetailMsgVO.getCasesEntryId())
+                .eq("hospital_id", getComplaintDetailMsgVO.getHospitalId())
+        );
+        return qcresultDetail;
+    }
+
 }

+ 51 - 23
report-service/src/main/java/com/lantone/report/facade/MedAppealInfoManagementFacade.java

@@ -38,6 +38,7 @@ import org.springframework.stereotype.Component;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:申诉审核管理
@@ -46,8 +47,6 @@ import java.util.Map;
  */
 @Component
 public class MedAppealInfoManagementFacade {
-    @Autowired
-    private WorkFlowNodeFacade workFlowNodeFacade;
 
     @Autowired
     private AppealInfoFacade appealInfoFacade;
@@ -61,6 +60,11 @@ public class MedAppealInfoManagementFacade {
 
     public Boolean addAppealInfo(AddAppealInfoVO addAppealInfoVO) {
 
+        //判断是否只单人操作
+        if (addAppealInfoVO.getSingleAppealFalg()) {
+            checkSingleAppeal(addAppealInfoVO);
+        }
+
         if (addAppealInfoVO.getModeId() != null) {
             //获取模块名称
             String modeName = appealInfoFacade.getBaseMapper().getModeName(addAppealInfoVO.getModeId());
@@ -86,7 +90,7 @@ public class MedAppealInfoManagementFacade {
                 }
                 //获取申诉记录当前节点状态(1:申诉|2:撤销|3:科室审核)
                 if (WorkFlowNodeEnum.APPEAL.getKey().equals(appealInfo.getWorkFlowNodeId() + "")) {
-                    Asserts.fail("该缺陷已被申诉");
+                    Asserts.fail("请勿重复提交申诉,如需修改,请在申诉列表撤回后重新发起。");
                 } else {
                     //删除申诉记录
                     appealInfoFacade.update(new UpdateWrapper<AppealInfo>().set("is_deleted", IsDeleteEnum.Y.getKey())
@@ -124,7 +128,7 @@ public class MedAppealInfoManagementFacade {
                                 .set("is_deleted", IsDeleteEnum.Y.getKey())
                                 .eq("appeal_info_id", oldAppealInfo.getId()));
                     } else if (WorkFlowNodeEnum.APPEAL.getKey().equals(oldAppealInfo.getWorkFlowNodeId() + "")) {
-                        Asserts.fail("该缺陷已被申诉无需再次恢复");
+                        Asserts.fail("该缺陷已被申诉无需再次申诉");
                     }
 
                 }
@@ -141,8 +145,8 @@ public class MedAppealInfoManagementFacade {
                     }
                 }
                 //1.判断新增缺失是否存在(医院id+病历id+申诉说明+状态【申诉】)
-                AppealInfo notAppealInfo = getAppealInfo(addAppealInfoVO.getHospitalId(), addAppealInfoVO.getBehospitalCode()
-                        , addAppealInfoVO.getAppealExplain());
+                AppealInfo notAppealInfo = getAppealInfo(addAppealInfoVO.getHospitalId(), addAppealInfoVO.getBehospitalCode(),
+                        addAppealInfoVO.getModeId(), addAppealInfoVO.getAppealExplain());
                 //申诉记录不存在
                 if (notAppealInfo != null) {
                     if (WorkFlowNodeEnum.APPEAL.getKey().equals(notAppealInfo.getWorkFlowNodeId() + "")) {
@@ -196,6 +200,24 @@ public class MedAppealInfoManagementFacade {
         return false;
     }
 
+    private void checkSingleAppeal(AddAppealInfoVO addAppealInfoVO) {
+        //新增缺失
+        if (AppealOperationTypeEnum.ADD_NO_EXIST.getKey().equals(addAppealInfoVO.getAppealOperationType())) {
+
+        } else {
+            List<AppealInfo> appealInfos = appealInfoFacade.list(new QueryWrapper<AppealInfo>()
+                    .eq("hospital_id", addAppealInfoVO.getHospitalId())
+                    .eq("behospital_code", addAppealInfoVO.getBehospitalCode())
+                    .eq("cases_entry_id", addAppealInfoVO.getCasesEntryId())
+                    .notIn("work_flow_node_id", WorkFlowNodeEnum.APPEAL_BACK.getKey())
+                    .notIn("claimant_id", addAppealInfoVO.getClaimantId())
+                    .orderByDesc("gmt_create"));
+            if (ListUtil.isNotEmpty(appealInfos)) {
+                Asserts.fail("该缺陷条目已被他人操作,无法操作。");
+            }
+        }
+    }
+
     private AppealInfo getAppealInfo(AddAppealInfoVO addAppealInfoVO) {
         if (addAppealInfoVO.getCasesEntryId() == null) {
             Asserts.fail("新增已有条目casesEntryId不能为空");
@@ -265,12 +287,13 @@ public class MedAppealInfoManagementFacade {
      * @Description获取该病历缺陷申诉记录(新增缺失)
      * @Return com.lantone.report.entity.AppealInfo
      */
-    private AppealInfo getAppealInfo(Long hospitalId, String behospitalCode, String appealExplain) {
+    private AppealInfo getAppealInfo(Long hospitalId, String behospitalCode, Long modeId, String appealExplain) {
 
         List<AppealInfo> appealInfos = appealInfoFacade.list(new QueryWrapper<AppealInfo>()
                 .eq("hospital_id", hospitalId)
                 .eq("behospital_code", behospitalCode)
                 .eq("appeal_operation_type", AppealOperationTypeEnum.ADD_NO_EXIST.getKey())
+                .eq(modeId != null, "mode_id", modeId)
                 .eq("appeal_explain", appealExplain)
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .orderByDesc("gmt_create"));
@@ -293,7 +316,7 @@ public class MedAppealInfoManagementFacade {
                 .eq("hospital_id", addAppealInfoVO.getHospitalId())
                 .eq("behospital_code", addAppealInfoVO.getBehospitalCode())
                 .eq("cases_entry_id", addAppealInfoVO.getCasesEntryId())
-                .orderByDesc("gmt_create"));
+                .orderByDesc("id"));
         if (ListUtil.isEmpty(qcresultDetails)) {
             Asserts.fail("质控缺陷不存在");
         }
@@ -309,23 +332,24 @@ public class MedAppealInfoManagementFacade {
         //获取审核人列表
         List<GetReviewerDTO> reviewers = sysUserRoleFacade.getBaseMapper().getUserByRole(getReviewerVO);
         //获取申诉人申诉记录审核人(时间倒序)
-        List<AppealInfo> appealInfos = appealInfoFacade.list(new QueryWrapper<AppealInfo>()
-                .select("DISTINCT  check_id")
+        List<Long> appealInfos = appealInfoFacade.list(new QueryWrapper<AppealInfo>()
+                .select("check_id")
                 .eq("claimant_id", getReviewerVO.getClaimantId())
-                .orderByDesc("gmt_create"));
+                .orderByDesc("gmt_create")).stream().map(AppealInfo::getCheckId).distinct().collect(Collectors.toList());
+        //去重
         return sortReviewer(reviewers, appealInfos);
     }
 
-    private List<GetReviewerDTO> sortReviewer(List<GetReviewerDTO> reviewers, List<AppealInfo> appealInfos) {
-        if (ListUtil.isEmpty(appealInfos)) {
+    private List<GetReviewerDTO> sortReviewer(List<GetReviewerDTO> reviewers, List<Long> checkIds) {
+        if (ListUtil.isEmpty(checkIds)) {
             return reviewers;
         }
         List<GetReviewerDTO> temp = new ArrayList<>(reviewers);
         if (ListUtil.isNotEmpty(reviewers)) {
             List<GetReviewerDTO> out = new ArrayList<>();
-            for (AppealInfo appealInfo : appealInfos) {
+            for (Long checkId : checkIds) {
                 for (GetReviewerDTO getReviewerDTO : reviewers) {
-                    if (getReviewerDTO.getId().intValue() == appealInfo.getCheckId().intValue()) {
+                    if (getReviewerDTO.getId().intValue() == checkId.intValue()) {
                         out.add(getReviewerDTO);
                         temp.remove(getReviewerDTO);
                     }
@@ -344,12 +368,12 @@ public class MedAppealInfoManagementFacade {
         QcresultDetail nowQcresultDetail = null;
         if (qcresultDetail != null) {
             //获取最新的缺陷
-         List<QcresultDetail>  qcresultDetails = qcresultDetailFacade.list(new QueryWrapper<QcresultDetail>()
-                    .eq("hospital_id",qcresultDetail.getHospitalId())
-                    .eq("behospital_code",qcresultDetail.getBehospitalCode())
-                    .eq("cases_entry_id",qcresultDetail.getCasesEntryId())
-                    .orderByDesc("gmt_create"));
-            if(ListUtil.isNotEmpty(qcresultDetails)){
+            List<QcresultDetail> qcresultDetails = qcresultDetailFacade.list(new QueryWrapper<QcresultDetail>()
+                    .eq("hospital_id", qcresultDetail.getHospitalId())
+                    .eq("behospital_code", qcresultDetail.getBehospitalCode())
+                    .eq("cases_entry_id", qcresultDetail.getCasesEntryId())
+                    .orderByDesc("id"));
+            if (ListUtil.isNotEmpty(qcresultDetails)) {
                 nowQcresultDetail = qcresultDetails.get(0);
             }
 
@@ -359,7 +383,7 @@ public class MedAppealInfoManagementFacade {
                 if (nowQcresultDetail == null) {
                     Asserts.fail("质控缺陷条目不存在");
                 }
-                if (IsDeleteEnum.N.getKey().equals(qcresultDetail.getIsDeleted())) {
+                if (IsDeleteEnum.N.getKey().equals(nowQcresultDetail.getIsDeleted())) {
                     out.put("appealOperationType", AppealOperationTypeEnum.UP_OR_DEL.getKey());
                     out.put("appealOperationName", AppealOperationTypeEnum.UP_OR_DEL.getName());
                 } else {
@@ -404,6 +428,9 @@ public class MedAppealInfoManagementFacade {
         Boolean out = false;
         //获取申诉记录
         AppealInfo appealInfo = appealInfoFacade.getById(cancelAppealInfoVO.getId());
+        if (!cancelAppealInfoVO.getClaimantId().equals(appealInfo.getClaimantId())) {
+            Asserts.fail("该申诉并非由你发起,无法撤回。");
+        }
         if (appealInfo == null) {
             Asserts.fail("撤回申诉条目不存在");
         }
@@ -456,7 +483,7 @@ public class MedAppealInfoManagementFacade {
             }
             Asserts.fail("撤回失败");
         } else {
-            Asserts.fail("撤回申诉条目状态不是申诉状态");
+            Asserts.fail("该申诉已被审核,无法撤回。");
         }
         return false;
     }
@@ -471,6 +498,7 @@ public class MedAppealInfoManagementFacade {
             if (AppealOperationTypeEnum.ADD_NO_EXIST.getKey().equals(appealInfo.getAppealOperationType())) {
                 getAppealInfoVO.setAppealExplain(appealInfo.getAppealExplain());
             }
+            getAppealInfoVO.setModeId(appealInfo.getModeId());
         }
         //3.获取申诉审核记录
         getAppealInfoDTO.setAppealExamineRecordDTOList(appealInfoFacade.getBaseMapper().getAppealExamineRecords(getAppealInfoVO));

+ 9 - 0
report-service/src/main/java/com/lantone/report/mapper/AppealExamineInfoMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.lantone.report.dto.GetAppealReviewDTO;
 import com.lantone.report.dto.GetComplaintRecordDTO;
+import com.lantone.report.vo.GetAuditNumberVO;
 import com.lantone.report.vo.GetComplaintRecordVO;
 import com.lantone.report.vo.GetAppealReviewVO;
 import com.lantone.report.vo.ApprovedVo;
@@ -39,4 +40,12 @@ public interface AppealExamineInfoMapper extends BaseMapper<AppealExamineInfo> {
      * @return
      */
     Boolean approved(@Param("approvedVo") ApprovedVo approvedVo);
+
+    /**
+     * 获取待审核数量
+     *
+     * @param getAuditNumberVO
+     * @return
+     */
+    Integer getAuditNumber(@Param("getAuditNumberVO") GetAuditNumberVO getAuditNumberVO);
 }

+ 3 - 0
report-service/src/main/java/com/lantone/report/vo/AddAppealInfoVO.java

@@ -83,4 +83,7 @@ public class AddAppealInfoVO {
 
     @ApiModelProperty(value = "备注")
     private String remark;
+
+    @ApiModelProperty(value = "单人申诉开关", hidden = true)
+    private Boolean singleAppealFalg;
 }

+ 2 - 0
report-service/src/main/java/com/lantone/report/vo/CancelAppealInfoVO.java

@@ -14,6 +14,8 @@ import javax.validation.constraints.NotNull;
 public class CancelAppealInfoVO {
     @ApiModelProperty(value = "申诉id", required = true)
     private Long id;
+    @ApiModelProperty(value = "申述人工号", hidden = true)
+    private String claimantId;
     @ApiModelProperty(value = "当前工作流节点id 1:申诉|2:撤回|3:审核", hidden = true)
     @NotNull(message = "当前工作流节点id不能为空")
     private Long workFlowNodeId;

+ 7 - 4
report-service/src/main/java/com/lantone/report/vo/GetAppealInfoVO.java

@@ -28,13 +28,16 @@ public class GetAppealInfoVO {
     @ApiModelProperty(value = "质控缺陷id")
     private Long qcresultDetailId;
 
-    @ApiModelProperty(value = "解释说明" ,hidden = true)
+    @ApiModelProperty(value = "解释说明", hidden = true)
     private String appealExplain;
 
-    @ApiModelProperty(value = "排除的工作节点" ,hidden = true)
+    @ApiModelProperty(value = "排除的工作节点", hidden = true)
     //排除撤回的申诉记录
     private String concelWorkFlowNode = "2";
 
-//    @ApiModelProperty(value = "类型 1:申诉查看|2:审核查看")
-//    private String type = "1";
+    @ApiModelProperty(value = "模块id", hidden = true)
+    private Long modeId;
+
+    //    @ApiModelProperty(value = "类型 1:申诉查看|2:审核查看")
+    //    private String type = "1";
 }

+ 7 - 1
report-service/src/main/java/com/lantone/report/vo/GetAuditNumberVO.java

@@ -10,6 +10,12 @@ import lombok.Data;
  */
 @Data
 public class GetAuditNumberVO {
-    @ApiModelProperty(value = "审核人",required = true)
+    @ApiModelProperty(value = "审核人", required = true)
     private Long id;
+
+    @ApiModelProperty(value = "医院id",hidden = true)
+    private Long hospitalId;
+
+    @ApiModelProperty(value = "质控类型 0-运行质控,1-终末质控")
+    private Long analyzeType;
 }

+ 31 - 0
report-service/src/main/java/com/lantone/report/vo/GetComplaintDetailMsgVO.java

@@ -0,0 +1,31 @@
+package com.lantone.report.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description:
+ * @author: zhanghang
+ * @time: 2022/3/1 14:38
+ */
+@Getter
+@Setter
+public class GetComplaintDetailMsgVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "医院id",hidden = true)
+    private Long hospitalId;
+
+    @ApiModelProperty(value = "缺陷Id")
+    private Long id;
+
+    @ApiModelProperty(value = "病人序列号")
+    private Long behospitalCode;
+
+    @ApiModelProperty(value = "条目ID")
+    private Long casesEntryId;
+
+}

+ 9 - 1
report-service/src/main/java/com/lantone/report/web/MedAppealExamineInfoManagementController.java

@@ -7,10 +7,12 @@ import com.lantone.common.api.CommonResult;
 import com.lantone.report.dto.GetAppealInfoDTO;
 import com.lantone.report.dto.GetAppealReviewDTO;
 import com.lantone.report.dto.GetComplaintRecordDTO;
+import com.lantone.report.entity.QcresultDetail;
 import com.lantone.report.facade.MedAppealExamineInfoManagementFacade;
 import com.lantone.report.vo.GetAppealInfoVO;
 import com.lantone.report.vo.GetAppealReviewVO;
 import com.lantone.report.vo.GetAuditNumberVO;
+import com.lantone.report.vo.GetComplaintDetailMsgVO;
 import com.lantone.report.vo.GetComplaintRecordVO;
 import com.lantone.report.vo.RejectedVo;
 import io.swagger.annotations.Api;
@@ -32,7 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("/medAppealExamineInInfoManage")
-@Api(value = "申诉审核数据模块相关接口API", tags = {"申诉审核数据模块相关接口API"})
+@Api(value = "申诉审核数据模块相关接口API", tags = { "申诉审核数据模块相关接口API" })
 public class MedAppealExamineInfoManagementController {
     @Autowired
     MedAppealExamineInfoManagementFacade medAppealExamineInfoManagementFacade;
@@ -76,4 +78,10 @@ public class MedAppealExamineInfoManagementController {
         return CommonResult.success(complaintRecord);
     }
 
+    @ApiOperation(value = "获取该申诉记录最新缺陷详情[by:zhanghang]",
+            notes = "获取该申诉记录最新缺陷详情")
+    @PostMapping("/getComplaintDetailMsg")
+    public CommonResult<QcresultDetail> getComplaintDetailMsg(@RequestBody GetComplaintDetailMsgVO getComplaintDetailMsgVO) {
+        return CommonResult.success(medAppealExamineInfoManagementFacade.getComplaintDetailMsg(getComplaintDetailMsgVO));
+    }
 }

+ 127 - 31
report-service/src/main/resources/mapper/AppealExamineInfoMapper.xml

@@ -12,7 +12,8 @@
         SELECT
         a.*, c.example_status,
         c.gmt_create AS check_gmt_create,
-        c.example_operation exampleOperation
+        c.example_operation exampleOperation,
+        c.remark
         FROM
         (
         SELECT
@@ -35,25 +36,62 @@
         a.is_reject,
         a.mode_id
         FROM
-        `med_appeal_info` a
-        LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
+        (SELECT
+        *
+        FROM
+        med_appeal_info
         WHERE
-        a.hospital_id = b.hospital_id
-        AND a.is_deleted = 'N'
-        AND a.hospital_id = #{getComplaintRecordVO.hospitalId}
-        AND a.claimant_id = #{getComplaintRecordVO.complaintId}
+        1=1
         <if test="getComplaintRecordVO.complaintDateStart != null ">
-            <![CDATA[ AND a.gmt_create >= #{getComplaintRecordVO.complaintDateStart}]]>
+            <![CDATA[ AND gmt_create >= #{getComplaintRecordVO.complaintDateStart}]]>
         </if>
         <if test="getComplaintRecordVO.complaintDateEnd != null ">
-            <![CDATA[ AND a.gmt_create <= #{getComplaintRecordVO.complaintDateEnd}]]>
+            <![CDATA[ AND gmt_create <= #{getComplaintRecordVO.complaintDateEnd}]]>
         </if>
         <if test="getComplaintRecordVO.modeName != null and getComplaintRecordVO.modeName != '' ">
-            <![CDATA[ AND a.mode_name = #{getComplaintRecordVO.modeName}]]>
+            <![CDATA[ AND mode_name = #{getComplaintRecordVO.modeName}]]>
         </if>
         <if test="getComplaintRecordVO.operationType != null and getComplaintRecordVO.operationType != '' ">
-            <![CDATA[ AND a.appeal_operation_type = #{getComplaintRecordVO.operationType}]]>
+            <![CDATA[ AND appeal_operation_type = #{getComplaintRecordVO.operationType}]]>
         </if>
+        AND
+        (gmt_create IN (
+        SELECT
+        max(gmt_create)
+        FROM
+        med_appeal_info
+        WHERE
+        cases_entry_id IS NOT NULL
+        AND hospital_id = #{getComplaintRecordVO.hospitalId}
+        AND claimant_id = #{getComplaintRecordVO.complaintId}
+        AND work_flow_node_id != 2
+        GROUP BY
+        hospital_id,
+        behospital_code,
+        cases_entry_id
+        )
+        OR
+        gmt_create IN (
+        SELECT
+        max(gmt_create)
+        FROM
+        med_appeal_info
+        WHERE
+        cases_entry_id IS NULL
+        AND hospital_id = #{getComplaintRecordVO.hospitalId}
+        AND appeal_operation_type = 2
+        AND claimant_id = #{getComplaintRecordVO.complaintId}
+        AND work_flow_node_id != 2
+        GROUP BY
+        hospital_id,
+        behospital_code,
+        mode_id,
+        appeal_explain
+        ))
+        ) a
+        LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
+        WHERE
+        a.hospital_id = b.hospital_id
         <if test="getComplaintRecordVO.isPlacefile != null and getComplaintRecordVO.isPlacefile != '' ">
             <![CDATA[ AND b.is_placefile = #{getComplaintRecordVO.isPlacefile}]]>
         </if>
@@ -66,7 +104,7 @@
         ) a
         LEFT JOIN med_appeal_examine_info c ON a.id = c.appeal_info_id
         WHERE
-        c.is_deleted = 'N'
+        1=1
         <if test="getComplaintRecordVO.state != null and getComplaintRecordVO.state != '' ">
             <![CDATA[ AND c.example_status = #{getComplaintRecordVO.state}]]>
         </if>
@@ -98,6 +136,7 @@
         a.qcresult_detail_id,
         a.cases_entry_id,
         a.qcresult_detail_msg,
+        a.mode_id,
         a.mode_name,
         a.defect_content,
         a.claimant_id,
@@ -107,35 +146,71 @@
         b.beh_dept_name,
         a.appeal_operation_type
         FROM
-        med_appeal_info a
-        LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
+        (
+        SELECT
+        *
+        FROM
+        `med_appeal_info`
         WHERE
-        a.is_deleted = 'N'
-        AND a.hospital_id = #{getAppealReviewVO.hospitalId}
-        AND a.hospital_id = b.hospital_id
-        AND a.check_id = #{getAppealReviewVO.appealId}
-        <if test="getAppealReviewVO.isPlacefile != null and getAppealReviewVO.isPlacefile != '' ">
-            <![CDATA[ AND b.is_placefile = #{getAppealReviewVO.isPlacefile}]]>
-        </if>
+        (
+        gmt_create IN (
+        SELECT
+        max(gmt_create)
+        FROM
+        med_appeal_info
+        WHERE
+        cases_entry_id IS NOT NULL
+        AND work_flow_node_id != 2
+        GROUP BY
+        hospital_id,
+        behospital_code,
+        cases_entry_id,
+        check_id
+        )
+        OR gmt_create IN (
+        SELECT
+        max(gmt_create)
+        FROM
+        med_appeal_info
+        WHERE
+        cases_entry_id IS NULL
+        AND work_flow_node_id != 2
+        GROUP BY
+        appeal_explain,
+        mode_id,
+        behospital_code,
+        check_id
+        )
+        )
+        AND hospital_id = #{getAppealReviewVO.hospitalId}
+        AND check_id = #{getAppealReviewVO.appealId}
         <if test="getAppealReviewVO.complaintDateStart != null ">
-            <![CDATA[ AND a.gmt_create >= #{getAppealReviewVO.complaintDateStart}]]>
+            <![CDATA[ AND gmt_create >= #{getAppealReviewVO.complaintDateStart}]]>
         </if>
         <if test="getAppealReviewVO.complaintDateEnd != null ">
-            <![CDATA[ AND a.gmt_create <= #{getAppealReviewVO.complaintDateEnd}]]>
-        </if>
-        <if test="getAppealReviewVO.deptName != null and getAppealReviewVO.deptName != '' ">
-            <![CDATA[ AND b.beh_dept_name = #{getAppealReviewVO.deptName}]]>
+            <![CDATA[ AND gmt_create <= #{getAppealReviewVO.complaintDateEnd}]]>
         </if>
         <if test="getAppealReviewVO.modeName != null and getAppealReviewVO.modeName != '' ">
-            <![CDATA[ AND a.mode_name = #{getAppealReviewVO.modeName}]]>
+            <![CDATA[ AND mode_name = #{getAppealReviewVO.modeName}]]>
         </if>
         <if test="getAppealReviewVO.operationType != null and getAppealReviewVO.operationType != '' ">
-            <![CDATA[ AND a.appeal_operation_type = #{getAppealReviewVO.operationType}]]>
+            <![CDATA[ AND appeal_operation_type = #{getAppealReviewVO.operationType}]]>
+        </if>
+        ) a
+        LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
+        WHERE
+        a.hospital_id = b.hospital_id
+        <if test="getAppealReviewVO.isPlacefile != null and getAppealReviewVO.isPlacefile != '' ">
+            <![CDATA[ AND b.is_placefile = #{getAppealReviewVO.isPlacefile}]]>
+        </if>
+
+        <if test="getAppealReviewVO.deptName != null and getAppealReviewVO.deptName != '' ">
+            <![CDATA[ AND b.beh_dept_name = #{getAppealReviewVO.deptName}]]>
         </if>
         ) a
         LEFT JOIN med_appeal_examine_info c ON a.id = c.appeal_info_id
         WHERE
-        c.is_deleted = 'N'
+        1=1
         <if test="getAppealReviewVO.state != null and getAppealReviewVO.state != '' ">
             <![CDATA[ AND c.example_status = #{getAppealReviewVO.state}]]>
         </if>
@@ -149,7 +224,28 @@
     </select>
 
 
-    <select id="approved" resultType="java.lang.Boolean">
-
+    <select id="getAuditNumber" resultType="java.lang.Integer">
+        SELECT
+            COUNT(*)
+        FROM
+            (
+                SELECT
+                    b.behospital_code,
+                    b.hospital_id
+                FROM
+                    med_appeal_examine_info a,
+                    med_appeal_info b
+                WHERE
+                    a.is_deleted = 'N'
+                AND a.example_status = 0
+                AND a.appeal_info_id = b.id
+                AND a.check_id = #{getAuditNumberVO.id}
+            ) a ,
+        med_behospital_info c
+        where a.behospital_code = c.behospital_code
+        and a.hospital_id  = c.hospital_id
+        and c.hospital_id=#{getAuditNumberVO.hospitalId}
+        and c.is_deleted='N'
+        and c.is_placefile=#{getAuditNumberVO.analyzeType}
     </select>
 </mapper>

+ 8 - 9
report-service/src/main/resources/mapper/AppealInfoMapper.xml

@@ -64,8 +64,8 @@
             mae.reject_reason rejectReason,
             mae.remark exampleRemark,
             mae.gmt_create appealExamineDate,
-            mqd.msg,
-            mqd.score,
+            mae.msg,
+            mae.`value` score,
             u.linkman claimantName,
             u2.linkman checkName
         FROM
@@ -73,10 +73,6 @@
         LEFT JOIN med_appeal_examine_info mae ON mai.id = mae.appeal_info_id
         LEFT JOIN qc_cases_entry qce ON mai.cases_entry_id = qce.id
         AND qce.is_deleted = "N"
-        LEFT JOIN med_qcresult_detail mqd ON mai.cases_entry_id = mqd.cases_entry_id
-        AND mai.behospital_code = mqd.behospital_code
-        AND mai.hospital_id = mqd.hospital_id
-        AND mqd.is_deleted = "N"
         LEFT JOIN sys_user u ON mai.claimant_id = u.id
         LEFT JOIN sys_user u2 ON mai.check_id = u2.id
         WHERE
@@ -91,8 +87,11 @@
         <if test="getAppealInfoVO.casesEntryId != null ">
             AND mai.cases_entry_id = #{getAppealInfoVO.casesEntryId}
         </if>
+        <if test="getAppealInfoVO.modeId != null ">
+            AND mai.mode_id = #{getAppealInfoVO.modeId}
+        </if>
         <if test="getAppealInfoVO.appealExplain != null and getAppealInfoVO.appealExplain != '' ">
-            AND mai.appeal_explain = #{getAppealInfoVO.appealExplain}
+            AND appeal_operation_type = 2   AND mai.appeal_explain = #{getAppealInfoVO.appealExplain}
         </if>
         ORDER BY
         mai.gmt_create
@@ -114,7 +113,7 @@
             med_appeal_info a
         LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
         WHERE
-            a.is_deleted = 'N'
+            a.work_flow_node_id != 2
             AND a.hospital_id = #{getAppealDeptVo.hospitalId}
             AND a.hospital_id = b.hospital_id
             <if test="getAppealDeptVo.claimantId != null ">
@@ -137,7 +136,7 @@
         med_appeal_info a
         LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
         WHERE
-        a.is_deleted = 'N'
+        a.work_flow_node_id != 2
         AND a.hospital_id = #{getAppealModeVo.hospitalId}
         AND a.hospital_id = b.hospital_id
         AND a.mode_id IS NOT NULL

+ 2 - 0
report-service/src/main/resources/mapper/base/BaseAppealExamineInfoMapper.xml

@@ -9,8 +9,10 @@
         <result column="check_id" property="checkId"/>
         <result column="example_status" property="exampleStatus"/>
         <result column="example_operation" property="exampleOperation"/>
+        <result column="value" property="value"/>
         <result column="process_result" property="processResult"/>
         <result column="reject_reason" property="rejectReason"/>
+        <result column="msg" property="msg"/>
         <result column="is_deleted" property="isDeleted"/>
         <result column="gmt_create" property="gmtCreate"/>
         <result column="gmt_modified" property="gmtModified"/>