|
@@ -17,6 +17,7 @@ import com.diagbot.exception.ServiceErrorCode;
|
|
|
import com.diagbot.idc.VisibleIdCreater;
|
|
|
import com.diagbot.service.DoctorInfoService;
|
|
|
import com.diagbot.service.HospitalDeptService;
|
|
|
+import com.diagbot.service.PatientInfoService;
|
|
|
import com.diagbot.service.impl.PatientInfoServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
@@ -59,6 +60,9 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
private SysSetFacade sysSetFacade;
|
|
|
@Autowired
|
|
|
private VisibleIdCreater visibleIdCreater;
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("patientInfoServiceImpl")
|
|
|
+ private PatientInfoService patientInfoService;
|
|
|
|
|
|
/**
|
|
|
* 对接-页面顶部病人医生科室信息——查询
|
|
@@ -67,37 +71,33 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public GetTopPatientInfoDjDTO getTopPatientInfoDj(GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
|
|
|
+ String hospitalCode = getTopPatientInfoDjVO.getHospitalCode();
|
|
|
+ String sonHospitalCode =
|
|
|
+ StringUtil.isNotBlank(getTopPatientInfoDjVO.getSonHospitalCode())
|
|
|
+ ? getTopPatientInfoDjVO.getSonHospitalCode()
|
|
|
+ : hospitalCode;
|
|
|
+ getTopPatientInfoDjVO.setSonHospitalCode(sonHospitalCode);
|
|
|
+
|
|
|
GetTopPatientInfoDjDTO getTopPatientInfoDjDTO = this.baseMapper.getTopPatientInfoDj(getTopPatientInfoDjVO);
|
|
|
getTopPatientInfoDjDTO.setSystemTime(DateUtil.now());
|
|
|
getTopPatientInfoDjDTO.setRecordId(getTopPatientInfoDjVO.getRecordId());
|
|
|
getTopPatientInfoDjDTO.setPatientAge(DateUtil.yearCompare(getTopPatientInfoDjDTO.getBirthday(), DateUtil.now()));
|
|
|
|
|
|
- List<String> hospitalCodeList = Lists.newArrayList();
|
|
|
- hospitalCodeList.add(getTopPatientInfoDjVO.getHospitalCode());
|
|
|
- if (StringUtil.isNotBlank(getTopPatientInfoDjVO.getSonHospitalCode())) {
|
|
|
- hospitalCodeList.add(getTopPatientInfoDjVO.getSonHospitalCode());
|
|
|
- }
|
|
|
- QueryWrapper<HospitalInfo> hospitalInfoQe = new QueryWrapper<>();
|
|
|
- hospitalInfoQe.in("code", hospitalCodeList);
|
|
|
- Map<String, HospitalInfo> hospitalInfoMap = hospitalInfoFacade.list(hospitalInfoQe)
|
|
|
- .stream().collect(Collectors.toMap(HospitalInfo::getCode, i -> i));
|
|
|
-
|
|
|
- HospitalInfo hospitalInfo = hospitalInfoMap.get(getTopPatientInfoDjVO.getHospitalCode());
|
|
|
- HospitalInfo sonHospitalInfo = hospitalInfoMap.get(getTopPatientInfoDjVO.getSonHospitalCode());
|
|
|
- getTopPatientInfoDjDTO.setHospitalId(hospitalInfo.getId());
|
|
|
- getTopPatientInfoDjDTO.setHospitalCode(hospitalInfo.getCode());
|
|
|
- getTopPatientInfoDjDTO.setHospitalName(hospitalInfo.getName());
|
|
|
- if (sonHospitalInfo != null) {
|
|
|
- getTopPatientInfoDjDTO.setSonHospitalId(sonHospitalInfo.getId());
|
|
|
- getTopPatientInfoDjDTO.setSonHospitalCode(sonHospitalInfo.getCode());
|
|
|
- getTopPatientInfoDjDTO.setSonHospitalName(sonHospitalInfo.getName());
|
|
|
+ if (!hospitalCode.equals(sonHospitalCode)) {
|
|
|
+ QueryWrapper<HospitalInfo> hospitalInfoQe = new QueryWrapper<>();
|
|
|
+ hospitalInfoQe.eq("code", hospitalCode);
|
|
|
+ HospitalInfo hospitalInfo = hospitalInfoFacade.getOne(hospitalInfoQe, false);
|
|
|
+ getTopPatientInfoDjDTO.setHospitalId(hospitalInfo.getId());
|
|
|
+ getTopPatientInfoDjDTO.setHospitalCode(hospitalInfo.getCode());
|
|
|
+ getTopPatientInfoDjDTO.setHospitalName(hospitalInfo.getName());
|
|
|
+ } else {
|
|
|
+ getTopPatientInfoDjDTO.setSonHospitalId(null);
|
|
|
+ getTopPatientInfoDjDTO.setSonHospitalCode(null);
|
|
|
+ getTopPatientInfoDjDTO.setSonHospitalName(null);
|
|
|
}
|
|
|
|
|
|
QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
|
- hospitalDeptQe.eq("hospital_code",
|
|
|
- StringUtil.isBlank(getTopPatientInfoDjVO.getSonHospitalCode())
|
|
|
- ? getTopPatientInfoDjVO.getHospitalCode()
|
|
|
- : getTopPatientInfoDjVO.getSonHospitalCode());
|
|
|
+ hospitalDeptQe.eq("hospital_code", sonHospitalCode);
|
|
|
hospitalDeptQe.eq("code", getTopPatientInfoDjVO.getHospitalDeptCode());
|
|
|
HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQe, false);
|
|
|
if (hospitalDept != null) {
|
|
@@ -141,16 +141,17 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
private List<SignInDTO> autoGenePatinfo(SignInVO signInVO) {
|
|
|
+ String hospitalCode = signInVO.getHospitalCode();
|
|
|
+ String sonHospitalCode =
|
|
|
+ StringUtil.isNotBlank(signInVO.getSonHospitalCode()) ? signInVO.getSonHospitalCode() : hospitalCode;
|
|
|
QueryWrapper<SysSet> sysSetQe = new QueryWrapper<>();
|
|
|
sysSetQe.eq("sys_type", SysTypeEnum.PREC_SERVICE.getKey());
|
|
|
sysSetQe.and(qe1 -> qe1
|
|
|
.and(qe2 -> qe2
|
|
|
- .eq("hospital_code", signInVO.getHospitalCode())
|
|
|
+ .eq("hospital_code", hospitalCode)
|
|
|
.eq("code", "patientinfo"))
|
|
|
.or(qe3 -> qe3
|
|
|
- .eq("hospital_code",
|
|
|
- StringUtil.isBlank(signInVO.getSonHospitalCode()) ? signInVO.getHospitalCode()
|
|
|
- : signInVO.getSonHospitalCode())
|
|
|
+ .eq("hospital_code", sonHospitalCode)
|
|
|
.eq("code", "default_dept")));
|
|
|
Map<String, String> sysSetCodeValue = sysSetFacade.list(sysSetQe).stream()
|
|
|
.collect(Collectors.toMap(SysSet::getCode, i -> i.getValue()));
|
|
@@ -174,21 +175,22 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
signInDTO.setHospitalDeptCode(hospitalDeptCode);
|
|
|
|
|
|
QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
|
- hospitalDeptQe.eq("hospital_code",
|
|
|
- StringUtil.isBlank(signInVO.getSonHospitalCode()) ? signInVO.getHospitalCode() : signInVO.getSonHospitalCode());
|
|
|
+ hospitalDeptQe.eq("hospital_code", sonHospitalCode);
|
|
|
hospitalDeptQe.eq("code", hospitalDeptCode);
|
|
|
signInDTO.setHospitalDeptName(hospitalDeptFacade.getOne(hospitalDeptQe, false).getName());
|
|
|
|
|
|
QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
|
- patientInfoQe.eq("hospital_code", signInVO.getHospitalCode());
|
|
|
+ patientInfoQe.eq("hospital_code", sonHospitalCode);
|
|
|
patientInfoQe.eq("name", signInVO.getPatientName());
|
|
|
patientInfoQe.and(a ->
|
|
|
a.eq("id_no", signInVO.getPatientInfo()).or().eq("identity_num", signInVO.getPatientInfo()));
|
|
|
- PatientInfo patientInfo = getOne(patientInfoQe, false);
|
|
|
- if (patientInfo == null) {
|
|
|
+ patientInfoQe.orderByAsc("remark");
|
|
|
+ List<PatientInfo> patientInfoList = list(patientInfoQe);
|
|
|
+ PatientInfo patientInfo = null;
|
|
|
+ if (ListUtil.isEmpty(patientInfoList)) {
|
|
|
patientInfo = new PatientInfo();
|
|
|
patientInfo.setGmtCreate(DateUtil.now());
|
|
|
- patientInfo.setHospitalCode(signInVO.getHospitalCode());
|
|
|
+ patientInfo.setHospitalCode(sonHospitalCode);
|
|
|
patientInfo.setIdNo(signInVO.getPatientInfo());
|
|
|
patientInfo.setIdentityNum(signInVO.getPatientInfo());
|
|
|
patientInfo.setName(signInVO.getPatientName());
|
|
@@ -199,7 +201,10 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
patientInfo.setRemark("1");//自动生成标志
|
|
|
|
|
|
save(patientInfo);
|
|
|
+ } else {
|
|
|
+ patientInfo = patientInfoList.get(0);
|
|
|
}
|
|
|
+
|
|
|
signInDTO.setPatientCode(patientInfo.getCode());
|
|
|
signInDTO.setPatientName(patientInfo.getName());
|
|
|
|
|
@@ -246,96 +251,124 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
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();
|
|
|
+ List<PatientInfo> patientSaveOrUpdateList = Lists.newArrayList();
|
|
|
+ List<HospitalDept> deptSaveOrUpdateList = Lists.newArrayList();
|
|
|
+ List<DoctorInfo> doctorSaveOrUpdateList = Lists.newArrayList();
|
|
|
rifList.forEach(rif -> {
|
|
|
- String sonHospitalCode = rif.getSonHospitalCode();
|
|
|
- String sonHospitalName = rif.getSonHospitalName();
|
|
|
+ String sonHospitalCode = StringUtil.isNotBlank(rif.getSonHospitalCode()) ? rif.getSonHospitalCode() : hospitalCode;
|
|
|
+ String sonHospitalName = StringUtil.isNotBlank(rif.getSonHospitalCode()) ? rif.getSonHospitalName() : hospitalName;
|
|
|
+
|
|
|
+ /********** 患者部分 **********/
|
|
|
+ PatientInfo patientInfo = rif.getPatientInfo();
|
|
|
+ if (!patientSaveOrUpdateList.stream()
|
|
|
+ .filter(patientSaveOrUpdate -> patientSaveOrUpdate.getHospitalCode().equals(sonHospitalCode))
|
|
|
+ .map(patientSaveOrUpdate -> patientSaveOrUpdate.getCode())
|
|
|
+ .collect(Collectors.toList())
|
|
|
+ .contains(patientInfo.getCode())) {
|
|
|
+ QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
|
+ patientInfoQe.eq("hospital_code", sonHospitalCode);
|
|
|
+ patientInfoQe.eq("name", patientInfo.getName());
|
|
|
+ patientInfoQe.eq(StringUtil.isBlank(patientInfo.getIdentityNum())
|
|
|
+ && StringUtil.isNotBlank(patientInfo.getIdNo()),
|
|
|
+ "id_no", patientInfo.getIdNo());
|
|
|
+ patientInfoQe.eq(StringUtil.isNotBlank(patientInfo.getIdentityNum()),
|
|
|
+ "identity_num", patientInfo.getIdentityNum());
|
|
|
+ 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(sonHospitalCode);
|
|
|
+ patientSaveOrUpdateList.add(saveOrUpat);
|
|
|
+ }
|
|
|
|
|
|
+ /********** 科室部分 **********/
|
|
|
List<String> deptCodeList = rif.getDetail().stream()
|
|
|
- .filter(i -> StringUtil.isNotBlank(i.getHospitalDeptCode()) && StringUtil.isNotBlank(i.getHospitalDeptName()))
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getHospitalDeptCode())
|
|
|
+ && StringUtil.isNotBlank(i.getHospitalDeptName()))
|
|
|
.map(i -> i.getHospitalDeptCode())
|
|
|
.collect(Collectors.toList());
|
|
|
- QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
|
- hospitalDeptQe.eq("hospital_code", StringUtil.isBlank(sonHospitalCode) ? hospitalCode : sonHospitalCode);
|
|
|
- hospitalDeptQe.in("code", deptCodeList);
|
|
|
- Map<String, HospitalDept> deptMap = hospitalDeptFacade.list(hospitalDeptQe)
|
|
|
- .stream()
|
|
|
- .collect(Collectors.toMap(HospitalDept::getCode, i -> i));
|
|
|
- List<HospitalDept> deptSaveOrUpdateList = Lists.newArrayList();
|
|
|
- rif.getDetail().stream()
|
|
|
- .filter(i -> StringUtil.isNotBlank(i.getHospitalDeptCode()) && StringUtil.isNotBlank(i.getHospitalDeptName()))
|
|
|
- .forEach(i -> {
|
|
|
- HospitalDept hospitalDeptQuery = deptMap.get(i.getHospitalDeptCode());
|
|
|
- if (hospitalDeptQuery == null) {
|
|
|
- HospitalDept hospitalDept = new HospitalDept();
|
|
|
- hospitalDept.setHospitalCode(StringUtil.isNotBlank(sonHospitalCode) ? sonHospitalCode : hospitalCode);
|
|
|
- hospitalDept.setHospitalName(StringUtil.isNotBlank(sonHospitalCode) ? sonHospitalName : hospitalName);
|
|
|
- hospitalDept.setCode(i.getHospitalDeptCode());
|
|
|
- hospitalDept.setName(i.getHospitalDeptName());
|
|
|
- hospitalDept.setConceptDeptName("全科");
|
|
|
- deptSaveOrUpdateList.add(hospitalDept);
|
|
|
- } else {
|
|
|
- hospitalDeptQuery.setName(i.getHospitalDeptName());
|
|
|
- deptSaveOrUpdateList.add(hospitalDeptQuery);
|
|
|
- }
|
|
|
- });
|
|
|
- if (ListUtil.isNotEmpty(deptSaveOrUpdateList)) {
|
|
|
- hospitalDeptService.saveOrUpdateBatch(deptSaveOrUpdateList);
|
|
|
+ if (ListUtil.isNotEmpty(deptCodeList)) {
|
|
|
+ QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
|
+ hospitalDeptQe.eq("hospital_code", sonHospitalCode);
|
|
|
+ hospitalDeptQe.in("code", deptCodeList);
|
|
|
+ Map<String, HospitalDept> deptMap = hospitalDeptFacade.list(hospitalDeptQe)
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(HospitalDept::getCode, i -> i));
|
|
|
+ rif.getDetail().stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getHospitalDeptCode())
|
|
|
+ && StringUtil.isNotBlank(i.getHospitalDeptName()))
|
|
|
+ .forEach(i -> {
|
|
|
+ if (!deptSaveOrUpdateList.stream()
|
|
|
+ .filter(deptSaveOrUpdate -> deptSaveOrUpdate.getHospitalCode().equals(sonHospitalCode))
|
|
|
+ .map(deptSaveOrUpdate -> deptSaveOrUpdate.getCode())
|
|
|
+ .collect(Collectors.toList())
|
|
|
+ .contains(i.getHospitalDeptCode())) {
|
|
|
+ HospitalDept hospitalDeptQuery = deptMap.get(i.getHospitalDeptCode());
|
|
|
+ if (hospitalDeptQuery == null) {
|
|
|
+ hospitalDeptQuery = new HospitalDept();
|
|
|
+ hospitalDeptQuery.setHospitalCode(sonHospitalCode);
|
|
|
+ hospitalDeptQuery.setHospitalName(sonHospitalName);
|
|
|
+ hospitalDeptQuery.setCode(i.getHospitalDeptCode());
|
|
|
+ hospitalDeptQuery.setName(i.getHospitalDeptName());
|
|
|
+ hospitalDeptQuery.setConceptDeptName("全科");
|
|
|
+ } else {
|
|
|
+ hospitalDeptQuery.setName(i.getHospitalDeptName());
|
|
|
+ }
|
|
|
+ deptSaveOrUpdateList.add(hospitalDeptQuery);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- rif.getDetail().stream()
|
|
|
+ /********** 医生部分 **********/
|
|
|
+ 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()))
|
|
|
- .forEach(i -> {
|
|
|
- doctorCodeList.add(i.getCode());
|
|
|
- doctorInfoList.add(i);
|
|
|
- });
|
|
|
+ .map(i -> i.getCode())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(doctorCodeList)) {
|
|
|
+ QueryWrapper<DoctorInfo> doctorInfoQe = new QueryWrapper<>();
|
|
|
+ doctorInfoQe.eq("hospital_code", sonHospitalCode);
|
|
|
+ doctorInfoQe.in("code", doctorCodeList);
|
|
|
+ Map<String, DoctorInfo> doctorMap = doctorInfoFacade.list(doctorInfoQe)
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(DoctorInfo::getCode, i -> i));
|
|
|
+ rif.getDetail().stream()
|
|
|
+ .filter(i -> i.getDoctorInfo() != null).map(i -> i.getDoctorInfo())
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getCode()) && StringUtil.isNotBlank(i.getName()))
|
|
|
+ .forEach(i -> {
|
|
|
+ if (!doctorSaveOrUpdateList.stream()
|
|
|
+ .filter(doctorSaveOrUpdate -> doctorSaveOrUpdate.getHospitalCode().equals(sonHospitalCode))
|
|
|
+ .map(doctorSaveOrUpdate -> doctorSaveOrUpdate.getCode())
|
|
|
+ .collect(Collectors.toList())
|
|
|
+ .contains(i.getCode())) {
|
|
|
+ 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(sonHospitalCode);
|
|
|
+ doctorInfo.setId(docId);
|
|
|
+ doctorSaveOrUpdateList.add(doctorInfo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
- if (ListUtil.isEmpty(doctorCodeList)) {
|
|
|
- return;
|
|
|
+ if (ListUtil.isNotEmpty(patientSaveOrUpdateList)) {
|
|
|
+ patientInfoService.saveOrUpdateBatch(patientSaveOrUpdateList);
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(deptSaveOrUpdateList)) {
|
|
|
+ hospitalDeptService.saveOrUpdateBatch(deptSaveOrUpdateList);
|
|
|
}
|
|
|
-
|
|
|
- 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);
|
|
|
}
|
|
@@ -361,12 +394,12 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
+ "\"sonHospitalName\": \"四季青街道社区卫生服务中心\","
|
|
|
+ "\"patientInfo\": {"
|
|
|
+ " \"birthday\": \"1984-10-08 10:20:23\","
|
|
|
- + "\"code\": \"1747\","
|
|
|
- + "\"idNo\": \"330104198410083034\","
|
|
|
- + " \"hospitalCode\": \"33010400\","
|
|
|
+ + "\"code\": \"1759\","
|
|
|
+ + "\"idNo\": \"binglihao001\","
|
|
|
+ + " \"hospitalCode\": \"33010480\","
|
|
|
+ " \"sex\": 1,"
|
|
|
- + " \"identityNum\": \"330104198410083034\","
|
|
|
- + " \"name\": \"沈利峰\""
|
|
|
+ + " \"identityNum\": \"360827199603149901\","
|
|
|
+ + " \"name\": \"刘亦菲\""
|
|
|
+ "},"
|
|
|
+ "\"detail\": [{"
|
|
|
+ " \"hospitalDeptCode\": \"2127\","
|
|
@@ -377,11 +410,11 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
// + " \"name\": \"普通\""
|
|
|
// + "},"
|
|
|
// + " \"recordId\": \"9043516\","
|
|
|
- + " \"recordTime\": \"2019-12-05 12:29:55\","
|
|
|
- + " \"registerNum\": \"1\""
|
|
|
+ + " \"recordTime\": \"2019-12-26 11:31:05\","
|
|
|
+ + " \"registerNum\": \"15\""
|
|
|
+ "},{"
|
|
|
- + "\"hospitalDeptCode\": \"2533\","
|
|
|
- + " \"hospitalDeptName\": \"机神全科\","
|
|
|
+ + "\"hospitalDeptCode\": \"3005\","
|
|
|
+ + " \"hospitalDeptName\": \"穴位埋线注射\","
|
|
|
// + " \"doctorInfo\": {"
|
|
|
// + "\"code\": \"000\","
|
|
|
// + " \"hospitalCode\": \"33010400\","
|
|
@@ -395,20 +428,20 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
+ "{"
|
|
|
+ " \"hospitalCode\": \"33010400\","
|
|
|
+ "\"hospitalName\": \"江干区卫计局\","
|
|
|
- + " \"sonHospitalCode\": \"33010490\","
|
|
|
- + " \"sonHospitalName\": \"闸弄口街道社区卫生服务中心\","
|
|
|
+ + " \"sonHospitalCode\": \"33010450\","
|
|
|
+ + " \"sonHospitalName\": \"九堡街道社区卫生服务中心\","
|
|
|
+ "\"patientInfo\": {"
|
|
|
+ " \"birthday\": \"1984-10-08 10:20:23\","
|
|
|
- + "\"code\": \"1747\","
|
|
|
- + " \"idNo\": \"330104198410083034\","
|
|
|
- + " \"hospitalCode\": \"33010400\","
|
|
|
+ + "\"code\": \"1759\","
|
|
|
+ + " \"idNo\": \"binglihao001\","
|
|
|
+ + " \"hospitalCode\": \"33010450\","
|
|
|
+ " \"sex\": 1,"
|
|
|
- + " \"identityNum\": \"330104198410083034\","
|
|
|
- + " \"name\": \"沈利峰\""
|
|
|
+ + " \"identityNum\": \"360827199603149901\","
|
|
|
+ + " \"name\": \"刘亦菲\""
|
|
|
+ "},"
|
|
|
+ " \"detail\": [{"
|
|
|
- + " \"hospitalDeptCode\": \"2127\","
|
|
|
- + "\"hospitalDeptName\": \"中医科\","
|
|
|
+ + " \"hospitalDeptCode\": \"3005\","
|
|
|
+ + "\"hospitalDeptName\": \"穴位埋线注射\","
|
|
|
// + " \"doctorInfo\": {"
|
|
|
// + " \"code\": \"000\","
|
|
|
// + " \"hospitalCode\": \"33010400\","
|
|
@@ -418,8 +451,8 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
+ " \"recordTime\": \"2019-12-05 12:29:55\","
|
|
|
+ " \"registerNum\": \"1\""
|
|
|
+ "},{"
|
|
|
- + " \"hospitalDeptCode\": \"2533\","
|
|
|
- + " \"hospitalDeptName\": \"机神全科\","
|
|
|
+ + " \"hospitalDeptCode\": \"2284\","
|
|
|
+ + " \"hospitalDeptName\": \"中心全科\","
|
|
|
// + " \"doctorInfo\": {"
|
|
|
// + " \"code\": \"000\","
|
|
|
// + " \"hospitalCode\": \"33010400\","
|
|
@@ -498,14 +531,14 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
|
|
|
if (inquiryQuoteVO.getDoctorInfo() != null) {
|
|
|
QueryWrapper<DoctorInfo> doctorInfoQe = new QueryWrapper<>();
|
|
|
- doctorInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
|
|
|
+ doctorInfoQe.eq("hospital_code", hospitalCode);
|
|
|
doctorInfoQe.eq("code", inquiryQuoteVO.getDoctorInfo().getCode());
|
|
|
DoctorInfo doctorInfo = doctorInfoFacade.getOne(doctorInfoQe, false);
|
|
|
Long doctorId = null;
|
|
|
if (doctorInfo == null) {
|
|
|
doctorInfo = new DoctorInfo();
|
|
|
doctorInfo.setGmtCreate(now);
|
|
|
- doctorInfo.setHospitalCode(inquiryQuoteVO.getHospitalCode());
|
|
|
+ doctorInfo.setHospitalCode(hospitalCode);
|
|
|
} else {
|
|
|
doctorId = doctorInfo.getId().longValue();
|
|
|
}
|
|
@@ -517,18 +550,19 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
|
- patientInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
|
|
|
+ patientInfoQe.eq("hospital_code", hospitalCode);
|
|
|
patientInfoQe.eq("name", inquiryQuoteVO.getPatientInfo().getName());
|
|
|
- patientInfoQe.and(a ->
|
|
|
- a.eq("id_no", inquiryQuoteVO.getPatientInfo().getIdentityNum())
|
|
|
- .or()
|
|
|
- .eq("identity_num", inquiryQuoteVO.getPatientInfo().getIdentityNum()));
|
|
|
+ patientInfoQe.eq(StringUtil.isBlank(inquiryQuoteVO.getPatientInfo().getIdentityNum())
|
|
|
+ && StringUtil.isNotBlank(inquiryQuoteVO.getPatientInfo().getIdNo()),
|
|
|
+ "id_no", inquiryQuoteVO.getPatientInfo().getIdNo());
|
|
|
+ patientInfoQe.eq(StringUtil.isNotBlank(inquiryQuoteVO.getPatientInfo().getIdentityNum()),
|
|
|
+ "identity_num", inquiryQuoteVO.getPatientInfo().getIdentityNum());
|
|
|
PatientInfo patientInfo = getOne(patientInfoQe, false);
|
|
|
Long patientId = null;
|
|
|
if (patientInfo == null) {
|
|
|
patientInfo = new PatientInfo();
|
|
|
patientInfo.setGmtCreate(now);
|
|
|
- patientInfo.setHospitalCode(inquiryQuoteVO.getHospitalCode());
|
|
|
+ patientInfo.setHospitalCode(hospitalCode);
|
|
|
} else {
|
|
|
patientId = patientInfo.getId().longValue();
|
|
|
}
|