|
@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -354,40 +355,62 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public Boolean inquiryQuote(InquiryQuoteVO inquiryQuoteVO) {
|
|
public Boolean inquiryQuote(InquiryQuoteVO inquiryQuoteVO) {
|
|
|
|
+ List<String> hospitalCodeList = Lists.newLinkedList();
|
|
|
|
+ hospitalCodeList.add(inquiryQuoteVO.getHospitalCode());
|
|
|
|
+
|
|
String hospitalCode = inquiryQuoteVO.getHospitalCode();
|
|
String hospitalCode = inquiryQuoteVO.getHospitalCode();
|
|
String hospitalName = inquiryQuoteVO.getHospitalName();
|
|
String hospitalName = inquiryQuoteVO.getHospitalName();
|
|
|
|
|
|
- List<String> deptCodeList = Lists.newArrayList(hospitalCode);
|
|
|
|
if (StringUtil.isNotBlank(inquiryQuoteVO.getSonHospitalCode())) {
|
|
if (StringUtil.isNotBlank(inquiryQuoteVO.getSonHospitalCode())) {
|
|
|
|
+ hospitalCodeList.add(inquiryQuoteVO.getSonHospitalCode());
|
|
hospitalCode = inquiryQuoteVO.getSonHospitalCode();
|
|
hospitalCode = inquiryQuoteVO.getSonHospitalCode();
|
|
hospitalName = inquiryQuoteVO.getSonHospitalName();
|
|
hospitalName = inquiryQuoteVO.getSonHospitalName();
|
|
}
|
|
}
|
|
|
|
|
|
- QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
|
|
- hospitalDeptQe.eq("hospital_code", hospitalCode);
|
|
|
|
- hospitalDeptQe.eq("code", inquiryQuoteVO.getDeptInfo().getCode());
|
|
|
|
- HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQe, false);
|
|
|
|
- if (hospitalDept == null) {
|
|
|
|
- hospitalDept = new HospitalDept();
|
|
|
|
- hospitalDept.setHospitalCode(hospitalCode);
|
|
|
|
- hospitalDept.setHospitalName(hospitalName);
|
|
|
|
- hospitalDept.setconceptDeptName("全科");
|
|
|
|
|
|
+ QueryWrapper<HospitalInfo> hospitalInfoQe = new QueryWrapper<>();
|
|
|
|
+ hospitalInfoQe.in("code", hospitalCodeList);
|
|
|
|
+ Map<String,Long> hospitalInfoIdMap = hospitalInfoFacade.list(hospitalInfoQe)
|
|
|
|
+ .stream().collect(Collectors.toMap(HospitalInfo::getCode,i->i.getId()));
|
|
|
|
+
|
|
|
|
+ inquiryQuoteVO.setHospitalId(hospitalInfoIdMap.get(inquiryQuoteVO.getHospitalCode()));
|
|
|
|
+ if (StringUtil.isNotBlank(inquiryQuoteVO.getSonHospitalCode())) {
|
|
|
|
+ inquiryQuoteVO.setSonHospitalId(hospitalInfoIdMap.get(inquiryQuoteVO.getSonHospitalCode()));
|
|
}
|
|
}
|
|
- BeanUtil.copyProperties(inquiryQuoteVO.getDeptInfo(), hospitalDept);
|
|
|
|
- hospitalDeptFacade.saveOrUpdate(hospitalDept);
|
|
|
|
- inquiryQuoteVO.getDeptInfo().setId(hospitalDept.getId());
|
|
|
|
|
|
|
|
- QueryWrapper<DoctorInfo> doctorInfoQe = new QueryWrapper<>();
|
|
|
|
- doctorInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
|
|
|
|
- doctorInfoQe.eq("code", inquiryQuoteVO.getDoctorInfo().getCode());
|
|
|
|
- DoctorInfo doctorInfo = doctorInfoFacade.getOne(doctorInfoQe, false);
|
|
|
|
- if (doctorInfo == null) {
|
|
|
|
- doctorInfo = new DoctorInfo();
|
|
|
|
- doctorInfo.setHospitalCode(inquiryQuoteVO.getHospitalCode());
|
|
|
|
|
|
+ Date now = DateUtil.now();
|
|
|
|
+ if (inquiryQuoteVO.getDeptInfo() != null) {
|
|
|
|
+ QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
|
|
|
|
+ hospitalDeptQe.eq("hospital_code", hospitalCode);
|
|
|
|
+ hospitalDeptQe.eq("code", inquiryQuoteVO.getDeptInfo().getCode());
|
|
|
|
+ HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQe, false);
|
|
|
|
+ if (hospitalDept == null) {
|
|
|
|
+ hospitalDept = new HospitalDept();
|
|
|
|
+ hospitalDept.setGmtCreate(now);
|
|
|
|
+ hospitalDept.setHospitalCode(hospitalCode);
|
|
|
|
+ hospitalDept.setHospitalName(hospitalName);
|
|
|
|
+ hospitalDept.setconceptDeptName("全科");
|
|
|
|
+ }
|
|
|
|
+ BeanUtil.copyProperties(inquiryQuoteVO.getDeptInfo(), hospitalDept);
|
|
|
|
+ hospitalDept.setGmtModified(now);
|
|
|
|
+ hospitalDeptFacade.saveOrUpdate(hospitalDept);
|
|
|
|
+ inquiryQuoteVO.getDeptInfo().setId(hospitalDept.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (inquiryQuoteVO.getDoctorInfo() != null) {
|
|
|
|
+ QueryWrapper<DoctorInfo> doctorInfoQe = new QueryWrapper<>();
|
|
|
|
+ doctorInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
|
|
|
|
+ doctorInfoQe.eq("code", inquiryQuoteVO.getDoctorInfo().getCode());
|
|
|
|
+ DoctorInfo doctorInfo = doctorInfoFacade.getOne(doctorInfoQe, false);
|
|
|
|
+ if (doctorInfo == null) {
|
|
|
|
+ doctorInfo = new DoctorInfo();
|
|
|
|
+ doctorInfo.setGmtCreate(now);
|
|
|
|
+ doctorInfo.setHospitalCode(inquiryQuoteVO.getHospitalCode());
|
|
|
|
+ }
|
|
|
|
+ BeanUtil.copyProperties(inquiryQuoteVO.getDoctorInfo(), doctorInfo);
|
|
|
|
+ doctorInfo.setGmtModified(now);
|
|
|
|
+ doctorInfoFacade.saveOrUpdate(doctorInfo);
|
|
|
|
+ inquiryQuoteVO.getDoctorInfo().setId(doctorInfo.getId());
|
|
}
|
|
}
|
|
- BeanUtil.copyProperties(inquiryQuoteVO.getDoctorInfo(), doctorInfo);
|
|
|
|
- doctorInfoFacade.saveOrUpdate(doctorInfo);
|
|
|
|
- inquiryQuoteVO.getDoctorInfo().setId(doctorInfo.getId());
|
|
|
|
|
|
|
|
QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
|
|
patientInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
|
|
patientInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
|
|
@@ -395,9 +418,11 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
PatientInfo patientInfo = getOne(patientInfoQe);
|
|
PatientInfo patientInfo = getOne(patientInfoQe);
|
|
if (patientInfo == null) {
|
|
if (patientInfo == null) {
|
|
patientInfo = new PatientInfo();
|
|
patientInfo = new PatientInfo();
|
|
|
|
+ patientInfo.setGmtCreate(now);
|
|
patientInfo.setHospitalCode(inquiryQuoteVO.getHospitalCode());
|
|
patientInfo.setHospitalCode(inquiryQuoteVO.getHospitalCode());
|
|
}
|
|
}
|
|
BeanUtil.copyProperties(inquiryQuoteVO.getPatientInfo(), patientInfo);
|
|
BeanUtil.copyProperties(inquiryQuoteVO.getPatientInfo(), patientInfo);
|
|
|
|
+ patientInfo.setGmtModified(now);
|
|
saveOrUpdate(patientInfo);
|
|
saveOrUpdate(patientInfo);
|
|
inquiryQuoteVO.getPatientInfo().setId(patientInfo.getId());
|
|
inquiryQuoteVO.getPatientInfo().setId(patientInfo.getId());
|
|
|
|
|