|
@@ -222,8 +222,8 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
rif.getSonHospitalName(),
|
|
|
i.getHospitalDeptCode(),
|
|
|
i.getHospitalDeptName(),
|
|
|
- i.getDoctorInfo().getCode(),
|
|
|
- i.getDoctorInfo().getName(),
|
|
|
+ i.getDoctorInfo() == null ? null : i.getDoctorInfo().getCode(),
|
|
|
+ i.getDoctorInfo() == null ? null : i.getDoctorInfo().getName(),
|
|
|
rif.getPatientInfo().getCode(),
|
|
|
rif.getPatientInfo().getName(),
|
|
|
i.getRecordTime(),
|
|
@@ -242,28 +242,30 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
* @param rifList
|
|
|
*/
|
|
|
private void generateByRif(List<RegisterInfoDTO> rifList) {
|
|
|
+ String hospitalCode = rifList.get(0).getHospitalCode();
|
|
|
+ String hospitalName = rifList.get(0).getHospitalName();
|
|
|
+ PatientInfo patientInfo = rifList.get(0).getPatientInfo();
|
|
|
+ QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
|
+ patientInfoQe.eq("hospital_code", hospitalCode);
|
|
|
+ patientInfoQe.eq("code", patientInfo.getCode());
|
|
|
+ PatientInfo patientInfoQuery = getOne(patientInfoQe, false);
|
|
|
+ PatientInfo saveOrUpat = new PatientInfo();
|
|
|
+ Long patId = null;
|
|
|
+ if (patientInfoQuery != null) {
|
|
|
+ patId = patientInfoQuery.getId();
|
|
|
+ BeanUtil.copyProperties(patientInfoQuery, saveOrUpat);
|
|
|
+ }
|
|
|
+ BeanUtil.copyProperties(patientInfo, saveOrUpat);
|
|
|
+ saveOrUpat.setId(patId);
|
|
|
+ saveOrUpat.setHospitalCode(hospitalCode);
|
|
|
+ saveOrUpdate(saveOrUpat);
|
|
|
+
|
|
|
+ List<String> doctorCodeList = Lists.newArrayList();
|
|
|
+ List<DoctorInfo> doctorInfoList = Lists.newArrayList();
|
|
|
rifList.forEach(rif -> {
|
|
|
- String hospitalCode = rif.getHospitalCode();
|
|
|
- String hospitalName = rif.getHospitalName();
|
|
|
String sonHospitalCode = rif.getSonHospitalCode();
|
|
|
String sonHospitalName = rif.getSonHospitalName();
|
|
|
|
|
|
- PatientInfo patientInfo = rif.getPatientInfo();
|
|
|
- QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
|
- patientInfoQe.eq("hospital_code", hospitalCode);
|
|
|
- patientInfoQe.eq("code", patientInfo.getCode());
|
|
|
- PatientInfo patientInfoQuery = getOne(patientInfoQe, false);
|
|
|
- PatientInfo saveOrUpat = new PatientInfo();
|
|
|
- Long patId = null;
|
|
|
- if (patientInfoQuery != null) {
|
|
|
- patId = patientInfoQuery.getId();
|
|
|
- }
|
|
|
- BeanUtil.copyProperties(patientInfoQuery, saveOrUpat);
|
|
|
- BeanUtil.copyProperties(patientInfo, saveOrUpat);
|
|
|
- patientInfo.setId(patId);
|
|
|
- patientInfo.setHospitalCode(hospitalCode);
|
|
|
- saveOrUpdate(saveOrUpat);
|
|
|
-
|
|
|
List<String> deptCodeList = rif.getDetail().stream()
|
|
|
.filter(i -> StringUtil.isNotBlank(i.getHospitalDeptCode()) && StringUtil.isNotBlank(i.getHospitalDeptName()))
|
|
|
.map(i -> i.getHospitalDeptCode())
|
|
@@ -296,40 +298,45 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
hospitalDeptService.saveOrUpdateBatch(deptSaveOrUpdateList);
|
|
|
}
|
|
|
|
|
|
- List<String> doctorCodeList = rif.getDetail().stream()
|
|
|
- .filter(i -> i.getDoctorInfo() != null).map(i -> i.getDoctorInfo())
|
|
|
- .filter(i -> StringUtil.isNotBlank(i.getCode()) && StringUtil.isNotBlank(i.getName()))
|
|
|
- .map(i -> i.getCode()).collect(Collectors.toList());
|
|
|
- QueryWrapper<DoctorInfo> doctorInfoQe = new QueryWrapper<>();
|
|
|
- doctorInfoQe.eq("hospital_code", hospitalCode);
|
|
|
- doctorInfoQe.in("code", doctorCodeList);
|
|
|
- Map<String, DoctorInfo> doctorMap = doctorInfoFacade.list(doctorInfoQe)
|
|
|
- .stream().collect(Collectors.toMap(DoctorInfo::getCode, i -> i));
|
|
|
- List<DoctorInfo> doctorSaveOrUpdateList = Lists.newArrayList();
|
|
|
rif.getDetail().stream()
|
|
|
.filter(i -> i.getDoctorInfo() != null).map(i -> i.getDoctorInfo())
|
|
|
.filter(i -> StringUtil.isNotBlank(i.getCode()) && StringUtil.isNotBlank(i.getName()))
|
|
|
.forEach(i -> {
|
|
|
- DoctorInfo doctorInfo = new DoctorInfo();
|
|
|
- DoctorInfo doctorInfoQuery = doctorMap.get(i.getCode());
|
|
|
- Long docId = null;
|
|
|
- if (doctorInfoQuery != null) {
|
|
|
- BeanUtil.copyProperties(doctorInfoQuery, doctorInfo);
|
|
|
- docId = doctorInfoQuery.getId();
|
|
|
- }
|
|
|
- BeanUtil.copyProperties(i, doctorInfo);
|
|
|
- doctorInfo.setHospitalCode(hospitalCode);
|
|
|
- doctorInfo.setId(docId);
|
|
|
- if (!doctorSaveOrUpdateList.stream()
|
|
|
- .map(doc -> doc.getCode()).distinct()
|
|
|
- .collect(Collectors.toList()).contains(doctorInfo.getCode())) {
|
|
|
- doctorSaveOrUpdateList.add(doctorInfo);
|
|
|
- }
|
|
|
+ doctorCodeList.add(i.getCode());
|
|
|
+ doctorInfoList.add(i);
|
|
|
});
|
|
|
- if (ListUtil.isNotEmpty(doctorSaveOrUpdateList)) {
|
|
|
- doctorInfoService.saveOrUpdateBatch(doctorSaveOrUpdateList);
|
|
|
+ });
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(doctorCodeList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<DoctorInfo> doctorInfoQe = new QueryWrapper<>();
|
|
|
+ doctorInfoQe.eq("hospital_code", hospitalCode);
|
|
|
+ doctorInfoQe.in("code", doctorCodeList);
|
|
|
+ Map<String, DoctorInfo> doctorMap = doctorInfoFacade.list(doctorInfoQe)
|
|
|
+ .stream().collect(Collectors.toMap(DoctorInfo::getCode, i -> i));
|
|
|
+ List<DoctorInfo> doctorSaveOrUpdateList = Lists.newArrayList();
|
|
|
+ doctorInfoList.forEach(i -> {
|
|
|
+ DoctorInfo doctorInfoQuery = doctorMap.get(i.getCode());
|
|
|
+ DoctorInfo doctorInfo = new DoctorInfo();
|
|
|
+ Long docId = null;
|
|
|
+ if (doctorInfoQuery != null) {
|
|
|
+ docId = doctorInfoQuery.getId();
|
|
|
+ BeanUtil.copyProperties(doctorInfoQuery, doctorInfo);
|
|
|
+ }
|
|
|
+ BeanUtil.copyProperties(i, doctorInfo);
|
|
|
+ doctorInfo.setHospitalCode(hospitalCode);
|
|
|
+ doctorInfo.setId(docId);
|
|
|
+ if (!doctorSaveOrUpdateList.stream()
|
|
|
+ .map(doc -> doc.getCode()).distinct()
|
|
|
+ .collect(Collectors.toList()).contains(doctorInfo.getCode())) {
|
|
|
+ doctorSaveOrUpdateList.add(doctorInfo);
|
|
|
}
|
|
|
});
|
|
|
+ if (ListUtil.isNotEmpty(doctorSaveOrUpdateList)) {
|
|
|
+ doctorInfoService.saveOrUpdateBatch(doctorSaveOrUpdateList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -342,7 +349,7 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
private List<RegisterInfoDTO> getRegisterInfo(SignInVO signInVO) {
|
|
|
- if (!signInVO.getHospitalCode().equals("33010400")){
|
|
|
+ if (!signInVO.getHospitalCode().equals("33010400")) {
|
|
|
return null;
|
|
|
}
|
|
|
String retJson = " [{"
|
|
@@ -362,23 +369,23 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
+ "\"detail\": [{"
|
|
|
+ " \"hospitalDeptCode\": \"2127\","
|
|
|
+ " \"hospitalDeptName\": \"中医科\","
|
|
|
- + " \"doctorInfo\": {"
|
|
|
- + " \"code\": \"000\","
|
|
|
- + " \"hospitalCode\": \"33010400\","
|
|
|
- + " \"name\": \"普通\""
|
|
|
- + "},"
|
|
|
- + " \"recordId\": \"9043516\","
|
|
|
+ // + " \"doctorInfo\": {"
|
|
|
+ // + " \"code\": \"000\","
|
|
|
+ // + " \"hospitalCode\": \"33010400\","
|
|
|
+ // + " \"name\": \"普通\""
|
|
|
+ // + "},"
|
|
|
+ // + " \"recordId\": \"9043516\","
|
|
|
+ " \"recordTime\": \"2019-12-05 12:29:55\","
|
|
|
+ " \"registerNum\": \"1\""
|
|
|
+ "},{"
|
|
|
+ "\"hospitalDeptCode\": \"2533\","
|
|
|
+ " \"hospitalDeptName\": \"机神全科\","
|
|
|
- + " \"doctorInfo\": {"
|
|
|
- + "\"code\": \"000\","
|
|
|
- + " \"hospitalCode\": \"33010400\","
|
|
|
- + "\"name\": \"普通\""
|
|
|
- + "},"
|
|
|
- + " \"recordId\": \"9043512\","
|
|
|
+ // + " \"doctorInfo\": {"
|
|
|
+ // + "\"code\": \"000\","
|
|
|
+ // + " \"hospitalCode\": \"33010400\","
|
|
|
+ // + "\"name\": \"普通\""
|
|
|
+ // + "},"
|
|
|
+ // + " \"recordId\": \"9043512\","
|
|
|
+ " \"recordTime\": \"2019-12-05 12:23:09\","
|
|
|
+ " \"registerNum\": \"1\""
|
|
|
+ "}]"
|
|
@@ -400,23 +407,23 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
+ " \"detail\": [{"
|
|
|
+ " \"hospitalDeptCode\": \"2127\","
|
|
|
+ "\"hospitalDeptName\": \"中医科\","
|
|
|
- + " \"doctorInfo\": {"
|
|
|
- + " \"code\": \"000\","
|
|
|
- + " \"hospitalCode\": \"33010400\","
|
|
|
- + " \"name\": \"普通\""
|
|
|
- + "},"
|
|
|
- + " \"recordId\": \"9043516\","
|
|
|
+ // + " \"doctorInfo\": {"
|
|
|
+ // + " \"code\": \"000\","
|
|
|
+ // + " \"hospitalCode\": \"33010400\","
|
|
|
+ // + " \"name\": \"普通\""
|
|
|
+ // + "},"
|
|
|
+ // + " \"recordId\": \"9043516\","
|
|
|
+ " \"recordTime\": \"2019-12-05 12:29:55\","
|
|
|
+ " \"registerNum\": \"1\""
|
|
|
+ "},{"
|
|
|
+ " \"hospitalDeptCode\": \"2533\","
|
|
|
+ " \"hospitalDeptName\": \"机神全科\","
|
|
|
- + " \"doctorInfo\": {"
|
|
|
- + " \"code\": \"000\","
|
|
|
- + " \"hospitalCode\": \"33010400\","
|
|
|
- + " \"name\": \"普通\""
|
|
|
- + "},"
|
|
|
- + "\"recordId\": \"9043512\","
|
|
|
+ // + " \"doctorInfo\": {"
|
|
|
+ // + " \"code\": \"000\","
|
|
|
+ // + " \"hospitalCode\": \"33010400\","
|
|
|
+ // + " \"name\": \"普通\""
|
|
|
+ // + "},"
|
|
|
+ // + "\"recordId\": \"9043512\","
|
|
|
+ " \"recordTime\": \"2019-12-05 12:23:09\","
|
|
|
+ " \"registerNum\": \"1\""
|
|
|
+ "}]"
|