From 74868ba9e0775ccc21d02ef9e0f805bd1e6ae0aa Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 21 十一月 2024 18:15:33 +0800
Subject: [PATCH] 确费逻辑

---
 jh-dependencies/pom.xml                                                                                                        |    6 
 jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java                                      |    7 
 jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserSaveReqVO.java  |    2 
 jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/dal/dataobject/user/AdminUserDO.java              |    2 
 jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/util/SecurityFrameworkUtils.java |   11 +
 jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/user/dto/AdminUserRespDTO.java                |    2 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/ExmRequest.java                                      |   47 +++++
 jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserRespVO.java     |    2 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgRespHeader.java                                   |   27 +++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java                    |   90 +++++++++++
 jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/oauth2/OAuth2TokenServiceImpl.java        |    4 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java            |   20 ++
 jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java        |   34 ++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/patient/PatDetails.java                     |    2 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/dto/AppointmentExternal.java                         |    2 
 jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/LoginUser.java                   |    1 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RemoteDataService.java                               |    6 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmRespResult.java                         |   22 ++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgHeader.java                                       |   37 ++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmReqBody.java                            |   31 +++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/Item.java                                            |   87 ++++++++++
 jh-module-ecg/jh-module-ecg-biz/pom.xml                                                                                        |    5 
 22 files changed, 438 insertions(+), 9 deletions(-)

diff --git a/jh-dependencies/pom.xml b/jh-dependencies/pom.xml
index cea3b02..cfcb2d0 100644
--- a/jh-dependencies/pom.xml
+++ b/jh-dependencies/pom.xml
@@ -75,6 +75,7 @@
         <justauth.version>1.0.8</justauth.version>
         <jimureport.version>1.7.8</jimureport.version>
         <xercesImpl.version>2.12.2</xercesImpl.version>
+        <jackson-dataformat-xml.version>2.14.0</jackson-dataformat-xml.version>
         <weixin-java.version>4.6.0</weixin-java.version>
     </properties>
 
@@ -623,6 +624,11 @@
                 <artifactId>xercesImpl</artifactId>
                 <version>${xercesImpl.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.fasterxml.jackson.dataformat</groupId>
+                <artifactId>jackson-dataformat-xml</artifactId>
+                <version>${jackson-dataformat-xml.version}</version>
+            </dependency>
 
         </dependencies>
     </dependencyManagement>
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 7eccc47..ea1aa71 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
@@ -3,6 +3,7 @@
 import cn.hutool.core.date.LocalDateTimeUtil;
 
 import java.time.*;
+import java.time.format.DateTimeFormatter;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.TimeZone;
@@ -175,4 +176,10 @@
         return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now().minusDays(1));
     }
 
+    public static String getCurTimeString() {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
+        LocalDateTime now = LocalDateTime.now();
+        return now.format(formatter);
+    }
+
 }
diff --git a/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/LoginUser.java b/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/LoginUser.java
index 1b7a4fa..20c413b 100644
--- a/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/LoginUser.java
+++ b/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/LoginUser.java
@@ -20,6 +20,7 @@
 
     public static final String INFO_KEY_NICKNAME = "nickname";
     public static final String INFO_KEY_DEPT_ID = "deptId";
+    public static final String INFO_KEY_HIS_ID = "hisId";
 
     /**
      * 鐢ㄦ埛缂栧彿
diff --git a/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/util/SecurityFrameworkUtils.java b/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/util/SecurityFrameworkUtils.java
index 57062fc..13e8541 100644
--- a/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/util/SecurityFrameworkUtils.java
+++ b/jh-framework/jh-spring-boot-starter-security/src/main/java/cn/lihu/jh/framework/security/core/util/SecurityFrameworkUtils.java
@@ -102,6 +102,17 @@
     }
 
     /**
+     * 鑾峰緱褰撳墠鐢ㄦ埛鐨凥is Id锛屼粠涓婁笅鏂囦腑
+     *
+     * @return hisId
+     */
+    @Nullable
+    public static String getLoginUserHisId() {
+        LoginUser loginUser = getLoginUser();
+        return loginUser != null ? MapUtil.getStr(loginUser.getInfo(), LoginUser.INFO_KEY_HIS_ID) : null;
+    }
+
+    /**
      * 鑾峰緱褰撳墠鐢ㄦ埛鐨勯儴闂ㄧ紪鍙凤紝浠庝笂涓嬫枃涓�
      *
      * @return 閮ㄩ棬缂栧彿
diff --git a/jh-module-ecg/jh-module-ecg-biz/pom.xml b/jh-module-ecg/jh-module-ecg-biz/pom.xml
index bb42c4b..32cead0 100644
--- a/jh-module-ecg/jh-module-ecg-biz/pom.xml
+++ b/jh-module-ecg/jh-module-ecg-biz/pom.xml
@@ -126,6 +126,11 @@
         </dependency>
 
         <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-xml</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-openfeign</artifactId>
             <version>${openfeign.version}</version>
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/patient/PatDetails.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/patient/PatDetails.java
index 0520a47..44b61e5 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/patient/PatDetails.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/patient/PatDetails.java
@@ -18,4 +18,6 @@
     String wardCode;
     String wardDesc;
     String bedNo;
+    Integer source;
+    String applyNo;
 }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/ExmRequest.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/ExmRequest.java
new file mode 100644
index 0000000..2155fc5
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/ExmRequest.java
@@ -0,0 +1,47 @@
+package cn.lihu.jh.module.ecg.feign;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+public class ExmRequest {
+
+    private String authorOrganization;
+    private String requestId;
+    private String patientType;
+    private Item item;
+
+    @JacksonXmlProperty(localName = "AuthorOrganization")
+    public String getAuthorOrganization() {
+        return authorOrganization;
+    }
+
+    public void setAuthorOrganization(String authorOrganization) {
+        this.authorOrganization = authorOrganization;
+    }
+
+    @JacksonXmlProperty(localName = "RequestId")
+    public String getRequestId() {
+        return requestId;
+    }
+
+    public void setRequestId(String requestId) {
+        this.requestId = requestId;
+    }
+
+    @JacksonXmlProperty(localName = "PatientType")
+    public String getPatientType() {
+        return patientType;
+    }
+
+    public void setPatientType(String patientType) {
+        this.patientType = patientType;
+    }
+
+    @JacksonXmlProperty(localName = "Item")
+    public Item getItem() {
+        return item;
+    }
+
+    public void setItem(Item item) {
+        this.item = item;
+    }
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmReqBody.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmReqBody.java
new file mode 100644
index 0000000..795cac1
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmReqBody.java
@@ -0,0 +1,31 @@
+package cn.lihu.jh.module.ecg.feign;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
+
+@JacksonXmlRootElement(localName = "BSXml")
+public class HisFeeConfirmReqBody {
+
+    private MsgHeader msgHeader;
+    private ExmRequest exmRequest;
+
+    @JacksonXmlProperty(localName = "MsgHeader")
+    public MsgHeader getMsgHeader() {
+        return msgHeader;
+    }
+
+    public void setMsgHeader(MsgHeader msgHeader) {
+        this.msgHeader = msgHeader;
+    }
+
+    @JacksonXmlProperty(localName = "ExmRequest")
+    public ExmRequest getExmRequest() {
+        return exmRequest;
+    }
+
+    public void setExmRequest(ExmRequest exmRequest) {
+        this.exmRequest = exmRequest;
+    }
+}
+
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmRespResult.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmRespResult.java
new file mode 100644
index 0000000..99bdd1e
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/HisFeeConfirmRespResult.java
@@ -0,0 +1,22 @@
+package cn.lihu.jh.module.ecg.feign;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
+
+@JacksonXmlRootElement(localName = "BSXml")
+public class HisFeeConfirmRespResult {
+
+    private MsgRespHeader msgHeader;
+
+    @JacksonXmlProperty(localName = "MsgHeader")
+    public MsgRespHeader getMsgHeader() {
+        return msgHeader;
+    }
+
+    public void setMsgHeader(MsgRespHeader msgHeader) {
+        this.msgHeader = msgHeader;
+    }
+
+}
+
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/Item.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/Item.java
new file mode 100644
index 0000000..e16c016
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/Item.java
@@ -0,0 +1,87 @@
+package cn.lihu.jh.module.ecg.feign;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+public class Item {
+
+    private String itemCode;
+    private String itemStatus;
+    private String exeOrganization;
+    private String exeDeptName;
+    private String exeDept;
+    private String exeDoctor;
+    private String exeDoctorName;
+    private String exeDateTime;
+
+    @JacksonXmlProperty(localName = "ItemCode")
+    public String getItemCode() {
+        return itemCode;
+    }
+
+    public void setItemCode(String itemCode) {
+        this.itemCode = itemCode;
+    }
+
+    @JacksonXmlProperty(localName = "ItemStatus")
+    public String getItemStatus() {
+        return itemStatus;
+    }
+
+    public void setItemStatus(String itemStatus) {
+        this.itemStatus = itemStatus;
+    }
+
+    @JacksonXmlProperty(localName = "ExeOrganization")
+    public String getExeOrganization() {
+        return exeOrganization;
+    }
+
+    public void setExeOrganization(String exeOrganization) {
+        this.exeOrganization = exeOrganization;
+    }
+
+    @JacksonXmlProperty(localName = "ExeDeptName")
+    public String getExeDeptName() {
+        return exeDeptName;
+    }
+
+    public void setExeDeptName(String exeDeptName) {
+        this.exeDeptName = exeDeptName;
+    }
+
+    @JacksonXmlProperty(localName = "ExeDept")
+    public String getExeDept() {
+        return exeDept;
+    }
+
+    public void setExeDept(String exeDept) {
+        this.exeDept = exeDept;
+    }
+
+    @JacksonXmlProperty(localName = "ExeDoctor")
+    public String getExeDoctor() {
+        return exeDoctor;
+    }
+
+    public void setExeDoctor(String exeDoctor) {
+        this.exeDoctor = exeDoctor;
+    }
+
+    @JacksonXmlProperty(localName = "ExeDoctorName")
+    public String getExeDoctorName() {
+        return exeDoctorName;
+    }
+
+    public void setExeDoctorName(String exeDoctorName) {
+        this.exeDoctorName = exeDoctorName;
+    }
+
+    @JacksonXmlProperty(localName = "ExeDateTime")
+    public String getExeDateTime() {
+        return exeDateTime;
+    }
+
+    public void setExeDateTime(String exeDateTime) {
+        this.exeDateTime = exeDateTime;
+    }
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgHeader.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgHeader.java
new file mode 100644
index 0000000..7beedbc
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgHeader.java
@@ -0,0 +1,37 @@
+package cn.lihu.jh.module.ecg.feign;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+public class MsgHeader {
+
+    private String sender;
+    private String msgType;
+    private String msgVersion;
+
+    @JacksonXmlProperty(localName = "Sender")
+    public String getSender() {
+        return sender;
+    }
+
+    public void setSender(String sender) {
+        this.sender = sender;
+    }
+
+    @JacksonXmlProperty(localName = "MsgType")
+    public String getMsgType() {
+        return msgType;
+    }
+
+    public void setMsgType(String msgType) {
+        this.msgType = msgType;
+    }
+
+    @JacksonXmlProperty(localName = "MsgVersion")
+    public String getMsgVersion() {
+        return msgVersion;
+    }
+
+    public void setMsgVersion(String msgVersion) {
+        this.msgVersion = msgVersion;
+    }
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgRespHeader.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgRespHeader.java
new file mode 100644
index 0000000..afd7696
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/MsgRespHeader.java
@@ -0,0 +1,27 @@
+package cn.lihu.jh.module.ecg.feign;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+public class MsgRespHeader {
+
+    private String status;
+    private String detail;
+
+    @JacksonXmlProperty(localName = "Status")
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    @JacksonXmlProperty(localName = "Detail")
+    public String getDetail() {
+        return detail;
+    }
+
+    public void setDetail(String detail) {
+        this.detail = detail;
+    }
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RemoteDataService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RemoteDataService.java
index 2fa84dd..17a0ca1 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RemoteDataService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RemoteDataService.java
@@ -12,4 +12,10 @@
                                           @RequestParam("urid") String urid,
                                           @RequestParam("pwd") String pwd,
                                           @RequestBody RestApiReqBodyVo bodyVo);
+
+    @PostMapping(value="/hai/HttpEntry/", produces = MediaType.APPLICATION_XML_VALUE/*, consumes = MediaType.APPLICATION_JSON_VALUE*/)
+    public HisFeeConfirmRespResult httpFeeApi( @RequestParam("service") String service,
+                                          @RequestParam("urid") String urid,
+                                          @RequestParam("pwd") String pwd,
+                                          @RequestBody HisFeeConfirmReqBody bodyVo);
 }
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 1fb3991..f6d60ab 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
@@ -9,6 +9,7 @@
 import java.util.Date;
 
 public class AppointmentExternal {
+    @JsonProperty
     private String ReqIdeApplyno;
     private String ReqStatus;
     private String ReqCodeItemclass;
@@ -19,6 +20,7 @@
     private String OutMedNO;
     private String InMedNO;
     private String VisitNum;
+    @JsonProperty
     private String AdmTypeCode;
     private String AdmTypeDesc;
     private String AdmStatus;
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 e6fdb12..e433dcd 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
@@ -73,7 +73,6 @@
         AppointmentDO appointment = BeanUtils.toBean(createReqVO, AppointmentDO.class);
 
         appointment.setBookTime( LocalDateTime.now() );
-        appointment.setBookSrc( 1 );
 
         try {
             appointmentMapper.insert(appointment);
@@ -203,6 +202,7 @@
             appointmentDO.setBookId(appointmentExternal.getReqIdeApplyno());
             appointmentDO.setBookCheckType(getCorrespondingCheckType(appointmentExternal.getPlanDefItemList().getPlanDefItem().getPlanDefItemcode()));
             appointmentDO.setBookTime(DateUtils.ofUTC(appointmentExternal.getReqAuthoredOn()));  // 寮�鍗曟椂闂�
+            appointmentDO.setBookSrc( getBookSource(appointmentExternal.getAdmTypeCode()) );
 
             // 鍏夊紑鍗曠殑鎯呭喌锛屾病鏈夐绾︽椂闂�
             if (null != appointmentExternal.getReqExtBooktime() ) {
@@ -212,8 +212,7 @@
                 appointmentDO.setBookTimeslot((bookStartTime.getHour() * 100 + bookStartTime.getMinute()) * 10000 + bookEndTime.getHour() * 100 + bookEndTime.getMinute());
             }
 
-            appointmentDO.setBookSrc(0);
-            appointmentDO.setPaid(1);
+            appointmentDO.setPaid( 0 );  // TODO
 
             curAppointDOList.add( appointmentDO );
         }
@@ -264,6 +263,19 @@
         }
 
         return newSeqNo;
+    }
+
+    private Integer getBookSource(String admTypeCode) {
+        if (admTypeCode.equals("AMB"))        // 闂ㄨ瘖
+            return 1;
+        else if (admTypeCode.equals("EMER"))  // 鎬ヨ瘖
+            return 2;
+        else if (admTypeCode.equals("PHY"))  // 浣撴
+            return 3;
+        else if (admTypeCode.equals("IMP"))   // 浣忛櫌
+            return 4;
+
+        return 1;
     }
 
     private Integer getCorrespondingCheckType(String strPlanDefItemcode) {
@@ -324,6 +336,8 @@
         patDetails.setWardCode( appointment.getPatWardCode() );
         patDetails.setWardDesc( appointment.getPatWardDesc() );
         patDetails.setBedNo( appointment.getPatBedNo() );
+        patDetails.setSource( appointment.getPatSrc() );
+        patDetails.setApplyNo( appointment.getApplyNo() );
         return patDetails;
     }
 }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
index 5607b22..45ce17b 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -3,6 +3,7 @@
 import cn.lihu.jh.framework.common.pojo.CommonResult;
 import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils;
 import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.JobRecordSaveReqVO;
+import cn.lihu.jh.module.ecg.dal.dataobject.appointment.AppointmentDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
@@ -14,11 +15,16 @@
 import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
 import cn.lihu.jh.module.ecg.enums.DevStateEnum;
 import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
+import cn.lihu.jh.module.ecg.feign.*;
+import cn.lihu.jh.module.ecg.feign.dto.AppointmentExternal;
 import cn.lihu.jh.module.ecg.service.queue.QueueServiceTxFunctions;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.Console;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
@@ -35,6 +41,8 @@
 import javax.annotation.Resource;
 
 import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.lihu.jh.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+import static cn.lihu.jh.framework.common.util.date.DateUtils.getCurTimeString;
 import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
 
 /**
@@ -48,6 +56,9 @@
 
     @Resource
     QueueServiceTxFunctions queueServiceTxFunctions;
+
+    @Resource
+    private RemoteDataService remoteDataService;
 
     @Resource
     private DevRentMapper devRentMapper;
@@ -74,8 +85,9 @@
 
         Long userId = SecurityFrameworkUtils.getLoginUserId();
         String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
+        String userHisId = SecurityFrameworkUtils.getLoginUserHisId();
 
-        // 鍚屾牱 鍦ㄩ绾︾‘瀹炴椂 灏辫繘鍏� [dev_rent] 琛ㄤ簡
+        // 鍚屾牱 鍦ㄩ绾︾‘璁ゆ椂 灏辫繘鍏� [dev_rent] 琛ㄤ簡
         Long rent_id = createReqVO.getId();
 
         List<Integer> jobTypeList = new ArrayList<Integer>();
@@ -141,6 +153,8 @@
             procAffinityWhenRoutineFinish( firstOnStageQueueItem.getPatId(), checkTypeDO.getAffinityCheckTypes() );
         }
 
+        // 纭垂澶勭悊
+        feeConfirm(firstOnStageQueueItem, userHisId, userNickname);
         return CommonResult.success(rent_id);
     }
 
@@ -814,5 +828,79 @@
         }
     }
 
+    private void feeConfirm(QueueDO queueItem, String hisId, String userNickname, Boolean isFeeConfirmCancel) throws JsonProcessingException {
+        PatDetails patDetails = queueItem.getPatDetails();
+
+        HisFeeConfirmReqBody hisFeeConfirmReqBody = new HisFeeConfirmReqBody();
+        MsgHeader msgHeader = new MsgHeader();
+        msgHeader.setMsgType("ODS_2212");
+        msgHeader.setMsgVersion("3.0");
+        msgHeader.setSender("ECG");
+        hisFeeConfirmReqBody.setMsgHeader(msgHeader);
+        Item item = new Item();
+        item.setItemCode( getHisCheckCode(queueItem.getBookCheckType()) ); //
+        item.setItemStatus( isFeeConfirmCancel? "6" : "5" ); //
+        item.setExeOrganization("47162057-2");
+        item.setExeDeptName("蹇冪數绉�");
+        item.setExeDept("蹇冪數绉�");
+        item.setExeDoctor( hisId ); //
+        item.setExeDoctorName( userNickname ); //
+        item.setExeDateTime( getCurTimeString() ); //
+        ExmRequest exmRequest = new ExmRequest();
+        exmRequest.setAuthorOrganization("47162057-2");
+        exmRequest.setRequestId( patDetails.getApplyNo() );  //
+        exmRequest.setPatientType( getPatientType(patDetails.getSource()) ); //
+        exmRequest.setItem(item);
+        hisFeeConfirmReqBody.setExmRequest(exmRequest);
+        HisFeeConfirmRespResult result = remoteDataService.httpFeeApi("UpdateExmRequestStatus", "ECG", "ECG", hisFeeConfirmReqBody);
+        result.getMsgHeader().getStatus();
+    }
+
+    private String getHisCheckCode(Integer checkType) {
+        if (100 == checkType)
+            return "691133607";
+        else if (200 == checkType)
+            return "201605";
+        else if (300 == checkType)
+            return "200327";
+        else if (400 == checkType)
+            return "201652";
+        else if (500 == checkType)
+            return "502490914";
+        else if (600 == checkType)
+            return "419562119";
+        else if (700 == checkType)
+            return "201604";
+        else if (800 == checkType)
+            return "1202042";
+        else if (900 == checkType)
+            return "1202058";
+        else if (1000 == checkType)
+            return "1202065";
+        else if (1100 == checkType)
+            return "559542128";
+        else if (1200 == checkType)
+            return "590244511";
+        else if (1300 == checkType)
+            return "666454217";
+        else if (1400 == checkType)
+            return "720791490";
+        else if (1500 == checkType)
+            return "720792077";
+
+        return "691133607";
+    }
+
+    String getPatientType( Integer patientSource ) {
+        if (1 == patientSource || 2 == patientSource)
+            return "01";
+        else if (3 == patientSource)
+            return "03";
+        else if (4 == patientSource)
+            return "04";
+
+        return "01";
+    }
+
 }
 
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java b/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java
index 456246d..9d7a7e9 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java
@@ -5,6 +5,12 @@
 import cn.lihu.jh.module.ecg.dal.mysql.appointment.AppointmentMapper;
 import cn.lihu.jh.framework.common.pojo.PageResult;
 
+import cn.lihu.jh.module.ecg.feign.ExmRequest;
+import cn.lihu.jh.module.ecg.feign.HisFeeConfirmReqBody;
+import cn.lihu.jh.module.ecg.feign.Item;
+import cn.lihu.jh.module.ecg.feign.MsgHeader;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import org.junit.Test;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -53,4 +59,32 @@
             System.out.println("Domain: " + Integer.valueOf(domain));
         }
     }
+
+    @Test
+    public void test2() throws JsonProcessingException {
+        HisFeeConfirmReqBody hisFeeConfirmReqBody = new HisFeeConfirmReqBody();
+        MsgHeader msgHeader = new MsgHeader();
+        msgHeader.setMsgType("ODS_2212");
+        msgHeader.setMsgVersion("3.0");
+        msgHeader.setSender("ECG");
+        hisFeeConfirmReqBody.setMsgHeader(msgHeader);
+        Item item = new Item();
+        item.setItemCode("559542128");
+        item.setItemStatus("5");
+        item.setExeOrganization("47162057-2");
+        item.setExeDeptName("蹇冪數绉�");
+        item.setExeDept("蹇冪數绉�");
+        item.setExeDoctor("0457");
+        item.setExeDoctorName("寰愬皬鑻�");
+        item.setExeDateTime("2024-11-21 16:28:28");
+        ExmRequest exmRequest = new ExmRequest();
+        exmRequest.setAuthorOrganization("47162057-2");
+        exmRequest.setRequestId("815769404");
+        exmRequest.setPatientType("01");
+        exmRequest.setItem(item);
+        hisFeeConfirmReqBody.setExmRequest(exmRequest);
+        XmlMapper xmlMapper = new XmlMapper();
+        String xml = xmlMapper.writeValueAsString(hisFeeConfirmReqBody);
+        System.out.println(xml);
+    }
 }
\ No newline at end of file
diff --git a/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/user/dto/AdminUserRespDTO.java b/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/user/dto/AdminUserRespDTO.java
index 241a670..89b38b4 100644
--- a/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/user/dto/AdminUserRespDTO.java
+++ b/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/user/dto/AdminUserRespDTO.java
@@ -48,5 +48,5 @@
      * HIS绯荤粺涓敤鎴风紪鍙�
      *
      */
-    private Integer hisId;
+    private String hisId;
 }
diff --git a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserRespVO.java b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserRespVO.java
index 13533e7..9a33056 100644
--- a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserRespVO.java
+++ b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserRespVO.java
@@ -57,7 +57,7 @@
     private String avatar;
 
     @Schema(description = "His鐢ㄦ埛缂栧彿", example = "9999")
-    private Integer hisId;
+    private String hisId;
 
     @Schema(description = "鐘舵�侊紝鍙傝 CommonStatusEnum 鏋氫妇绫�", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
     @ExcelProperty(value = "甯愬彿鐘舵��", converter = DictConvert.class)
diff --git a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserSaveReqVO.java b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserSaveReqVO.java
index 5f616db..500f4dc 100644
--- a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserSaveReqVO.java
+++ b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/controller/admin/user/vo/user/UserSaveReqVO.java
@@ -65,7 +65,7 @@
     private String avatar;
 
     @Schema(description = "HIS缂栧彿", example = "9999")
-    private Integer hisId;
+    private String hisId;
 
     // ========== 浠呫�愬垱寤恒�戞椂锛岄渶瑕佷紶閫掔殑瀛楁 ==========
 
diff --git a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/dal/dataobject/user/AdminUserDO.java b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/dal/dataobject/user/AdminUserDO.java
index 289fe26..f4565d7 100644
--- a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/dal/dataobject/user/AdminUserDO.java
+++ b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/dal/dataobject/user/AdminUserDO.java
@@ -82,7 +82,7 @@
      * HIS绯荤粺涓敤鎴风紪鍙�
      *
      */
-    private Integer hisId;
+    private String hisId;
     /**
      * 甯愬彿鐘舵��
      *
diff --git a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/oauth2/OAuth2TokenServiceImpl.java b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/oauth2/OAuth2TokenServiceImpl.java
index 4d48aef..294ad6e 100644
--- a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/oauth2/OAuth2TokenServiceImpl.java
+++ b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/oauth2/OAuth2TokenServiceImpl.java
@@ -191,7 +191,9 @@
         if (userType.equals(UserTypeEnum.ADMIN.getValue())) {
             AdminUserDO user = adminUserService.getUser(userId);
             return MapUtil.builder(LoginUser.INFO_KEY_NICKNAME, user.getNickname())
-                    .put(LoginUser.INFO_KEY_DEPT_ID, StrUtil.toStringOrNull(user.getDeptId())).build();
+                    .put(LoginUser.INFO_KEY_DEPT_ID, StrUtil.toStringOrNull(user.getDeptId()))
+                    .put(LoginUser.INFO_KEY_HIS_ID, user.getHisId())
+                    .build();
         } else if (userType.equals(UserTypeEnum.MEMBER.getValue())) {
             // 娉ㄦ剰锛氱洰鍓� Member 鏆傛椂涓嶈鍙栵紝鍙互鎸夐渶瀹炵幇
             return Collections.emptyMap();

--
Gitblit v1.9.3