From d15e7183e308eb5615b163df6ec4860458e78aa7 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期三, 30 十月 2024 15:24:41 +0800
Subject: [PATCH] 对接平台预约数据

---
 jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java                           |   19 ++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/dto/AppointmentExternal.java              |  371 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java |   21 +-
 3 files changed, 397 insertions(+), 14 deletions(-)

diff --git a/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java b/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java
index 51ef5ed..7eccc47 100644
--- a/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java
+++ b/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java
@@ -5,6 +5,7 @@
 import java.time.*;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.TimeZone;
 
 /**
  * 鏃堕棿宸ュ叿绫�
@@ -61,6 +62,24 @@
         return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
     }
 
+    /**
+     * 灏� Date 杞崲鎴� LocalDateTime
+     *
+     * @param date Date
+     * @return LocalDateTime
+     */
+    public static LocalDateTime ofUTC(Date date) {
+        if (date == null) {
+            return null;
+        }
+        // 杞负鏃堕棿鎴�
+        Instant instant = date.toInstant();
+        // UTC鏃堕棿
+        return LocalDateTime.ofInstant(instant, TimeZone.getTimeZone( "GMT" ).toZoneId());
+    }
+
+
+
     public static Date addTime(Duration duration) {
         return new Date(System.currentTimeMillis() + duration.toMillis());
     }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/dto/AppointmentExternal.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/dto/AppointmentExternal.java
index 83f0c6d..7ee8141 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/dto/AppointmentExternal.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/dto/AppointmentExternal.java
@@ -4,8 +4,8 @@
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.Date;
 
-@Data
 public class AppointmentExternal {
     private String ReqIdeApplyno;
     private String ReqStatus;
@@ -19,10 +19,10 @@
     private String AdmTypeCode;
     private String AdmTypeDesc;
     private String AdmStatus;
-    private LocalDate AdmDate;
+    private Date AdmDate;  //LocalDate
     private String PatName;
     private String Patgender;
-    private LocalDate EncPatBirthDate;
+    private Date EncPatBirthDate;  //LocalDate
     private String Age;
     private String Phone;
     private String Address;
@@ -35,7 +35,7 @@
     private String clinSymp;
     private String clinDiag;
     private String relevantDiag;
-    private LocalDateTime ReqAuthoredOn;
+    private Date ReqAuthoredOn;  // LocalDateTime
     private String ReqExtApplydeptCode;
     private String ReqExtApplydeptName;
     private String ReqExtExecdeptCode;
@@ -43,7 +43,7 @@
     private String ReqExtApplydocCode;
     private String ReqExtApplydocName;
     private String ReqExtMedhistory;
-    private LocalDateTime ReqExtBooktime;
+    private Date ReqExtBooktime;  // LocalDateTime
     private String ReqExtBookplace;
     private String ReqExtUrgent;
     private String ReqExtExamgoal;
@@ -54,5 +54,366 @@
     private PlanDefItemList PlanDefItemList;
 
     // 鐪佺暐 getter 鍜� setter 鏂规硶
+
+
+    public String getReqIdeApplyno() {
+        return ReqIdeApplyno;
+    }
+
+    public void setReqIdeApplyno(String reqIdeApplyno) {
+        ReqIdeApplyno = reqIdeApplyno;
+    }
+
+    public String getReqStatus() {
+        return ReqStatus;
+    }
+
+    public void setReqStatus(String reqStatus) {
+        ReqStatus = reqStatus;
+    }
+
+    public String getReqCodeItemclass() {
+        return ReqCodeItemclass;
+    }
+
+    public void setReqCodeItemclass(String reqCodeItemclass) {
+        ReqCodeItemclass = reqCodeItemclass;
+    }
+
+    public String getReqCodeItemclassdetaill() {
+        return ReqCodeItemclassdetaill;
+    }
+
+    public void setReqCodeItemclassdetaill(String reqCodeItemclassdetaill) {
+        ReqCodeItemclassdetaill = reqCodeItemclassdetaill;
+    }
+
+    public String getPatientID() {
+        return PatientID;
+    }
+
+    public void setPatientID(String patientID) {
+        PatientID = patientID;
+    }
+
+    public String getEpisodeID() {
+        return EpisodeID;
+    }
+
+    public void setEpisodeID(String episodeID) {
+        EpisodeID = episodeID;
+    }
+
+    public String getOutMedNO() {
+        return OutMedNO;
+    }
+
+    public void setOutMedNO(String outMedNO) {
+        OutMedNO = outMedNO;
+    }
+
+    public String getInMedNO() {
+        return InMedNO;
+    }
+
+    public void setInMedNO(String inMedNO) {
+        InMedNO = inMedNO;
+    }
+
+    public String getVisitNum() {
+        return VisitNum;
+    }
+
+    public void setVisitNum(String visitNum) {
+        VisitNum = visitNum;
+    }
+
+    public String getAdmTypeCode() {
+        return AdmTypeCode;
+    }
+
+    public void setAdmTypeCode(String admTypeCode) {
+        AdmTypeCode = admTypeCode;
+    }
+
+    public String getAdmTypeDesc() {
+        return AdmTypeDesc;
+    }
+
+    public void setAdmTypeDesc(String admTypeDesc) {
+        AdmTypeDesc = admTypeDesc;
+    }
+
+    public String getAdmStatus() {
+        return AdmStatus;
+    }
+
+    public void setAdmStatus(String admStatus) {
+        AdmStatus = admStatus;
+    }
+
+    public Date getAdmDate() {
+        return AdmDate;
+    }
+
+    public void setAdmDate(Date admDate) {
+        AdmDate = admDate;
+    }
+
+    public String getPatName() {
+        return PatName;
+    }
+
+    public void setPatName(String patName) {
+        PatName = patName;
+    }
+
+    public String getPatgender() {
+        return Patgender;
+    }
+
+    public void setPatgender(String patgender) {
+        Patgender = patgender;
+    }
+
+    public Date getEncPatBirthDate() {
+        return EncPatBirthDate;
+    }
+
+    public void setEncPatBirthDate(Date encPatBirthDate) {
+        EncPatBirthDate = encPatBirthDate;
+    }
+
+    public String getAge() {
+        return Age;
+    }
+
+    public void setAge(String age) {
+        Age = age;
+    }
+
+    public String getPhone() {
+        return Phone;
+    }
+
+    public void setPhone(String phone) {
+        Phone = phone;
+    }
+
+    public String getAddress() {
+        return Address;
+    }
+
+    public void setAddress(String address) {
+        Address = address;
+    }
+
+    public String getIdentityID() {
+        return IdentityID;
+    }
+
+    public void setIdentityID(String identityID) {
+        IdentityID = identityID;
+    }
+
+    public String getPatLocDeptCode() {
+        return PatLocDeptCode;
+    }
+
+    public void setPatLocDeptCode(String patLocDeptCode) {
+        PatLocDeptCode = patLocDeptCode;
+    }
+
+    public String getPatLocDeptDesc() {
+        return PatLocDeptDesc;
+    }
+
+    public void setPatLocDeptDesc(String patLocDeptDesc) {
+        PatLocDeptDesc = patLocDeptDesc;
+    }
+
+    public String getPatLocWardCode() {
+        return PatLocWardCode;
+    }
+
+    public void setPatLocWardCode(String patLocWardCode) {
+        PatLocWardCode = patLocWardCode;
+    }
+
+    public String getPatLocWardDesc() {
+        return PatLocWardDesc;
+    }
+
+    public void setPatLocWardDesc(String patLocWardDesc) {
+        PatLocWardDesc = patLocWardDesc;
+    }
+
+    public String getEnBedno() {
+        return EnBedno;
+    }
+
+    public void setEnBedno(String enBedno) {
+        EnBedno = enBedno;
+    }
+
+    public String getClinSymp() {
+        return clinSymp;
+    }
+
+    public void setClinSymp(String clinSymp) {
+        this.clinSymp = clinSymp;
+    }
+
+    public String getClinDiag() {
+        return clinDiag;
+    }
+
+    public void setClinDiag(String clinDiag) {
+        this.clinDiag = clinDiag;
+    }
+
+    public String getRelevantDiag() {
+        return relevantDiag;
+    }
+
+    public void setRelevantDiag(String relevantDiag) {
+        this.relevantDiag = relevantDiag;
+    }
+
+    public Date getReqAuthoredOn() {
+        return ReqAuthoredOn;
+    }
+
+    public void setReqAuthoredOn(Date reqAuthoredOn) {
+        ReqAuthoredOn = reqAuthoredOn;
+    }
+
+    public String getReqExtApplydeptCode() {
+        return ReqExtApplydeptCode;
+    }
+
+    public void setReqExtApplydeptCode(String reqExtApplydeptCode) {
+        ReqExtApplydeptCode = reqExtApplydeptCode;
+    }
+
+    public String getReqExtApplydeptName() {
+        return ReqExtApplydeptName;
+    }
+
+    public void setReqExtApplydeptName(String reqExtApplydeptName) {
+        ReqExtApplydeptName = reqExtApplydeptName;
+    }
+
+    public String getReqExtExecdeptCode() {
+        return ReqExtExecdeptCode;
+    }
+
+    public void setReqExtExecdeptCode(String reqExtExecdeptCode) {
+        ReqExtExecdeptCode = reqExtExecdeptCode;
+    }
+
+    public String getReqExtExecdeptName() {
+        return ReqExtExecdeptName;
+    }
+
+    public void setReqExtExecdeptName(String reqExtExecdeptName) {
+        ReqExtExecdeptName = reqExtExecdeptName;
+    }
+
+    public String getReqExtApplydocCode() {
+        return ReqExtApplydocCode;
+    }
+
+    public void setReqExtApplydocCode(String reqExtApplydocCode) {
+        ReqExtApplydocCode = reqExtApplydocCode;
+    }
+
+    public String getReqExtApplydocName() {
+        return ReqExtApplydocName;
+    }
+
+    public void setReqExtApplydocName(String reqExtApplydocName) {
+        ReqExtApplydocName = reqExtApplydocName;
+    }
+
+    public String getReqExtMedhistory() {
+        return ReqExtMedhistory;
+    }
+
+    public void setReqExtMedhistory(String reqExtMedhistory) {
+        ReqExtMedhistory = reqExtMedhistory;
+    }
+
+    public Date getReqExtBooktime() {
+        return ReqExtBooktime;
+    }
+
+    public void setReqExtBooktime(Date reqExtBooktime) {
+        ReqExtBooktime = reqExtBooktime;
+    }
+
+    public String getReqExtBookplace() {
+        return ReqExtBookplace;
+    }
+
+    public void setReqExtBookplace(String reqExtBookplace) {
+        ReqExtBookplace = reqExtBookplace;
+    }
+
+    public String getReqExtUrgent() {
+        return ReqExtUrgent;
+    }
+
+    public void setReqExtUrgent(String reqExtUrgent) {
+        ReqExtUrgent = reqExtUrgent;
+    }
+
+    public String getReqExtExamgoal() {
+        return ReqExtExamgoal;
+    }
+
+    public void setReqExtExamgoal(String reqExtExamgoal) {
+        ReqExtExamgoal = reqExtExamgoal;
+    }
+
+    public String getReqExtBookcheckno() {
+        return ReqExtBookcheckno;
+    }
+
+    public void setReqExtBookcheckno(String reqExtBookcheckno) {
+        ReqExtBookcheckno = reqExtBookcheckno;
+    }
+
+    public String getReqExtBookcheckpertime() {
+        return ReqExtBookcheckpertime;
+    }
+
+    public void setReqExtBookcheckpertime(String reqExtBookcheckpertime) {
+        ReqExtBookcheckpertime = reqExtBookcheckpertime;
+    }
+
+    public String getReqExtCheckremark() {
+        return ReqExtCheckremark;
+    }
+
+    public void setReqExtCheckremark(String reqExtCheckremark) {
+        ReqExtCheckremark = reqExtCheckremark;
+    }
+
+    public String getPlanDefBarcode() {
+        return PlanDefBarcode;
+    }
+
+    public void setPlanDefBarcode(String planDefBarcode) {
+        PlanDefBarcode = planDefBarcode;
+    }
+
+    public cn.lihu.jh.module.ecg.feign.dto.PlanDefItemList getPlanDefItemList() {
+        return PlanDefItemList;
+    }
+
+    public void setPlanDefItemList(cn.lihu.jh.module.ecg.feign.dto.PlanDefItemList planDefItemList) {
+        PlanDefItemList = planDefItemList;
+    }
 }
 
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 577b98c..ab08704 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
@@ -1,6 +1,7 @@
 package cn.lihu.jh.module.ecg.service.appointment;
 
 import cn.lihu.jh.framework.common.util.date.DateUtils;
+import cn.lihu.jh.framework.common.util.date.LocalDateTimeUtils;
 import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO;
 import cn.lihu.jh.module.ecg.feign.RemoteDataService;
 import cn.lihu.jh.module.ecg.feign.RestApiReqBodyVo;
@@ -20,7 +21,9 @@
 import cn.lihu.jh.module.ecg.dal.mysql.appointment.AppointmentMapper;
 
 import javax.annotation.Resource;
+import javax.xml.crypto.Data;
 
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -90,10 +93,11 @@
     public AppointmentDO getAppointmentByPatId(String patId) {
         // 鍏堜粠鍖婚櫌骞冲彴鏌ヨ
         AppointmentDO appointmentExtermal = getAppointmentExtermal( patId );
-        if (null != appointmentExtermal && null != appointmentExtermal.getBookDate()) {
+        if (null != appointmentExtermal && null != appointmentExtermal.getBookDate() && appointmentExtermal.getBookDate().isEqual(LocalDate.now()) ) {
             // 鏌ヨDB涓� 鏄惁宸茬粡瀛樺湪
             AppointmentDO appointmentDO = appointmentMapper.getCurrentPatId( patId );
             if (null == appointmentDO ) {
+                appointmentExtermal.setBookSrc(0);
                 appointmentMapper.insert( appointmentExtermal );
                 return appointmentExtermal;
             }
@@ -109,23 +113,22 @@
     }
 
     @Override
-    public AppointmentDO getAppointmentExtermal(String mzzyh) {
+    public AppointmentDO getAppointmentExtermal(String patId) {
         RestApiReqBodyVo reqBodyVo = new RestApiReqBodyVo();
-        //reqBodyVo.setSfzh(confirmReqVO.getPatId());
-        reqBodyVo.setMzzyh( mzzyh );
+        reqBodyVo.setSfzh("");
+        reqBodyVo.setMzzyh( patId );
 
         // QueryRisReportList   queryEcgRequest
         RestApiResult<AppointmentExternal> result = remoteDataService.httpApi("queryEcgRequest", "ECG", "ECG", reqBodyVo);
         result.getCode();
 
         AppointmentExternal appointmentExternal = result.getRow().get(0);
-
         AppointmentDO appointmentDO = BeanUtils.toBean( appointmentExternal, AppointmentDO.class );
 
         appointmentDO.setPatId( appointmentExternal.getPatientID() ); // 鍐呭涓� 韬唤璇佸彿 鎴� 闂ㄨ瘖浣忛櫌鍙�
         appointmentDO.setPatName( appointmentExternal.getPatName() );
         appointmentDO.setPatGender( Byte.valueOf(appointmentExternal.getPatgender()) );
-        appointmentDO.setPatBirthday( appointmentExternal.getEncPatBirthDate() );
+        appointmentDO.setPatBirthday( DateUtils.ofUTC(appointmentExternal.getEncPatBirthDate()).toLocalDate() );
         appointmentDO.setPatIdentityId( appointmentExternal.getIdentityID() );
         appointmentDO.setPatAddr( appointmentExternal.getAddress() );
         appointmentDO.setPatDeptCode( appointmentExternal.getPatLocDeptCode() );
@@ -135,10 +138,10 @@
         appointmentDO.setPatMobile( appointmentExternal.getPhone() );
         appointmentDO.setPatBedNo( appointmentExternal.getEnBedno() );
         appointmentDO.setBookId( appointmentExternal.getReqIdeApplyno() );
-        appointmentDO.setBookDate( appointmentExternal.getReqExtBooktime().toLocalDate() );
+        appointmentDO.setBookDate( DateUtils.ofUTC( appointmentExternal.getReqExtBooktime() ).toLocalDate() );
         appointmentDO.setBookCheckType( getCorrespondingCheckType(appointmentExternal.getPlanDefItemList().getPlanDefItem().getPlanDefItemcode()) );
-        appointmentDO.setBookTime( appointmentExternal.getReqAuthoredOn() );
-        LocalDateTime bookStartTime = appointmentExternal.getReqExtBooktime();
+        appointmentDO.setBookTime( DateUtils.ofUTC( appointmentExternal.getReqAuthoredOn() ) );
+        LocalDateTime bookStartTime = DateUtils.ofUTC( appointmentExternal.getReqExtBooktime() );
         LocalDateTime bookEndTime = bookStartTime.plusMinutes(30);
         appointmentDO.setBookTimeslot( (bookStartTime.getHour()*100 + bookStartTime.getMinute())*10000 + bookEndTime.getHour()*100 + bookEndTime.getMinute() );
         appointmentDO.setBookSrc( 0 );

--
Gitblit v1.9.3