|
@@ -68,6 +68,9 @@ public class BlockLossManagementFacade {
|
|
|
@Autowired
|
|
|
private OperationLogService operationLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HisDataManagementFacade hisDataManagementFacade;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取病历数据丢失明细分页列表
|
|
@@ -103,8 +106,10 @@ public class BlockLossManagementFacade {
|
|
|
Boolean flag = false;
|
|
|
//====1.获取已丢失状态记录,去数据库中对比判断是否补录
|
|
|
List<BlocklossResult> lossResults = blocklossResultFacade.list(new QueryWrapper<BlocklossResult>()
|
|
|
- .ge(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
- .le(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
+ .select("id,behospital_code,rec_id,loss_type,loss_way")
|
|
|
+// .ge(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
+// .le(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
+ .eq(SysUserUtils.getCurrentHospitalId() != null, "hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
.eq("status", LossStatusEnum.IS_LOSS.getKey())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()));
|
|
|
Map<String, List<BlocklossResult>> lossResultMap = null;
|
|
@@ -135,26 +140,29 @@ public class BlockLossManagementFacade {
|
|
|
//病历数据
|
|
|
List<String> dataBaseBehospitalCodes = behospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
|
|
|
.select("behospital_code")
|
|
|
- .ge(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
- .le(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .ge(dataCompareVO.getStartDate() != null && dataCompareVO.getBehospitalCode() == null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
+ .le(dataCompareVO.getEndDate() != null && dataCompareVO.getBehospitalCode() == null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
+ .eq(dataCompareVO.getBehospitalCode() != null, "behospital_code", dataCompareVO.getBehospitalCode())
|
|
|
+ .eq(SysUserUtils.getCurrentHospitalId() != null, "hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()))
|
|
|
.stream().map(BehospitalInfo::getBehospitalCode).collect(Collectors.toList());
|
|
|
//病案首页数据
|
|
|
List<String> dataBaseHomePageIds = homePageFacade.list(new QueryWrapper<HomePage>()
|
|
|
.select("home_page_id")
|
|
|
- .ge(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
- .le(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .ge(dataCompareVO.getStartDate() != null && dataCompareVO.getBehospitalCode() == null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
+ .le(dataCompareVO.getEndDate() != null && dataCompareVO.getBehospitalCode() == null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
+ .eq(dataCompareVO.getBehospitalCode() != null, "behospital_code", dataCompareVO.getBehospitalCode())
|
|
|
+ .eq(SysUserUtils.getCurrentHospitalId() != null, "hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()))
|
|
|
.stream().map(HomePage::getHomePageId).collect(Collectors.toList());
|
|
|
|
|
|
//文书数据
|
|
|
List<String> dataBaseRecIds = medicalRecordFacade.list(new QueryWrapper<MedicalRecord>()
|
|
|
.select("rec_id")
|
|
|
- .ge(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
- .le(dataCompareVO.getStartDate() != null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .ge(dataCompareVO.getStartDate() != null && dataCompareVO.getBehospitalCode() == null, "gmt_create", dataCompareVO.getStartDate())
|
|
|
+ .le(dataCompareVO.getEndDate() != null && dataCompareVO.getBehospitalCode() == null, "gmt_create", dataCompareVO.getEndDate())
|
|
|
+ .eq(dataCompareVO.getBehospitalCode() != null, "behospital_code", dataCompareVO.getBehospitalCode())
|
|
|
+ .eq(SysUserUtils.getCurrentHospitalId() != null, "hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()))
|
|
|
.stream().map(MedicalRecord::getRecId).collect(Collectors.toList());
|
|
|
|
|
@@ -167,35 +175,36 @@ public class BlockLossManagementFacade {
|
|
|
List<String> inLossCodes = null;
|
|
|
List<String> inLossHomepages = null;
|
|
|
List<String> inLossRecs = null;
|
|
|
- if (ListUtil.isNotEmpty(lossResultMap.get(LossTypeEnum.REC_LOSS.getKey()))) {
|
|
|
- Map<String, List<BlocklossResult>> lossWayRecMap = EntityUtil.makeEntityListMap(lossResultMap.get(LossTypeEnum.REC_LOSS.getKey()), "lossWay");
|
|
|
- if (ListUtil.isNotEmpty(lossWayRecMap.get(LossWayEnum.OUT_LOSS))) {
|
|
|
- outLossRecs = lossWayRecMap.get(LossWayEnum.OUT_LOSS).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(lossWayRecMap.get(LossWayEnum.IN_LOSS))) {
|
|
|
- inLossRecs = lossWayRecMap.get(LossWayEnum.IN_LOSS).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
- }
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(lossResultMap.get(LossTypeEnum.HOMEPAGE_LOSS.getKey()))) {
|
|
|
- Map<String, List<BlocklossResult>> lossWayHomePageMap = EntityUtil.makeEntityListMap(lossResultMap.get(LossTypeEnum.HOMEPAGE_LOSS.getKey()), "lossWay");
|
|
|
- if (ListUtil.isNotEmpty(lossWayHomePageMap.get(LossWayEnum.OUT_LOSS))) {
|
|
|
- outLossHomepages = lossWayHomePageMap.get(LossWayEnum.OUT_LOSS).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(lossWayHomePageMap.get(LossWayEnum.IN_LOSS))) {
|
|
|
- inLossHomepages = lossWayHomePageMap.get(LossWayEnum.IN_LOSS).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
+ if (lossResultMap != null) {
|
|
|
+ if (ListUtil.isNotEmpty(lossResultMap.get(LossTypeEnum.REC_LOSS.getKey()))) {
|
|
|
+ Map<String, List<BlocklossResult>> lossWayRecMap = EntityUtil.makeEntityListMap(lossResultMap.get(LossTypeEnum.REC_LOSS.getKey()), "lossWay");
|
|
|
+ if (ListUtil.isNotEmpty(lossWayRecMap.get(LossWayEnum.OUT_LOSS.getKey()))) {
|
|
|
+ outLossRecs = lossWayRecMap.get(LossWayEnum.OUT_LOSS.getKey()).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(lossWayRecMap.get(LossWayEnum.IN_LOSS.getKey()))) {
|
|
|
+ inLossRecs = lossWayRecMap.get(LossWayEnum.IN_LOSS.getKey()).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(lossResultMap.get(LossTypeEnum.CODE_LOSS.getKey()))) {
|
|
|
- Map<String, List<BlocklossResult>> lossWayCodeMap = EntityUtil.makeEntityListMap(lossResultMap.get(LossTypeEnum.CODE_LOSS.getKey()), "lossWay");
|
|
|
- if (ListUtil.isNotEmpty(lossWayCodeMap.get(LossWayEnum.OUT_LOSS))) {
|
|
|
- outLossCodes = lossWayCodeMap.get(LossWayEnum.OUT_LOSS).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(lossResultMap.get(LossTypeEnum.HOMEPAGE_LOSS.getKey()))) {
|
|
|
+ Map<String, List<BlocklossResult>> lossWayHomePageMap = EntityUtil.makeEntityListMap(lossResultMap.get(LossTypeEnum.HOMEPAGE_LOSS.getKey()), "lossWay");
|
|
|
+ if (ListUtil.isNotEmpty(lossWayHomePageMap.get(LossWayEnum.OUT_LOSS.getKey()))) {
|
|
|
+ outLossHomepages = lossWayHomePageMap.get(LossWayEnum.OUT_LOSS.getKey()).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(lossWayHomePageMap.get(LossWayEnum.IN_LOSS.getKey()))) {
|
|
|
+ inLossHomepages = lossWayHomePageMap.get(LossWayEnum.IN_LOSS.getKey()).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|
|
|
- if (ListUtil.isNotEmpty(lossWayCodeMap.get(LossWayEnum.IN_LOSS))) {
|
|
|
- inLossCodes = lossWayCodeMap.get(LossWayEnum.IN_LOSS).stream().map(BlocklossResult::getRecId).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(lossResultMap.get(LossTypeEnum.CODE_LOSS.getKey()))) {
|
|
|
+ Map<String, List<BlocklossResult>> lossWayCodeMap = EntityUtil.makeEntityListMap(lossResultMap.get(LossTypeEnum.CODE_LOSS.getKey()), "lossWay");
|
|
|
+ if (ListUtil.isNotEmpty(lossWayCodeMap.get(LossWayEnum.OUT_LOSS.getKey()))) {
|
|
|
+ outLossCodes = lossWayCodeMap.get(LossWayEnum.OUT_LOSS.getKey()).stream().map(BlocklossResult::getBehospitalCode).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(lossWayCodeMap.get(LossWayEnum.IN_LOSS.getKey()))) {
|
|
|
+ inLossCodes = lossWayCodeMap.get(LossWayEnum.IN_LOSS.getKey()).stream().map(BlocklossResult::getBehospitalCode).collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//=====2.2数据对比
|
|
|
//his与log日志做对比
|
|
|
if (ListUtil.isNotEmpty(hisMedicalRecords)) {
|
|
@@ -208,7 +217,7 @@ public class BlockLossManagementFacade {
|
|
|
hisMedicalRecordDTO.getHisRecs().stream().forEach(hisRecDTO -> {
|
|
|
GetOperationLogDTO medicalRecord = new GetOperationLogDTO();
|
|
|
medicalRecord.setRecId(hisRecDTO.getRecId());
|
|
|
- medicalRecord.setRecId(hisRecDTO.getRecTitle());
|
|
|
+ medicalRecord.setRecTitle(hisRecDTO.getRecTitle());
|
|
|
medicalRecord.setBehospitalCode(hisMedicalRecordDTO.getBehospitalCode());
|
|
|
recs.add(medicalRecord);
|
|
|
});
|
|
@@ -218,11 +227,11 @@ public class BlockLossManagementFacade {
|
|
|
//外部丢失数据集合
|
|
|
List<BlocklossResult> outInserts = new ArrayList<>();
|
|
|
//文书数据对比
|
|
|
- compareHisWithLog(recs, recLogs, "0", outInserts, outLossRecs);
|
|
|
+ compareHisWithLog(recs, recLogs, LossTypeEnum.REC_LOSS.getKey(), outInserts, outLossRecs);
|
|
|
//病案首页数据对比
|
|
|
- compareHisWithLog(medicalRecords, homePageLogs, "1", outInserts, outLossHomepages);
|
|
|
+ compareHisWithLog(medicalRecords, homePageLogs, LossTypeEnum.HOMEPAGE_LOSS.getKey(), outInserts, outLossHomepages);
|
|
|
//病历数据对比
|
|
|
- compareHisWithLog(medicalRecords, behospitalCodeLogs, "2", outInserts, outLossCodes);
|
|
|
+ compareHisWithLog(medicalRecords, behospitalCodeLogs, LossTypeEnum.CODE_LOSS.getKey(), outInserts, outLossCodes);
|
|
|
|
|
|
flag = blocklossResultServiceImpl.saveBatch(outInserts);
|
|
|
}
|
|
@@ -231,13 +240,13 @@ public class BlockLossManagementFacade {
|
|
|
//内部丢失数据集合
|
|
|
List<BlocklossResult> inInserts = new ArrayList<>();
|
|
|
if (ListUtil.isNotEmpty(recLogs)) {
|
|
|
- compareLogWithLocal(recLogs, dataBaseRecIds, "0", inInserts, inLossRecs);
|
|
|
+ compareLogWithLocal(recLogs, dataBaseRecIds, LossTypeEnum.REC_LOSS.getKey(), inInserts, inLossRecs);
|
|
|
}
|
|
|
if (ListUtil.isNotEmpty(homePageLogs)) {
|
|
|
- compareLogWithLocal(homePageLogs, dataBaseHomePageIds, "1", inInserts, inLossHomepages);
|
|
|
+ compareLogWithLocal(homePageLogs, dataBaseHomePageIds, LossTypeEnum.HOMEPAGE_LOSS.getKey(), inInserts, inLossHomepages);
|
|
|
}
|
|
|
if (ListUtil.isNotEmpty(behospitalCodeLogs)) {
|
|
|
- compareLogWithLocal(behospitalCodeLogs, dataBaseBehospitalCodes, "2", inInserts, inLossCodes);
|
|
|
+ compareLogWithLocal(behospitalCodeLogs, dataBaseBehospitalCodes, LossTypeEnum.CODE_LOSS.getKey(), inInserts, inLossCodes);
|
|
|
}
|
|
|
if (ListUtil.isNotEmpty(inInserts)) {
|
|
|
flag = blocklossResultServiceImpl.saveBatch(inInserts);
|
|
@@ -263,7 +272,7 @@ public class BlockLossManagementFacade {
|
|
|
logs.stream().forEach(rec -> {
|
|
|
//存在记录但是没有入库
|
|
|
if (!dataBases.contains(rec.getRecId())) {
|
|
|
- if (havingLossIds.contains(rec.getRecId())) {
|
|
|
+ if (havingLossIds == null || !havingLossIds.contains(rec.getRecId())) {
|
|
|
BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
blocklossResult.setBehospitalCode(rec.getBehospitalCode());
|
|
|
blocklossResult.setRecId(rec.getRecId());
|
|
@@ -277,31 +286,40 @@ public class BlockLossManagementFacade {
|
|
|
}
|
|
|
});
|
|
|
//判断只插入文书id的情况
|
|
|
- List<String> havingRecIds = medicalRecordContentFacade.list(new QueryWrapper<MedicalRecordContent>()
|
|
|
- .select("rec_id")
|
|
|
- .in("rec_id", dataBases)).stream().map(MedicalRecordContent::getRecId).collect(Collectors.toList());
|
|
|
- List<String> tempList = new ArrayList<>(dataBases);
|
|
|
- tempList.removeAll(havingRecIds);
|
|
|
- Map<String, GetOperationLogDTO> recMap = EntityUtil.makeEntityMap(logs, "recId");
|
|
|
- tempList.stream().forEach(recId -> {
|
|
|
- BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
- blocklossResult.setBehospitalCode(recMap.get(recId).getBehospitalCode());
|
|
|
- blocklossResult.setRecId(recId);
|
|
|
- blocklossResult.setRecTitle(recMap.get(recId).getRecTitle());
|
|
|
- blocklossResult.setLossWay(LossWayEnum.IN_LOSS.getKey());
|
|
|
- blocklossResult.setLossType(LossTypeEnum.REC_LOSS.getKey());
|
|
|
- blocklossResult.setLossCause("文书id插入成功,文书内容没有插入");
|
|
|
- //拼装病历数据块丢失明细其他信息
|
|
|
- assembleOtherBlocklossResult(blocklossResult);
|
|
|
- inInserts.add(blocklossResult);
|
|
|
- });
|
|
|
+ //获取插入的文书
|
|
|
+ if(ListUtil.isNotEmpty(dataBases)){
|
|
|
+ List<String> havingRecIds = medicalRecordContentFacade.list(new QueryWrapper<MedicalRecordContent>()
|
|
|
+ .select("rec_id")
|
|
|
+ .in("rec_id", dataBases)).stream().map(MedicalRecordContent::getRecId).collect(Collectors.toList());
|
|
|
+ List<String> tempList = new ArrayList<>(dataBases);
|
|
|
+ //移除查出来有内容的文书
|
|
|
+ tempList.removeAll(havingRecIds);
|
|
|
+ Map<String, GetOperationLogDTO> recMap = EntityUtil.makeEntityMap(logs, "recId");
|
|
|
+ //有文书id无内容文书
|
|
|
+ tempList.stream().forEach(recId -> {
|
|
|
+ //没有被记录过
|
|
|
+ if (havingLossIds == null || !havingLossIds.contains(recId)) {
|
|
|
+ BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
+ blocklossResult.setBehospitalCode(recMap.get(recId).getBehospitalCode());
|
|
|
+ blocklossResult.setRecId(recId);
|
|
|
+ blocklossResult.setRecTitle(recMap.get(recId).getRecTitle());
|
|
|
+ blocklossResult.setLossWay(LossWayEnum.IN_LOSS.getKey());
|
|
|
+ blocklossResult.setLossType(LossTypeEnum.REC_LOSS.getKey());
|
|
|
+ blocklossResult.setLossCause("文书id插入成功,文书内容没有插入");
|
|
|
+ //拼装病历数据块丢失明细其他信息
|
|
|
+ assembleOtherBlocklossResult(blocklossResult);
|
|
|
+ inInserts.add(blocklossResult);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case "1":
|
|
|
//病案首页丢失
|
|
|
logs.stream().forEach(homePages -> {
|
|
|
//存在记录但是没有入库
|
|
|
if (!dataBases.contains(homePages.getRecId())) {
|
|
|
- if (havingLossIds.contains(homePages.getRecId())) {
|
|
|
+ if (havingLossIds == null || !havingLossIds.contains(homePages.getHomePageId())) {
|
|
|
BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
blocklossResult.setBehospitalCode(homePages.getBehospitalCode());
|
|
|
blocklossResult.setRecId(homePages.getHomePageId());
|
|
@@ -320,7 +338,7 @@ public class BlockLossManagementFacade {
|
|
|
logs.stream().forEach(beHehospitalInfo -> {
|
|
|
//存在记录但是没有入库
|
|
|
if (!dataBases.contains(beHehospitalInfo.getBehospitalCode())) {
|
|
|
- if (havingLossIds.contains(beHehospitalInfo.getBehospitalCode())) {
|
|
|
+ if (havingLossIds == null || !havingLossIds.contains(beHehospitalInfo.getBehospitalCode())) {
|
|
|
BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
blocklossResult.setBehospitalCode(beHehospitalInfo.getBehospitalCode());
|
|
|
blocklossResult.setLossWay(LossWayEnum.IN_LOSS.getKey());
|
|
@@ -352,7 +370,7 @@ public class BlockLossManagementFacade {
|
|
|
case "0":
|
|
|
//文书丢失
|
|
|
List<String> redIds = medicalRecordFacade.list(new QueryWrapper<MedicalRecord>()
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.in("rec_id", lossResultMap.get(lossType).stream().map(BlocklossResult::getRecId).collect(Collectors.toList()))
|
|
|
.in("behospital_code", lossResultMap.get(lossType).stream().map(BlocklossResult::getBehospitalCode).collect(Collectors.toList()))
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()))
|
|
@@ -363,17 +381,18 @@ public class BlockLossManagementFacade {
|
|
|
.set("solve_time", DateUtil.now())
|
|
|
.set("gmt_modified", DateUtil.now())
|
|
|
.set("status", LossStatusEnum.NOT_LOSS.getKey())
|
|
|
- .set("modifier", SysUserUtils.getCurrentPrincipleId())
|
|
|
+ .set("modifier", SysUserUtils.getCurrentPrincipleId() != null ? SysUserUtils.getCurrentPrincipleId() + "" : "0")
|
|
|
+ .eq("status", LossStatusEnum.IS_LOSS.getKey())
|
|
|
.eq("loss_type", lossType)
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.in("rec_id", redIds)));
|
|
|
}
|
|
|
break;
|
|
|
case "1":
|
|
|
//病案首页丢失
|
|
|
List<String> homePages = homePageFacade.list(new QueryWrapper<HomePage>()
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.in("home_page_id", lossResultMap.get(lossType).stream().map(BlocklossResult::getRecId).collect(Collectors.toList()))
|
|
|
.in("behospital_code", lossResultMap.get(lossType).stream().map(BlocklossResult::getBehospitalCode).collect(Collectors.toList()))
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()))
|
|
@@ -385,9 +404,10 @@ public class BlockLossManagementFacade {
|
|
|
.set("solve_time", DateUtil.now())
|
|
|
.set("gmt_modified", DateUtil.now())
|
|
|
.set("status", LossStatusEnum.NOT_LOSS.getKey())
|
|
|
- .set("modifier", SysUserUtils.getCurrentPrincipleId())
|
|
|
+ .set("modifier", SysUserUtils.getCurrentPrincipleId() != null ? SysUserUtils.getCurrentPrincipleId() + "" : "0")
|
|
|
+ .eq("status", LossStatusEnum.IS_LOSS.getKey())
|
|
|
.eq("loss_type", lossType)
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.in("rec_id", homePages)
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())));
|
|
|
}
|
|
@@ -395,7 +415,7 @@ public class BlockLossManagementFacade {
|
|
|
case "2":
|
|
|
//患者信息丢失
|
|
|
List<String> behospitalCodes = behospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.in("behospital_code", lossResultMap.get(lossType).stream().map(BlocklossResult::getBehospitalCode).collect(Collectors.toList()))
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()))
|
|
|
.stream().map(BehospitalInfo::getBehospitalCode).collect(Collectors.toList());
|
|
@@ -405,10 +425,11 @@ public class BlockLossManagementFacade {
|
|
|
.set("solve_time", DateUtil.now())
|
|
|
.set("gmt_modified", DateUtil.now())
|
|
|
.set("status", LossStatusEnum.NOT_LOSS.getKey())
|
|
|
- .set("modifier", SysUserUtils.getCurrentPrincipleId())
|
|
|
+ .set("modifier", SysUserUtils.getCurrentPrincipleId() != null ? SysUserUtils.getCurrentPrincipleId() + "" : "0")
|
|
|
+ .eq("status", LossStatusEnum.IS_LOSS.getKey())
|
|
|
.eq("loss_type", lossType)
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.in("behospital_code", behospitalCodes)));
|
|
|
}
|
|
|
break;
|
|
@@ -429,6 +450,10 @@ public class BlockLossManagementFacade {
|
|
|
*/
|
|
|
private void compareHisWithLog(List<GetOperationLogDTO> medicalRecords, List<GetOperationLogDTO> logs,
|
|
|
String type, List<BlocklossResult> outInserts, List<String> havingLossIds) {
|
|
|
+ //his数据为空直接返回
|
|
|
+ if(ListUtil.isEmpty(medicalRecords)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
switch (type) {
|
|
|
case "0":
|
|
|
List<String> recLogs = logs.stream().map(GetOperationLogDTO::getRecId).collect(Collectors.toList());
|
|
@@ -437,7 +462,7 @@ public class BlockLossManagementFacade {
|
|
|
if (StringUtil.isNotEmpty(medicalRecord.getRecId())) {
|
|
|
if (!recLogs.contains(medicalRecord.getRecId())) {
|
|
|
//该记录没有插入
|
|
|
- if (ListUtil.isNotEmpty(havingLossIds) && !havingLossIds.contains(medicalRecord.getRecId())) {
|
|
|
+ if (havingLossIds == null || ListUtil.isNotEmpty(havingLossIds) && !havingLossIds.contains(medicalRecord.getRecId())) {
|
|
|
BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
blocklossResult.setBehospitalCode(medicalRecord.getBehospitalCode());
|
|
|
blocklossResult.setRecId(medicalRecord.getRecId());
|
|
@@ -457,7 +482,7 @@ public class BlockLossManagementFacade {
|
|
|
medicalRecords.stream().forEach(medicalRecord -> {
|
|
|
//病案首页不存在操作记录
|
|
|
if (StringUtil.isNotEmpty(medicalRecord.getHomePageId()) && !homepageLogs.contains(medicalRecord.getHomePageId())) {
|
|
|
- if (ListUtil.isNotEmpty(havingLossIds) && !havingLossIds.contains(medicalRecord.getHomePageId())) {
|
|
|
+ if (havingLossIds == null || ListUtil.isNotEmpty(havingLossIds) && !havingLossIds.contains(medicalRecord.getHomePageId())) {
|
|
|
BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
blocklossResult.setBehospitalCode(medicalRecord.getBehospitalCode());
|
|
|
blocklossResult.setRecId(medicalRecord.getHomePageId());
|
|
@@ -476,7 +501,7 @@ public class BlockLossManagementFacade {
|
|
|
medicalRecords.stream().forEach(medicalRecord -> {
|
|
|
//病历数据不存在操作记录
|
|
|
if (!behospitalCodeLogs.contains(medicalRecord.getBehospitalCode())) {
|
|
|
- if (ListUtil.isNotEmpty(havingLossIds) && !havingLossIds.contains(medicalRecord.getBehospitalCode())) {
|
|
|
+ if (havingLossIds == null || ListUtil.isNotEmpty(havingLossIds) && !havingLossIds.contains(medicalRecord.getBehospitalCode())) {
|
|
|
BlocklossResult blocklossResult = new BlocklossResult();
|
|
|
blocklossResult.setBehospitalCode(medicalRecord.getBehospitalCode());
|
|
|
blocklossResult.setLossWay(LossWayEnum.OUT_LOSS.getKey());
|
|
@@ -527,8 +552,7 @@ public class BlockLossManagementFacade {
|
|
|
private List<HisMedicalRecordDTO> getHisMedicalRecords(DataCompareVO dataCompareVO) {
|
|
|
//技术服务部接口 /balance/data/getDataCount
|
|
|
//###模拟
|
|
|
-
|
|
|
- return new ArrayList<>();
|
|
|
+ return hisDataManagementFacade.getHisMedicalRecords(dataCompareVO);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -548,27 +572,27 @@ public class BlockLossManagementFacade {
|
|
|
blockLossTypeGatherDTO.setLogNum(logNum);
|
|
|
//获取该时间段的实际数量
|
|
|
Integer codeNum = behospitalInfoFacade.count(new QueryWrapper<BehospitalInfo>()
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id",SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.ge(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getStartDate())
|
|
|
.le(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getEndDate()));
|
|
|
Integer homePageNum = homePageFacade.count(new QueryWrapper<HomePage>()
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.ge(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getStartDate())
|
|
|
.le(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getEndDate()));
|
|
|
Integer recNum = medicalRecordFacade.count(new QueryWrapper<MedicalRecord>()
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.ge(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getStartDate())
|
|
|
.le(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getEndDate()));
|
|
|
blockLossTypeGatherDTO.setRealNum(codeNum + homePageNum + recNum);
|
|
|
//获取该时间段的丢失数量
|
|
|
List<BlocklossResult> blocklossResults = blocklossResultFacade.list(new QueryWrapper<BlocklossResult>()
|
|
|
- .eq("hospital_id", SysUserUtils.getCurrentHospitalId())
|
|
|
+ .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
|
|
|
.eq("status", LossStatusEnum.IS_LOSS.getKey())
|
|
|
.ge(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getStartDate())
|
|
|
.le(blockLossTypeGatherVO.getStartDate() != null, "gmt_create", blockLossTypeGatherVO.getEndDate()));
|
|
|
Integer allLossNum = blocklossResults.size();
|
|
|
blockLossTypeGatherDTO.setAllLossNum(allLossNum);
|
|
|
- blockLossTypeGatherDTO.setHisNum(logNum + allLossNum);
|
|
|
+ blockLossTypeGatherDTO.setHisNum(codeNum + homePageNum + recNum + allLossNum);
|
|
|
|
|
|
Map<String, List<BlocklossResult>> lossWayMap = EntityUtil.makeEntityListMap(blocklossResults, "lossWay");
|
|
|
//外部丢失
|
|
@@ -623,6 +647,6 @@ public class BlockLossManagementFacade {
|
|
|
public boolean dataRepari(DataRepariVO dataRepariVO) {
|
|
|
//调用数据补录服务
|
|
|
|
|
|
- return false;
|
|
|
+ return hisDataManagementFacade.dataRepari(dataRepariVO);
|
|
|
}
|
|
|
}
|