rengb преди 5 години
родител
ревизия
fa55de8db5

+ 15 - 3
tran-service/src/main/java/com/diagbot/facade/PatientInfoDjFacade.java

@@ -356,7 +356,7 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
      * @param inquiryQuoteVO
      * @return
      */
-    public Boolean inquiryQuote(InquiryQuoteVO inquiryQuoteVO) {
+    public InquiryQuoteVO inquiryQuote(InquiryQuoteVO inquiryQuoteVO) {
         List<String> hospitalCodeList = Lists.newArrayList();
         hospitalCodeList.add(inquiryQuoteVO.getHospitalCode());
 
@@ -385,15 +385,19 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
             hospitalDeptQe.eq("hospital_code", hospitalCode);
             hospitalDeptQe.eq("code", inquiryQuoteVO.getDeptInfo().getCode());
             HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQe, false);
+            Long deptId = null;
             if (hospitalDept == null) {
                 hospitalDept = new HospitalDept();
                 hospitalDept.setGmtCreate(now);
                 hospitalDept.setHospitalCode(hospitalCode);
                 hospitalDept.setHospitalName(hospitalName);
                 hospitalDept.setconceptDeptName("全科");
+            } else {
+                deptId = hospitalDept.getId().longValue();
             }
             BeanUtil.copyProperties(inquiryQuoteVO.getDeptInfo(), hospitalDept);
             hospitalDept.setGmtModified(now);
+            hospitalDept.setId(deptId);
             hospitalDeptFacade.saveOrUpdate(hospitalDept);
             inquiryQuoteVO.getDeptInfo().setId(hospitalDept.getId());
         }
@@ -403,13 +407,17 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
             doctorInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
             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());
+            } else {
+                doctorId = doctorInfo.getId().longValue();
             }
             BeanUtil.copyProperties(inquiryQuoteVO.getDoctorInfo(), doctorInfo);
             doctorInfo.setGmtModified(now);
+            doctorInfo.setId(doctorId);
             doctorInfoFacade.saveOrUpdate(doctorInfo);
             inquiryQuoteVO.getDoctorInfo().setId(doctorInfo.getId());
         }
@@ -417,18 +425,22 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
         QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
         patientInfoQe.eq("hospital_code", inquiryQuoteVO.getHospitalCode());
         patientInfoQe.eq("code", inquiryQuoteVO.getPatientInfo().getCode());
-        PatientInfo patientInfo = getOne(patientInfoQe);
+        PatientInfo patientInfo = getOne(patientInfoQe, false);
+        Long patientId = null;
         if (patientInfo == null) {
             patientInfo = new PatientInfo();
             patientInfo.setGmtCreate(now);
             patientInfo.setHospitalCode(inquiryQuoteVO.getHospitalCode());
+        } else {
+            patientId = patientInfo.getId().longValue();
         }
         BeanUtil.copyProperties(inquiryQuoteVO.getPatientInfo(), patientInfo);
         patientInfo.setGmtModified(now);
+        patientInfo.setId(patientId);
         saveOrUpdate(patientInfo);
         inquiryQuoteVO.getPatientInfo().setId(patientInfo.getId());
 
-        return true;
+        return inquiryQuoteVO;
     }
 
 }

+ 2 - 1
tran-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -102,13 +102,14 @@ public class PatientInfoController {
 
     /**
      * 病历引用时,更新患者医生科室信息
+     *
      * @param inquiryQuoteVO
      * @return
      */
     @PostMapping("/inquiryQuote")
     @SysLogger("inquiryQuote")
     @Transactional
-    public RespDTO<Boolean> inquiryQuote(@RequestBody InquiryQuoteVO inquiryQuoteVO) {
+    public RespDTO<InquiryQuoteVO> inquiryQuote(@RequestBody InquiryQuoteVO inquiryQuoteVO) {
         return RespDTO.onSuc(patientInfoDjFacade.inquiryQuote(inquiryQuoteVO));
     }