|
@@ -17,6 +17,7 @@ import com.diagbot.exception.ServiceErrorCode;
|
|
import com.diagbot.idc.VisibleIdCreater;
|
|
import com.diagbot.idc.VisibleIdCreater;
|
|
import com.diagbot.service.DoctorInfoService;
|
|
import com.diagbot.service.DoctorInfoService;
|
|
import com.diagbot.service.HospitalDeptService;
|
|
import com.diagbot.service.HospitalDeptService;
|
|
|
|
+import com.diagbot.service.PatientInfoService;
|
|
import com.diagbot.service.impl.PatientInfoServiceImpl;
|
|
import com.diagbot.service.impl.PatientInfoServiceImpl;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
@@ -59,6 +60,9 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
private SysSetFacade sysSetFacade;
|
|
private SysSetFacade sysSetFacade;
|
|
@Autowired
|
|
@Autowired
|
|
private VisibleIdCreater visibleIdCreater;
|
|
private VisibleIdCreater visibleIdCreater;
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier("patientInfoServiceImpl")
|
|
|
|
+ private PatientInfoService patientInfoService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 对接-页面顶部病人医生科室信息——查询
|
|
* 对接-页面顶部病人医生科室信息——查询
|
|
@@ -68,40 +72,32 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
*/
|
|
*/
|
|
public GetTopPatientInfoDjDTO getTopPatientInfoDj(GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
|
|
public GetTopPatientInfoDjDTO getTopPatientInfoDj(GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
|
|
String hospitalCode = getTopPatientInfoDjVO.getHospitalCode();
|
|
String hospitalCode = getTopPatientInfoDjVO.getHospitalCode();
|
|
- String sonHospitalCode = getTopPatientInfoDjVO.getSonHospitalCode();
|
|
|
|
- if (StringUtil.isBlank(sonHospitalCode)) {
|
|
|
|
- QueryWrapper<SysSet> sysSetQe = new QueryWrapper<>();
|
|
|
|
- sysSetQe.eq("sys_type", SysTypeEnum.PREC_SERVICE.getKey())
|
|
|
|
- .eq("code", "junior_hospital")
|
|
|
|
- .like("value", hospitalCode);
|
|
|
|
- SysSet juniorHospitalSysSet = sysSetFacade.getOne(sysSetQe, false);
|
|
|
|
- if (juniorHospitalSysSet != null
|
|
|
|
- && Lists.newArrayList(juniorHospitalSysSet.getValue().split(",")).contains(hospitalCode)) {
|
|
|
|
- hospitalCode = juniorHospitalSysSet.getHospitalCode();
|
|
|
|
- sonHospitalCode = getTopPatientInfoDjVO.getHospitalCode();
|
|
|
|
- }
|
|
|
|
- getTopPatientInfoDjVO.setHospitalCode(hospitalCode);
|
|
|
|
- getTopPatientInfoDjVO.setSonHospitalCode(sonHospitalCode);
|
|
|
|
- }
|
|
|
|
|
|
+ String sonHospitalCode =
|
|
|
|
+ StringUtil.isNotBlank(getTopPatientInfoDjVO.getSonHospitalCode())
|
|
|
|
+ ? getTopPatientInfoDjVO.getSonHospitalCode()
|
|
|
|
+ : hospitalCode;
|
|
|
|
+ getTopPatientInfoDjVO.setSonHospitalCode(sonHospitalCode);
|
|
|
|
|
|
GetTopPatientInfoDjDTO getTopPatientInfoDjDTO = this.baseMapper.getTopPatientInfoDj(getTopPatientInfoDjVO);
|
|
GetTopPatientInfoDjDTO getTopPatientInfoDjDTO = this.baseMapper.getTopPatientInfoDj(getTopPatientInfoDjVO);
|
|
getTopPatientInfoDjDTO.setSystemTime(DateUtil.now());
|
|
getTopPatientInfoDjDTO.setSystemTime(DateUtil.now());
|
|
getTopPatientInfoDjDTO.setRecordId(getTopPatientInfoDjVO.getRecordId());
|
|
getTopPatientInfoDjDTO.setRecordId(getTopPatientInfoDjVO.getRecordId());
|
|
getTopPatientInfoDjDTO.setPatientAge(DateUtil.yearCompare(getTopPatientInfoDjDTO.getBirthday(), DateUtil.now()));
|
|
getTopPatientInfoDjDTO.setPatientAge(DateUtil.yearCompare(getTopPatientInfoDjDTO.getBirthday(), DateUtil.now()));
|
|
|
|
|
|
- if (StringUtil.isNotBlank(sonHospitalCode)) {
|
|
|
|
|
|
+ if (!hospitalCode.equals(sonHospitalCode)) {
|
|
QueryWrapper<HospitalInfo> hospitalInfoQe = new QueryWrapper<>();
|
|
QueryWrapper<HospitalInfo> hospitalInfoQe = new QueryWrapper<>();
|
|
- hospitalInfoQe.eq("code", sonHospitalCode);
|
|
|
|
- HospitalInfo sonHospitalInfo = hospitalInfoFacade.getOne(hospitalInfoQe, false);
|
|
|
|
- if (sonHospitalInfo != null) {
|
|
|
|
- getTopPatientInfoDjDTO.setSonHospitalId(sonHospitalInfo.getId());
|
|
|
|
- getTopPatientInfoDjDTO.setSonHospitalCode(sonHospitalInfo.getCode());
|
|
|
|
- getTopPatientInfoDjDTO.setSonHospitalName(sonHospitalInfo.getName());
|
|
|
|
- }
|
|
|
|
|
|
+ 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<>();
|
|
QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
- hospitalDeptQe.eq("hospital_code", StringUtil.isBlank(sonHospitalCode) ? hospitalCode : sonHospitalCode);
|
|
|
|
|
|
+ hospitalDeptQe.eq("hospital_code", sonHospitalCode);
|
|
hospitalDeptQe.eq("code", getTopPatientInfoDjVO.getHospitalDeptCode());
|
|
hospitalDeptQe.eq("code", getTopPatientInfoDjVO.getHospitalDeptCode());
|
|
HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQe, false);
|
|
HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQe, false);
|
|
if (hospitalDept != null) {
|
|
if (hospitalDept != null) {
|
|
@@ -145,16 +141,17 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
private List<SignInDTO> autoGenePatinfo(SignInVO signInVO) {
|
|
private List<SignInDTO> autoGenePatinfo(SignInVO signInVO) {
|
|
|
|
+ String hospitalCode = signInVO.getHospitalCode();
|
|
|
|
+ String sonHospitalCode =
|
|
|
|
+ StringUtil.isNotBlank(signInVO.getSonHospitalCode()) ? signInVO.getSonHospitalCode() : hospitalCode;
|
|
QueryWrapper<SysSet> sysSetQe = new QueryWrapper<>();
|
|
QueryWrapper<SysSet> sysSetQe = new QueryWrapper<>();
|
|
sysSetQe.eq("sys_type", SysTypeEnum.PREC_SERVICE.getKey());
|
|
sysSetQe.eq("sys_type", SysTypeEnum.PREC_SERVICE.getKey());
|
|
sysSetQe.and(qe1 -> qe1
|
|
sysSetQe.and(qe1 -> qe1
|
|
.and(qe2 -> qe2
|
|
.and(qe2 -> qe2
|
|
- .eq("hospital_code", signInVO.getHospitalCode())
|
|
|
|
|
|
+ .eq("hospital_code", hospitalCode)
|
|
.eq("code", "patientinfo"))
|
|
.eq("code", "patientinfo"))
|
|
.or(qe3 -> qe3
|
|
.or(qe3 -> qe3
|
|
- .eq("hospital_code",
|
|
|
|
- StringUtil.isBlank(signInVO.getSonHospitalCode()) ? signInVO.getHospitalCode()
|
|
|
|
- : signInVO.getSonHospitalCode())
|
|
|
|
|
|
+ .eq("hospital_code", sonHospitalCode)
|
|
.eq("code", "default_dept")));
|
|
.eq("code", "default_dept")));
|
|
Map<String, String> sysSetCodeValue = sysSetFacade.list(sysSetQe).stream()
|
|
Map<String, String> sysSetCodeValue = sysSetFacade.list(sysSetQe).stream()
|
|
.collect(Collectors.toMap(SysSet::getCode, i -> i.getValue()));
|
|
.collect(Collectors.toMap(SysSet::getCode, i -> i.getValue()));
|
|
@@ -178,21 +175,22 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
signInDTO.setHospitalDeptCode(hospitalDeptCode);
|
|
signInDTO.setHospitalDeptCode(hospitalDeptCode);
|
|
|
|
|
|
QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
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);
|
|
hospitalDeptQe.eq("code", hospitalDeptCode);
|
|
signInDTO.setHospitalDeptName(hospitalDeptFacade.getOne(hospitalDeptQe, false).getName());
|
|
signInDTO.setHospitalDeptName(hospitalDeptFacade.getOne(hospitalDeptQe, false).getName());
|
|
|
|
|
|
QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
- patientInfoQe.eq("hospital_code", signInVO.getHospitalCode());
|
|
|
|
|
|
+ patientInfoQe.eq("hospital_code", sonHospitalCode);
|
|
patientInfoQe.eq("name", signInVO.getPatientName());
|
|
patientInfoQe.eq("name", signInVO.getPatientName());
|
|
patientInfoQe.and(a ->
|
|
patientInfoQe.and(a ->
|
|
a.eq("id_no", signInVO.getPatientInfo()).or().eq("identity_num", signInVO.getPatientInfo()));
|
|
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 = new PatientInfo();
|
|
patientInfo.setGmtCreate(DateUtil.now());
|
|
patientInfo.setGmtCreate(DateUtil.now());
|
|
- patientInfo.setHospitalCode(signInVO.getHospitalCode());
|
|
|
|
|
|
+ patientInfo.setHospitalCode(sonHospitalCode);
|
|
patientInfo.setIdNo(signInVO.getPatientInfo());
|
|
patientInfo.setIdNo(signInVO.getPatientInfo());
|
|
patientInfo.setIdentityNum(signInVO.getPatientInfo());
|
|
patientInfo.setIdentityNum(signInVO.getPatientInfo());
|
|
patientInfo.setName(signInVO.getPatientName());
|
|
patientInfo.setName(signInVO.getPatientName());
|
|
@@ -203,7 +201,10 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
patientInfo.setRemark("1");//自动生成标志
|
|
patientInfo.setRemark("1");//自动生成标志
|
|
|
|
|
|
save(patientInfo);
|
|
save(patientInfo);
|
|
|
|
+ } else {
|
|
|
|
+ patientInfo = patientInfoList.get(0);
|
|
}
|
|
}
|
|
|
|
+
|
|
signInDTO.setPatientCode(patientInfo.getCode());
|
|
signInDTO.setPatientCode(patientInfo.getCode());
|
|
signInDTO.setPatientName(patientInfo.getName());
|
|
signInDTO.setPatientName(patientInfo.getName());
|
|
|
|
|
|
@@ -250,96 +251,119 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
private void generateByRif(List<RegisterInfoDTO> rifList) {
|
|
private void generateByRif(List<RegisterInfoDTO> rifList) {
|
|
String hospitalCode = rifList.get(0).getHospitalCode();
|
|
String hospitalCode = rifList.get(0).getHospitalCode();
|
|
String hospitalName = rifList.get(0).getHospitalName();
|
|
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 -> {
|
|
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("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(sonHospitalCode);
|
|
|
|
+ patientSaveOrUpdateList.add(saveOrUpat);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /********** 科室部分 **********/
|
|
List<String> deptCodeList = rif.getDetail().stream()
|
|
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())
|
|
.map(i -> i.getHospitalDeptCode())
|
|
.collect(Collectors.toList());
|
|
.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 -> i.getDoctorInfo() != null).map(i -> i.getDoctorInfo())
|
|
.filter(i -> StringUtil.isNotBlank(i.getCode()) && StringUtil.isNotBlank(i.getName()))
|
|
.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)) {
|
|
if (ListUtil.isNotEmpty(doctorSaveOrUpdateList)) {
|
|
doctorInfoService.saveOrUpdateBatch(doctorSaveOrUpdateList);
|
|
doctorInfoService.saveOrUpdateBatch(doctorSaveOrUpdateList);
|
|
}
|
|
}
|