|
@@ -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));
|