|
@@ -0,0 +1,222 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.diagbot.dto.AnalyzeDTO;
|
|
|
+
|
|
|
+import com.diagbot.entity.MedAppealExamineInfo;
|
|
|
+import com.diagbot.entity.MedAppealInfo;
|
|
|
+
|
|
|
+import com.diagbot.entity.QcresultDetail;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.service.impl.MedAppealExamineInfoServiceImpl;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.ApprovedVo;
|
|
|
+import com.diagbot.vo.QcResultAlgVO;
|
|
|
+import com.diagbot.vo.QcresultVO;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:申述记录
|
|
|
+ * @Author: songxl
|
|
|
+ * @Date 2022/1/5
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class MedAppealExamineInfoManagementFacade extends MedAppealExamineInfoServiceImpl {
|
|
|
+ @Autowired
|
|
|
+ private QcresultDetailFacade qcresultDetailFacade;
|
|
|
+ @Autowired
|
|
|
+ private MedAppealInfoManagementFacade medAppealInfoManagementFacade;
|
|
|
+ @Autowired
|
|
|
+ private QcresultInfoFacade qcresultInfoFacade;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核通过
|
|
|
+ * @param approvedVo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean approved (ApprovedVo approvedVo) {
|
|
|
+ QcresultVO qcresultVO = new QcresultVO();
|
|
|
+ qcresultVO.setBehospitalCode(approvedVo.getBehospitalCode());
|
|
|
+ qcresultVO.setHospitalId(approvedVo.getHospitalId());
|
|
|
+ QcResultAlgVO optResultAlgVO = approvedVo.getOptResultAlgVO();
|
|
|
+ optResultAlgVO.setCasesId(approvedVo.getCasesId());
|
|
|
+ optResultAlgVO.setScore(approvedVo.getValue());
|
|
|
+ optResultAlgVO.setMsg(approvedVo.getCasesEntryMsg());
|
|
|
+ optResultAlgVO.setExplainInfo(approvedVo.getRemark());
|
|
|
+ //获取处理方式
|
|
|
+ String handling = approvedVo.getExampleOperation();
|
|
|
+ if(StringUtil.isNotEmpty(handling) && handling.equals("删除")){
|
|
|
+ //调用删除接口
|
|
|
+ optResultAlgVO.setCasesEntryId(approvedVo.getQcresultDetailId());
|
|
|
+ qcresultVO.setOptResultAlgVO(optResultAlgVO);
|
|
|
+ qcresultVO.setDelStatus(1);
|
|
|
+ qcresultVO.setType(4);
|
|
|
+ AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
|
|
|
+ if(analyzeDTORespDTO.getIsSuccess()){
|
|
|
+ Boolean appealInfo = updateAppealInfo(approvedVo);
|
|
|
+ MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
|
|
|
+ medAppealExamineInfo.setExampleOperation("2");
|
|
|
+ medAppealExamineInfo.setExampleStatus("2");
|
|
|
+ medAppealExamineInfo.setRemark(approvedVo.getRemark());
|
|
|
+ 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, "删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(handling) && handling.equals("修改")){
|
|
|
+ //调用修改接口
|
|
|
+ optResultAlgVO.setCasesEntryId(approvedVo.getQcresultDetailId());
|
|
|
+ qcresultVO.setOptResultAlgVO(optResultAlgVO);
|
|
|
+ qcresultVO.setType(3);
|
|
|
+ AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
|
|
|
+ if(analyzeDTORespDTO.getIsSuccess()){
|
|
|
+ Boolean appealInfo = updateAppealInfo(approvedVo);
|
|
|
+ MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
|
|
|
+ medAppealExamineInfo.setExampleOperation("1");
|
|
|
+ medAppealExamineInfo.setExampleStatus("2");
|
|
|
+ medAppealExamineInfo.setRemark(approvedVo.getRemark());
|
|
|
+ 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, "修改失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(handling) && handling.equals("新增已有")){
|
|
|
+ optResultAlgVO.setCasesEntryId(approvedVo.getCasesEntryId());
|
|
|
+ qcresultVO.setOptResultAlgVO(optResultAlgVO);
|
|
|
+ //判断是否已存在该条目
|
|
|
+ QcresultDetail qcresultDetail = qcresultDetailFacade.getOne(new QueryWrapper<QcresultDetail>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", approvedVo.getHospitalId())
|
|
|
+ .eq("behospital_code", approvedVo.getBehospitalCode())
|
|
|
+ .eq("cases_entry_id", approvedVo.getCasesEntryId())
|
|
|
+ );
|
|
|
+ if(qcresultDetail!=null){
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "该条目已存在!");
|
|
|
+ }
|
|
|
+ //调用新增接口
|
|
|
+ qcresultVO.setType(1);
|
|
|
+
|
|
|
+ AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
|
|
|
+ if(analyzeDTORespDTO.getIsSuccess()){
|
|
|
+ MedAppealInfo medAppealInfo = new MedAppealInfo();
|
|
|
+ medAppealInfo.setCasesEntryId(approvedVo.getCasesEntryId());
|
|
|
+ medAppealInfo.setCasesEntryMsg(approvedVo.getCasesEntryMsg());
|
|
|
+ medAppealInfo.setCasesEntryName(approvedVo.getCasesEntryName());
|
|
|
+ medAppealInfo.setValue(approvedVo.getValue());
|
|
|
+ medAppealInfo.setWorkFlowNodeId(3L);
|
|
|
+ boolean update = medAppealInfoManagementFacade.update(medAppealInfo, new UpdateWrapper<MedAppealInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", approvedVo.getHospitalId())
|
|
|
+ .eq("behospital_code", approvedVo.getBehospitalCode())
|
|
|
+ .eq("check_id", approvedVo.getAppealId())
|
|
|
+ );
|
|
|
+ MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
|
|
|
+ medAppealExamineInfo.setExampleOperation("3");
|
|
|
+ medAppealExamineInfo.setExampleStatus("2");
|
|
|
+ medAppealExamineInfo.setRemark(approvedVo.getRemark());
|
|
|
+ boolean update1 = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("appeal_info_id", approvedVo.getId())
|
|
|
+ .eq("check_id", approvedVo.getAppealId())
|
|
|
+ );
|
|
|
+ if(update && update1){
|
|
|
+ return true;
|
|
|
+ }else {
|
|
|
+ throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "新增失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(handling) && handling.equals("恢复")){
|
|
|
+ optResultAlgVO.setCasesEntryId(approvedVo.getQcresultDetailId());
|
|
|
+ qcresultVO.setOptResultAlgVO(optResultAlgVO);
|
|
|
+ qcresultVO.setType(4);
|
|
|
+ qcresultVO.setDelStatus(0);
|
|
|
+ //调用删除接口
|
|
|
+ AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
|
|
|
+ if(analyzeDTORespDTO.getIsSuccess()){
|
|
|
+ Boolean appealInfo = updateAppealInfo(approvedVo);
|
|
|
+ MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
|
|
|
+ medAppealExamineInfo.setExampleOperation("5");
|
|
|
+ medAppealExamineInfo.setExampleStatus("2");
|
|
|
+ medAppealExamineInfo.setRemark(approvedVo.getRemark());
|
|
|
+ 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, "恢复失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(handling) && handling.equals("新增缺失")){
|
|
|
+ optResultAlgVO.setCasesEntryId(approvedVo.getQcresultDetailId());
|
|
|
+ qcresultVO.setOptResultAlgVO(optResultAlgVO);
|
|
|
+ qcresultVO.setDelStatus(0);
|
|
|
+ Boolean appealInfo = updateAppealInfo(approvedVo);
|
|
|
+ MedAppealExamineInfo medAppealExamineInfo= new MedAppealExamineInfo();
|
|
|
+ medAppealExamineInfo.setExampleOperation("4");
|
|
|
+ medAppealExamineInfo.setExampleStatus("2");
|
|
|
+ medAppealExamineInfo.setProcessResult(approvedVo.getProcessResult());
|
|
|
+ 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, "审核通过失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "无此类型处理方式!");
|
|
|
+ }
|
|
|
+
|
|
|
+ public Boolean updateAppealInfo (ApprovedVo approvedVo) {
|
|
|
+ MedAppealInfo medAppealInfo = new MedAppealInfo();
|
|
|
+ medAppealInfo.setWorkFlowNodeId(3L);
|
|
|
+ boolean update = medAppealInfoManagementFacade.update(medAppealInfo, new UpdateWrapper<MedAppealInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", approvedVo.getHospitalId())
|
|
|
+ .eq("behospital_code", approvedVo.getBehospitalCode())
|
|
|
+ .eq("id", approvedVo.getAppealId())
|
|
|
+ );
|
|
|
+ if(update){
|
|
|
+ return true;
|
|
|
+ }else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|