From b848c233a51666187bf3e4bcf25ee08ba107313a Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 04 十一月 2024 14:05:45 +0800
Subject: [PATCH] 医院平台对接时,根据长度判断,传哪个参数

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
index ab08704..a134956 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
@@ -56,7 +56,12 @@
         appointment.setBookTime( LocalDateTime.now() );
         appointment.setBookSrc( 1 );
 
-        appointmentMapper.insert(appointment);
+        try {
+            appointmentMapper.insert(appointment);
+        } catch (DuplicateKeyException e) {
+            throw exception(APPOINTMENT_EXIST_TODAY);
+        }
+
         // 杩斿洖
         return appointment.getId();
     }
@@ -90,11 +95,17 @@
     }
 
     @Override
-    public AppointmentDO getAppointmentByPatId(String patId) {
+    public AppointmentDO getCurAppointmentByPatId(String patId) {
+        AppointmentDO appointmentDO = appointmentMapper.getCurrentPatId( patId );
+        return appointmentDO;
+    }
+
+    @Override
+    public AppointmentDO queryAndCreateAppointmentByPatId(String patId) {
         // 鍏堜粠鍖婚櫌骞冲彴鏌ヨ
         AppointmentDO appointmentExtermal = getAppointmentExtermal( patId );
         if (null != appointmentExtermal && null != appointmentExtermal.getBookDate() && appointmentExtermal.getBookDate().isEqual(LocalDate.now()) ) {
-            // 鏌ヨDB涓� 鏄惁宸茬粡瀛樺湪
+            // 鏌ュ埌褰撳ぉ鐨勯绾﹀悗锛屾煡璇B涓� 鏄惁宸茬粡瀛樺湪
             AppointmentDO appointmentDO = appointmentMapper.getCurrentPatId( patId );
             if (null == appointmentDO ) {
                 appointmentExtermal.setBookSrc(0);
@@ -115,12 +126,17 @@
     @Override
     public AppointmentDO getAppointmentExtermal(String patId) {
         RestApiReqBodyVo reqBodyVo = new RestApiReqBodyVo();
-        reqBodyVo.setSfzh("");
-        reqBodyVo.setMzzyh( patId );
+        if (18 == patId.length()) {
+            reqBodyVo.setSfzh( patId );
+        } else {
+            reqBodyVo.setMzzyh(patId);
+        }
 
         // QueryRisReportList   queryEcgRequest
         RestApiResult<AppointmentExternal> result = remoteDataService.httpApi("queryEcgRequest", "ECG", "ECG", reqBodyVo);
-        result.getCode();
+        if (0 == result.getRow().size()) {
+            return null;
+        }
 
         AppointmentExternal appointmentExternal = result.getRow().get(0);
         AppointmentDO appointmentDO = BeanUtils.toBean( appointmentExternal, AppointmentDO.class );

--
Gitblit v1.9.3