From e7f9f92fd41ff435f7764362aa621eddbf4c9981 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 03 十一月 2026 10:21:20 +0800
Subject: [PATCH] 代码提交
---
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDMedicalRecordResDTO.java | 17
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospCheckInfo.java | 71
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/collect/HisGatherCollectors.java | 112 +
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospInfo.java | 121 +
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceAppointRecordServiceImpl.java | 96
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDContactsResDTO.java | 28
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java | 1816 ++++++++++++++++
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDiagnosisResDTO.java | 28
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDCommonVO.java | 49
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceAppointRecordService.java | 61
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospInfo.java | 469 ++++
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceAppointRecord.java | 453 ++++
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/HNGatherPatArchiveMapper.java | 103
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IXHGatherPatArchiveService.java | 31
ruoyi-datacollection/src/main/resources/mapper/datacollection/ServiceAppointRecordMapper.xml | 806 +++++++
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDeptReqVO.java | 48
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospCheckInfo.java | 74
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HNGatherPatArchiveServiceImpl.java | 295 ++
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospReqVO.java | 92
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceSLTDHealthcareRecordService.java | 102
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHNGatherPatArchiveService.java | 79
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospResDTO.java | 233 ++
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/HnDataGatherVO.java | 43
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/ServiceAppointRecordMapper.java | 63
ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/XHGatherPatArchiveServiceImpl.java | 593 +++++
ruoyi-datacollection/src/main/resources/mapper/datacollection/HNGatherPatArchiveMapper.xml | 644 +++++
26 files changed, 6,527 insertions(+), 0 deletions(-)
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/collect/HisGatherCollectors.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/collect/HisGatherCollectors.java
new file mode 100644
index 0000000..0679bc5
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/collect/HisGatherCollectors.java
@@ -0,0 +1,112 @@
+package com.ruoyi.datacollection.collect;
+
+import com.ruoyi.common.core.service.dto.InhospPositionRecord;
+import com.ruoyi.common.core.service.dto.SltdGatherReq;
+import com.ruoyi.datacollection.domain.HnDataGatherVO;
+import com.ruoyi.datacollection.domain.ServiceSLTDDeptReqVO;
+import com.ruoyi.datacollection.domain.ServiceSLTDInhospReqVO;
+import com.ruoyi.datacollection.domain.ServiceSLTDInhospResDTO;
+import com.ruoyi.datacollection.service.IHNGatherPatArchiveService;
+import com.ruoyi.common.core.service.IIcd10Service;
+import com.ruoyi.datacollection.service.IServiceSLTDHealthcareRecordService;
+import com.ruoyi.datacollection.service.IXHGatherPatArchiveService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 4 涓� HIS 閲囬泦鍣ㄧ殑鑱氬悎鍏ュ彛锛堝師 smartor 鐨� HisGatherApiBridge锛� 鈥斺�� 鍥涗釜 HIS 閲囬泦瀹炵幇鐨勫綊灞炴柟銆�
+ *
+ * <h3>鏂瑰悜璇存槑</h3>
+ * 濂戠害澹版槑鍦� {@code ruoyi-common}銆佸疄鐜版斁鍦� smartor锛氬洜涓�
+ * <b>閲囬泦瀹炵幇鐩墠浠嶅湪 smartor</b>锛堟柊鍗� / 娌冲崡 / 鐪佺珛鍚屽痉路鍗楀崕闄勪竴 / 鐤剧梾瀛楀吀锛夛紝
+ * 鑰� {@code ruoyi-datacollection} 涓嶈兘渚濊禆 smartor锛堝惁鍒欐柊妯″潡琚崟浣撶粦姝伙紝妯″潡鍖栧�掗��锛夈��
+ * Spring 杩愯鏈熸敞鍏ユ湰瀹炵幇銆�
+ *
+ * <h3>鈿狅笍 鏈被蹇呴』淇濇寔"绾浆鍙�"</h3>
+ * 鍙仛涓や欢浜嬶細<b>濂戠害 DTO 鈫� 鍐呴儴 VO 鐨勯�愬瓧娈垫惉杩�</b>銆�<b>璋冪敤鏃㈡湁 Service</b>銆�
+ * <b>涓嶅緱</b>鍦ㄨ繖閲屽姞涓氬姟鍒ゆ柇銆佽ˉ榛樿鍊笺�佸悶寮傚父鎴栨敼璋冪敤椤哄簭 鈥斺��
+ * 绉绘鍓嶅悗鐨勮涓哄樊寮傞兘瑕佽兘鍦� {@code HisDataCollectionServiceImpl} 涓�澶勭湅娓呫��
+ *
+ * <h3>灏嗘潵鍔ㄤ綔锛堝垎闃舵鎼縼锛�</h3>
+ * 閲囬泦瀹炵幇鎸夋壒鎼繘 {@code ruoyi-datacollection} 鍚庯紝瀵瑰簲鏂规硶浠庢湰绫讳笌
+ * {@link HisGatherApi} 涓�璧峰垹闄わ紱鍏ㄩ儴鎼畬鏃舵湰绫绘暣浣撳垹闄ゃ��
+ * 瑙� {@code doc/鏁版嵁閲囬泦妯″潡鍖朹璋冪爺涓庡疄鏂芥柟妗�.md}銆�
+ */
+@Slf4j
+@Component
+public class HisGatherCollectors {
+
+ @Autowired
+ private IXHGatherPatArchiveService ixhGatherPatArchiveService;
+
+ @Autowired
+ private IHNGatherPatArchiveService ihnGatherPatArchiveService;
+
+ @Autowired
+ private IServiceSLTDHealthcareRecordService serviceSLTDHealthcareRecordService;
+
+ @Autowired
+ private IIcd10Service iIcd10Service;
+
+ public void gatherXhInhospRecords(String cry, LocalDateTime startTime, LocalDateTime endTime) {
+ // 鍘� RyTask#dealHisData 鐩磋皟 ixhGatherPatArchiveService.getInHospDataGather(cry, start, end)
+ ixhGatherPatArchiveService.getInHospDataGather(cry, startTime, endTime);
+ }
+
+ public void gatherHnRecords(Date startTime, Date endTime) {
+ // 鍘� RyTask#dealHisData 缁勮 HnDataGatherVO锛堝彧鏈� startTime / endTime 涓や釜瀛楁锛夊悗璋冪敤
+ HnDataGatherVO hnDataGatherVO = new HnDataGatherVO();
+ hnDataGatherVO.setStartTime(startTime);
+ hnDataGatherVO.setEndTime(endTime);
+ ihnGatherPatArchiveService.hnDataGather(hnDataGatherVO);
+ }
+
+ public Boolean gatherSltdDeptWardArea(SltdGatherReq req) {
+ ServiceSLTDDeptReqVO deptReqVO = new ServiceSLTDDeptReqVO();
+ deptReqVO.setOrgId(req.getOrgId());
+ deptReqVO.setCampusIds(req.getCampusIds());
+ return serviceSLTDHealthcareRecordService.queryDeptWardAreaInfoList(deptReqVO);
+ }
+
+ public Boolean gatherSltdHospUser(SltdGatherReq req) {
+ return serviceSLTDHealthcareRecordService.queryHospUserInfoList(toInhospReq(req));
+ }
+
+ public int gatherSltdHealthcareRecords(SltdGatherReq req) {
+ // 鍘熻皟鐢ㄧ偣涓㈠純杩斿洖鍊硷紙鍙叧蹇冭惤搴撳壇浣滅敤锛夛紱杩欓噷鎶婃潯鏁伴�忓嚭锛屼緵缂栨帓鍒ゆ柇鎺ュ彛鏄惁瑙﹂《鎴柇
+ List<ServiceSLTDInhospResDTO> records = serviceSLTDHealthcareRecordService.queryHealthcareRecordList(toInhospReq(req));
+ return records == null ? 0 : records.size();
+ }
+
+ public List<InhospPositionRecord> querySltdInhospPosition(SltdGatherReq req) {
+ return serviceSLTDHealthcareRecordService.queryInhospPosition(toInhospReq(req));
+ }
+
+ public int gatherIcd10() {
+ return iIcd10Service.queryAddIcd10();
+ }
+
+ /**
+ * 濂戠害 DTO 鈫� 鍐呴儴 VO 鐨�<b>閫愬瓧娈�</b>鎼繍锛堝绾� DTO 鍒绘剰鍙繚鐣欑紪鎺掔湡姝d細璁剧疆鐨勫瓧娈碉級銆�
+ */
+ private ServiceSLTDInhospReqVO toInhospReq(SltdGatherReq req) {
+ ServiceSLTDInhospReqVO reqVO = new ServiceSLTDInhospReqVO();
+ reqVO.setOrgId(req.getOrgId());
+ reqVO.setCampusId(req.getCampusId());
+ reqVO.setEncounterTimeStart(req.getEncounterTimeStart());
+ reqVO.setEncounterTimeEnd(req.getEncounterTimeEnd());
+ reqVO.setStartHeadTime(req.getStartHeadTime());
+ reqVO.setStartTailTime(req.getStartTailTime());
+ reqVO.setPreOutHospitalHeadDate(req.getPreOutHospitalHeadDate());
+ reqVO.setPreOutHospitalTailDate(req.getPreOutHospitalTailDate());
+ reqVO.setStatusList(req.getStatusList());
+ reqVO.setHealthcareRecordTypeList(req.getHealthcareRecordTypeList());
+ reqVO.setHealthcareRecordNo(req.getHealthcareRecordNo());
+ return reqVO;
+ }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/HnDataGatherVO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/HnDataGatherVO.java
new file mode 100644
index 0000000..e56d842
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/HnDataGatherVO.java
@@ -0,0 +1,43 @@
+package com.ruoyi.datacollection.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 娌冲崡鏁版嵁閲囬泦鍏ュ弬瀵硅薄
+ *
+ * @author smartor
+ * @date 2023-03-04
+ */
+@ApiModel(value = "HnDataGatherVO", description = "娌冲崡鏁版嵁閲囬泦鍏ュ弬瀵硅薄")
+@Data
+public class HnDataGatherVO extends BaseEntity {
+
+ /**
+ * 寮�濮嬪嚭闄㈡棩鏈�
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = " ", width = 30, dateFormat = "yyyy-MM-dd")
+ @ApiModelProperty(value = "寮�濮嬪嚭闄㈡棩鏈�")
+ private Date startTime;
+
+ /**
+ * 缁撴潫鍑洪櫌鏃ユ湡
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = " ", width = 30, dateFormat = "yyyy-MM-dd")
+ @ApiModelProperty(value = "缁撴潫鍑洪櫌鏃ユ湡")
+ private Date endTime;
+
+
+
+
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceAppointRecord.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceAppointRecord.java
new file mode 100644
index 0000000..6aafe3b
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceAppointRecord.java
@@ -0,0 +1,453 @@
+package com.ruoyi.datacollection.domain;
+
+import com.google.gson.annotations.SerializedName;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 棰勭害璁板綍瀵硅薄 service_appoint_record
+ *
+ * @author lihu
+ * @date 2026-07-06
+ */
+@Data
+@ApiModel("棰勭害璁板綍")
+public class ServiceAppointRecord extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @ApiModelProperty("涓婚敭ID")
+ //鏁版嵁搴撹嚜澧炴敼鎴怈TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 棰勭害璁板綍搴忓彿
+ */
+ @ApiModelProperty("棰勭害璁板綍搴忓彿")
+ @Excel(name = "棰勭害璁板綍搴忓彿")
+ private String appointRecSn;
+
+ /**
+ * 鎹㈣瘖棰勭害璁板綍搴忓彿
+ */
+ @ApiModelProperty("鎹㈣瘖棰勭害璁板綍搴忓彿")
+ @Excel(name = "鎹㈣瘖棰勭害璁板綍搴忓彿")
+ private String changeAppointRecSn;
+
+ /**
+ * 缁勭粐绉戝浠g爜
+ */
+ @ApiModelProperty("缁勭粐绉戝浠g爜")
+ @Excel(name = "缁勭粐绉戝浠g爜")
+ private String orgCode;
+
+ /**
+ * 鐥呬汉妗f搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉妗f搴忓彿")
+ @Excel(name = "鐥呬汉妗f搴忓彿")
+ private String patFileSn;
+
+ /**
+ * 鐥呬汉浠嬭川搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉浠嬭川搴忓彿")
+ @Excel(name = "鐥呬汉浠嬭川搴忓彿")
+ private String patMediaSn;
+
+ /**
+ * 鐥呬汉浠嬭川鍙风爜
+ */
+ @ApiModelProperty("鐥呬汉浠嬭川鍙风爜")
+ @Excel(name = "鐥呬汉浠嬭川鍙风爜")
+ private String patMediaNum;
+
+ /**
+ * 鐥呬汉绫诲埆搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉绫诲埆搴忓彿")
+ @Excel(name = "鐥呬汉绫诲埆搴忓彿")
+ private String patCateSn;
+
+ /**
+ * 鐥呬汉鎬ц川搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉鎬ц川搴忓彿")
+ @Excel(name = "鐥呬汉鎬ц川搴忓彿")
+ private String patNatureSn;
+
+ /**
+ * 鐥呬汉妗f濮撳悕
+ */
+ @ApiModelProperty("鐥呬汉妗f濮撳悕")
+ @Excel(name = "鐥呬汉妗f濮撳悕")
+ private String patFileName;
+
+ /**
+ * 鐥呬汉妗f鎬у埆
+ */
+ @ApiModelProperty("鐥呬汉妗f鎬у埆")
+ @Excel(name = "鐥呬汉妗f鎬у埆")
+ private String patFileGender;
+
+ /**
+ * 鐥呬汉棰勭害骞撮緞
+ */
+ @ApiModelProperty("鐥呬汉棰勭害骞撮緞")
+ @Excel(name = "鐥呬汉棰勭害骞撮緞")
+ private String patAge;
+
+ /**
+ * 鐥呬汉鍑虹敓鏃ユ湡
+ */
+ @ApiModelProperty("鐥呬汉鍑虹敓鏃ユ湡")
+ @Excel(name = "鐥呬汉鍑虹敓鏃ユ湡")
+ private String patBirthday;
+
+ /**
+ * 鐥呬汉璇佷欢绫诲瀷缂栫爜
+ */
+ @ApiModelProperty("鐥呬汉璇佷欢绫诲瀷缂栫爜")
+ @Excel(name = "鐥呬汉璇佷欢绫诲瀷缂栫爜")
+ private String patCardTypeCode;
+
+ /**
+ * 鐥呬汉璇佷欢绫诲瀷
+ */
+ @ApiModelProperty("鐥呬汉璇佷欢绫诲瀷")
+ @Excel(name = "鐥呬汉璇佷欢绫诲瀷")
+ private String patCardType;
+
+ /**
+ * 鐥呬汉璇佷欢鍙风爜
+ */
+ @ApiModelProperty("鐥呬汉璇佷欢鍙风爜")
+ @Excel(name = "鐥呬汉璇佷欢鍙风爜")
+ private String patIdCardNum;
+
+ /**
+ * 鐥呬汉鑱旂郴鍦板潃
+ */
+ @ApiModelProperty("鐥呬汉鑱旂郴鍦板潃")
+ @Excel(name = "鐥呬汉鑱旂郴鍦板潃")
+ private String patAddr;
+
+ /**
+ * 鐥呬汉鑱旂郴鐢佃瘽
+ */
+ @ApiModelProperty("鐥呬汉鑱旂郴鐢佃瘽")
+ @Excel(name = "鐥呬汉鑱旂郴鐢佃瘽")
+ private String patTel;
+
+ /**
+ * 鐥呬汉鏉ユ簮缂栫爜
+ */
+ @ApiModelProperty("鐥呬汉鏉ユ簮缂栫爜")
+ @Excel(name = "鐥呬汉鏉ユ簮缂栫爜")
+ private String patWayCode;
+
+ /**
+ * 鐥呬汉鏉ユ簮
+ */
+ @ApiModelProperty("鐥呬汉鏉ユ簮")
+ @Excel(name = "鐥呬汉鏉ユ簮")
+ private String patWay;
+
+ /**
+ * 棰勭害绫诲瀷搴忓彿
+ */
+ @ApiModelProperty("棰勭害绫诲瀷搴忓彿")
+ @Excel(name = "棰勭害绫诲瀷搴忓彿")
+ private String appointTypeSn;
+
+ /**
+ * 棰勭害鎿嶄綔鏃ユ湡
+ */
+ @ApiModelProperty("棰勭害鎿嶄綔鏃ユ湡")
+ @Excel(name = "棰勭害鎿嶄綔鏃ユ湡")
+ private Date appointDate;
+
+ /**
+ * 棰勭害鎿嶄綔浜篿d
+ */
+ @ApiModelProperty("棰勭害鎿嶄綔浜篿d")
+ @Excel(name = "棰勭害鎿嶄綔浜篿d")
+ private String appointOperatorId;
+
+ /**
+ * 棰勭害鎿嶄綔浜哄鍚�
+ */
+ @ApiModelProperty("棰勭害鎿嶄綔浜哄鍚�")
+ @Excel(name = "棰勭害鎿嶄綔浜哄鍚�")
+ private String appointOperatorName;
+
+ /**
+ * 棰勭害鎸傚彿鏃ユ湡
+ */
+ @ApiModelProperty("棰勭害鎸傚彿鏃ユ湡")
+ @Excel(name = "棰勭害鎸傚彿鏃ユ湡")
+ private Date appointRegistDate;
+
+ /**
+ * 鎸傚彿鎺掔彮搴忓彿
+ */
+ @ApiModelProperty("鎸傚彿鎺掔彮搴忓彿")
+ @Excel(name = "鎸傚彿鎺掔彮搴忓彿")
+ private String registerScheduleSn;
+
+ /**
+ * 闂ㄨ瘖绫诲埆搴忓彿
+ */
+ @ApiModelProperty("闂ㄨ瘖绫诲埆搴忓彿")
+ @Excel(name = "闂ㄨ瘖绫诲埆搴忓彿")
+ private String outpatCateSn;
+
+ /**
+ * 闂ㄨ瘖绫诲埆鍚嶇О
+ */
+ @ApiModelProperty("闂ㄨ瘖绫诲埆鍚嶇О")
+ @Excel(name = "闂ㄨ瘖绫诲埆鍚嶇О")
+ private String outpatCateName;
+
+ /**
+ * 鎸傚彿绉戝缂栫爜
+ */
+ @ApiModelProperty("鎸傚彿绉戝缂栫爜")
+ @Excel(name = "鎸傚彿绉戝缂栫爜")
+ private String registDeptCode;
+
+ /**
+ * 鎸傚彿绉戝鍚嶇О
+ */
+ @ApiModelProperty("鎸傚彿绉戝鍚嶇О")
+ @Excel(name = "鎸傚彿绉戝鍚嶇О")
+ private String registDeptName;
+
+ /**
+ * 绉戝鎷奸煶缂栫爜
+ */
+ @ApiModelProperty("绉戝鎷奸煶缂栫爜")
+ @Excel(name = "绉戝鎷奸煶缂栫爜")
+ private String deptPinyinCode;
+
+ /**
+ * 鎸傚彿鍖荤敓浠g爜
+ */
+ @ApiModelProperty("鎸傚彿鍖荤敓浠g爜")
+ @Excel(name = "鎸傚彿鍖荤敓浠g爜")
+ private String registDoctCode;
+
+ /**
+ * 鎸傚彿鍖荤敓濮撳悕
+ */
+ @ApiModelProperty("鎸傚彿鍖荤敓濮撳悕")
+ @Excel(name = "鎸傚彿鍖荤敓濮撳悕")
+ private String registDoctName;
+
+ /**
+ * 鑱屽伐鎷奸煶缂栫爜
+ */
+ @ApiModelProperty("鑱屽伐鎷奸煶缂栫爜")
+ @Excel(name = "鑱屽伐鎷奸煶缂栫爜")
+ private String staffPinyinCode;
+
+ /**
+ * 鎸傚彿鏃堕棿绫诲埆
+ */
+ @ApiModelProperty("鎸傚彿鏃堕棿绫诲埆")
+ @Excel(name = "鎸傚彿鏃堕棿绫诲埆")
+ private Long registTimeCate;
+
+ /**
+ * 鐥呬汉鎸傚彿搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉鎸傚彿搴忓彿")
+ @Excel(name = "鐥呬汉鎸傚彿搴忓彿")
+ private Long patiRegistSn;
+
+ /**
+ * 棰勭害鎸傚彿璐圭敤
+ */
+ @ApiModelProperty("棰勭害鎸傚彿璐圭敤")
+ @Excel(name = "棰勭害鎸傚彿璐圭敤")
+ private BigDecimal scheduleRegistCharge;
+
+ /**
+ * 鎸傚彿璁板綍搴忓彿
+ */
+ @ApiModelProperty("鎸傚彿璁板綍搴忓彿")
+ @Excel(name = "鎸傚彿璁板綍搴忓彿")
+ private String registRecSn;
+
+ /**
+ * 鐧昏鐢ㄦ埛搴忓彿
+ */
+ @ApiModelProperty("鐧昏鐢ㄦ埛搴忓彿")
+ @Excel(name = "鐧昏鐢ㄦ埛搴忓彿")
+ private String regUserSn;
+
+ /**
+ * 鐧昏鐢ㄦ埛濮撳悕
+ */
+ @ApiModelProperty("鐧昏鐢ㄦ埛濮撳悕")
+ @Excel(name = "鐧昏鐢ㄦ埛濮撳悕")
+ private String regUserName;
+
+ /**
+ * 鐧昏鎿嶄綔鏃堕棿
+ */
+ @ApiModelProperty("鐧昏鎿嶄綔鏃堕棿")
+ @Excel(name = "鐧昏鎿嶄綔鏃堕棿")
+ private Date regOptTime;
+
+ /**
+ * 鎾ら攢鐢ㄦ埛搴忓彿
+ */
+ @ApiModelProperty("鎾ら攢鐢ㄦ埛搴忓彿")
+ @Excel(name = "鎾ら攢鐢ㄦ埛搴忓彿")
+ private String revokeUserSn;
+
+ /**
+ * 鎾ら攢浜哄鍚�
+ */
+ @ApiModelProperty("鎾ら攢浜哄鍚�")
+ @Excel(name = "鎾ら攢浜哄鍚�")
+ private String revokeUserName;
+
+ /**
+ * 鎾ら攢鎿嶄綔鏃堕棿
+ */
+ @ApiModelProperty("鎾ら攢鎿嶄綔鏃堕棿")
+ @Excel(name = "鎾ら攢鎿嶄綔鏃堕棿")
+ private Date revokeOptTime;
+
+ /**
+ * 閫�鍙锋椂闂�
+ */
+ @ApiModelProperty("閫�鍙锋椂闂�")
+ @Excel(name = "閫�鍙锋椂闂�")
+ private Date withdrawalTime;
+
+ /**
+ * 棰勭害鐘舵�佹爣蹇�(0:宸查绾� 1:宸叉寕鍙� 2:宸查��鍙� 3:宸插氨璇� -1:鐥呬汉鍙栨秷 -2:鍖婚櫌鍙栨秷 -3:鎺掔彮鍋滆瘖)
+ */
+ @ApiModelProperty("棰勭害鐘舵�佹爣蹇�(0:宸查绾� 1:宸叉寕鍙� 2:宸查��鍙� 3:宸插氨璇� -1:鐥呬汉鍙栨秷 -2:鍖婚櫌鍙栨秷 -3:鎺掔彮鍋滆瘖)")
+ @Excel(name = "棰勭害鐘舵�佹爣蹇�(0:宸查绾� 1:宸叉寕鍙� 2:宸查��鍙� 3:宸插氨璇� -1:鐥呬汉鍙栨秷 -2:鍖婚櫌鍙栨秷 -3:鎺掔彮鍋滆瘖)")
+ private Long scheduleStatusFlag;
+
+ /**
+ * 棰勭害澶囨敞璇存槑
+ */
+ @ApiModelProperty("棰勭害澶囨敞璇存槑")
+ @Excel(name = "棰勭害澶囨敞璇存槑")
+ private String scheduleMemoDesc;
+
+ /**
+ * 棰勭害鍑瘉鍙风爜
+ */
+ @ApiModelProperty("棰勭害鍑瘉鍙风爜")
+ @Excel(name = "棰勭害鍑瘉鍙风爜")
+ private String scheduleCredenceNum;
+
+ /**
+ * 棰勮灏辫瘖鏃堕棿
+ */
+ @ApiModelProperty("棰勮灏辫瘖鏃堕棿")
+ @Excel(name = "棰勮灏辫瘖鏃堕棿")
+ private String registTimeRange;
+
+ /**
+ * 鍏蜂綋鏄庣粏琛ㄦ槑缁嗗簭鍙�
+ */
+ @ApiModelProperty("鍏蜂綋鏄庣粏琛ㄦ槑缁嗗簭鍙�")
+ @Excel(name = "鍏蜂綋鏄庣粏琛ㄦ槑缁嗗簭鍙�")
+ private String scheduleDetailSn;
+
+ /**
+ * 灏辫瘖鏃堕棿
+ */
+ @ApiModelProperty("灏辫瘖鏃堕棿")
+ @Excel(name = "灏辫瘖鏃堕棿")
+ @SerializedName("treatDate")
+ private Date treatDate;
+
+ /**
+ * 灏辫瘖鍖荤敓缂栫爜
+ */
+ @ApiModelProperty("灏辫瘖鍖荤敓缂栫爜")
+ @Excel(name = "灏辫瘖鍖荤敓缂栫爜")
+ private String treatDoctCode;
+
+ /**
+ * 灏辫瘖鍖荤敓鍚嶇О
+ */
+ @ApiModelProperty("灏辫瘖鍖荤敓鍚嶇О")
+ @Excel(name = "灏辫瘖鍖荤敓鍚嶇О")
+ private String treatDoctName;
+
+ /**
+ * 棰勭害娓犻亾缂栫爜
+ */
+ @ApiModelProperty("棰勭害娓犻亾缂栫爜")
+ @Excel(name = "棰勭害娓犻亾缂栫爜")
+ private String regWayCode;
+
+ /**
+ * 棰勭害娓犻亾
+ */
+ @ApiModelProperty("棰勭害娓犻亾")
+ @Excel(name = "棰勭害娓犻亾")
+ private String regWay;
+
+ /**
+ * 棰勭害绯荤粺缂栫爜
+ */
+ @ApiModelProperty("棰勭害绯荤粺缂栫爜")
+ @Excel(name = "棰勭害绯荤粺缂栫爜")
+ private String regSystemWayCode;
+
+ /**
+ * 棰勭害绯荤粺
+ */
+ @ApiModelProperty("棰勭害绯荤粺")
+ @Excel(name = "棰勭害绯荤粺")
+ private String regSystemWay;
+
+ /**
+ * 鍒濊瘖澶嶈瘖鍒ゅ埆锛�0鍒濊瘖 1澶嶈瘖锛�
+ */
+ @ApiModelProperty("鍒濊瘖澶嶈瘖鍒ゅ埆锛�0鍒濊瘖 1澶嶈瘖锛�")
+ @Excel(name = "鍒濊瘖澶嶈瘖鍒ゅ埆", readConverterExp = "0=鍒濊瘖,1=澶嶈瘖")
+ private Long visitFlag;
+
+ /**
+ * 鐭俊鍙戦�佹搷浣滀汉id
+ */
+ @ApiModelProperty("鐭俊鍙戦�佹搷浣滀汉id")
+ @Excel(name = "鐭俊鍙戦�佹搷浣滀汉id")
+ private String senderId;
+
+ /**
+ * 鐭俊鍙戦�佹搷浣滀汉濮撳悕
+ */
+ @ApiModelProperty("鐭俊鍙戦�佹搷浣滀汉濮撳悕")
+ @Excel(name = "鐭俊鍙戦�佹搷浣滀汉濮撳悕")
+ private String senderName;
+
+ /**
+ * 鐭俊鍙戦�佹椂闂�
+ */
+ @ApiModelProperty("鐭俊鍙戦�佹椂闂�")
+ @Excel(name = "鐭俊鍙戦�佹椂闂�")
+ private Date sendTime;
+
+}
+
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDCommonVO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDCommonVO.java
new file mode 100644
index 0000000..9146083
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDCommonVO.java
@@ -0,0 +1,49 @@
+package com.ruoyi.datacollection.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel(value = "ServiceSLTDCommonVO", description = "鐪佺珛鍚屽痉鍏叡瀛楁")
+@Data
+public class ServiceSLTDCommonVO {
+ @ApiModelProperty(value = "鏈烘瀯ID 鏈烘瀯鍞竴缂栧彿")
+ private String orgId;
+
+ @ApiModelProperty(value = "鏈烘瀯鍚嶇О 鏈烘瀯鍚嶇О")
+ private String orgName;
+
+ @ApiModelProperty(value = "闄㈠尯ID 闄㈠尯鍞竴缂栧彿")
+ private String campusId;
+
+ @ApiModelProperty(value = "闄㈠尯鍚嶇О 闄㈠尯鍚嶇О")
+ private String campusName;
+
+ @ApiModelProperty(value = "鐥呭尯ID 鐥呭尯鍞竴缂栧彿")
+ private String areaId;
+
+ @ApiModelProperty(value = "鐥呭尯鍚嶇О 鐥呭尯鍚嶇О")
+ private String areaName;
+
+ @ApiModelProperty(value = "绉戝ID 绉戝鍞竴缂栧彿")
+ private String deptId;
+
+ @ApiModelProperty(value = "绉戝鍚嶇О 绉戝鍚嶇О")
+ private String deptName;
+
+ @ApiModelProperty(value = "灏辫瘖璁板綍ID 鎮h�呭崟娆″氨璇婂敮涓�璁板綍ID")
+ private String healthcareRecordId;
+
+ @ApiModelProperty(value = "灏辫瘖娴佹按鍙� 鎮h�呭崟娆″氨璇婂敮涓�涓氬姟娴佹按鍙�")
+ private String healthcareRecordNo;
+
+ @ApiModelProperty(value = "鐥呭巻鍙� 鎮h�呴櫌鍐呭崱鍙凤紝鏈烘瀯鍐呭敮涓�")
+ private String medicalRecordNo;
+
+ @ApiModelProperty(value = "灏辫瘖鍗″彿 鎮h�呭綋娆″氨璇婂嚟璇佸彿")
+ private String medicalCardNo;
+
+ @ApiModelProperty(value = "鎮h�呮。妗圛D 鎮h�呴櫌鍐呭敮涓�缂栫爜")
+ private String patientId;
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDContactsResDTO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDContactsResDTO.java
new file mode 100644
index 0000000..b28672e
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDContactsResDTO.java
@@ -0,0 +1,28 @@
+package com.ruoyi.datacollection.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel(value = "ServiceSLTDContactsResDTO", description = "鐪佺珛鍚屽痉鑱旂郴浜哄搷搴斾俊鎭�")
+@Data
+public class ServiceSLTDContactsResDTO {
+ @ApiModelProperty(value = "鏈烘瀯ID 鏈烘瀯鍞竴缂栧彿")
+ private String orgId;
+
+ @ApiModelProperty(value = "鑱旂郴浜哄鍚�")
+ private String name;
+
+
+ @ApiModelProperty(value = "鑱旂郴浜哄叧绯荤紪鐮�")
+ private String relationshipCode;
+
+ @ApiModelProperty(value = "鑱旂郴浜哄叧绯诲悕绉�")
+ private String relationship;
+
+ @ApiModelProperty(value = "鑱旂郴浜鸿仈绯绘柟寮�")
+ private String telecom;
+
+ @ApiModelProperty(value = "鑱旂郴浜哄湴鍧�")
+ private String currentAddress;
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDeptReqVO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDeptReqVO.java
new file mode 100644
index 0000000..ac0a9af
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDeptReqVO.java
@@ -0,0 +1,48 @@
+package com.ruoyi.datacollection.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@ApiModel(value = "ServiceSLTDCommonReqVO", description = "鐪佺珛鍚屽痉鍑虹瀹ょ梾鍖鸿姹備俊鎭�")
+@Data
+public class ServiceSLTDDeptReqVO {
+ @ApiModelProperty(value = "鏈烘瀯ID 鏈烘瀯鍞竴缂栧彿")
+ private String orgId;
+
+ @ApiModelProperty(value = "闄㈠尯ID")
+ private List<Long> campusIds;
+
+ @ApiModelProperty(value = "鏈烘瀯瀛︾锛屽瓧鍏竎ode")
+ private String orgSubjectCode;
+
+
+ @ApiModelProperty(value = "鍥介檯瀛︾锛屽瓧鍏竎ode ")
+ private String subjectCode;
+
+ @ApiModelProperty(value = "绉戝鍚嶇О妯$硦鍖归厤")
+ private Long searchText;
+
+ @ApiModelProperty(value = "閮ㄩ棬缁村害: 201-浜轰簨 202-涓氬姟 涓嶄紶-鍏ㄩ儴")
+ private Long deptDimensions;
+
+
+ @ApiModelProperty(value = "鏈嶅姟鑼冨洿 锛� 鎬ヨ瘖-emergency 鍖绘妧-medicalTechnology 闂ㄨ瘖-outpatient 浣忛櫌-hospitalization 浣撴-physicalExamination" +
+ "鎵嬫湳-operation 鑽埧-drugRoom 鑽簱-drugWarehouse 鏉愭枡搴�-materialWarehouse 鎶㈡晳-rescue 鐣欒-observation 闈欓厤-venousConfig")
+ private List<String> serviceScopes;
+
+
+ @ApiModelProperty(value = "鏄惁鏄梾鍖�: 0-涓嶆槸 1-鏄�")
+ private Integer inpatientArea;
+
+ @ApiModelProperty(value = "鍋滅敤鐘舵�� : 1-鏈仠鐢� 0-鍋滅敤 涓嶄紶-鍏ㄩ儴")
+ private Integer status;
+
+
+ @ApiModelProperty(value = "閮ㄩ棬绫诲瀷锛� FH0132.01-鍖荤枟 FH0132.02-鏁欏 FH0132.03-绉戠爺 FH0132.04-琛屾斂 FH0132.05-鍚庡嫟 FH0132.06-鍏朵粬")
+ private String deptType;
+
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDiagnosisResDTO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDiagnosisResDTO.java
new file mode 100644
index 0000000..3f0338e
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDDiagnosisResDTO.java
@@ -0,0 +1,28 @@
+package com.ruoyi.datacollection.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel(value = "ServiceSLTDDiagnosisResDTO", description = "鐪佺珛鍚屽痉璇婃柇鍝嶅簲淇℃伅")
+@Data
+public class ServiceSLTDDiagnosisResDTO {
+
+ @ApiModelProperty(value = "鑱旂郴浜哄鍚�")
+ private String name;
+
+ @ApiModelProperty(value = "璇婃柇icd缂栫爜")
+ private String diagnosisDictCode;
+
+ @ApiModelProperty(value = "璇婃柇鍚嶇О")
+ private String diagnosisDictName;
+
+ @ApiModelProperty(value = " 璇婃柇绫诲埆 FH0176.01-鍏ラ櫌璇婃柇 FH0176.02-鍒濇璇婃柇x0;\n" + " FH0176.03-淇璇婃柇\n" + " FH0176.04-琛ュ厖璇婃柇\n" + " FH0176.05-鍑洪櫌璇婃柇\n" + " FH0176.06-涓绘不璇婃柇")
+ private String diagnosisCategory;
+
+ @ApiModelProperty(value = "璇婃柇绫诲瀷 1-涓尰璇婃柇 2-瑗垮尰璇婃柇")
+ private Integer recordType;
+
+ @ApiModelProperty(value = "鏄惁涓昏瘖鏂� 1-涓昏瘖鏂� 0-闈炰富璇婃柇")
+ private Integer isMainDiagnosis;
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospReqVO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospReqVO.java
new file mode 100644
index 0000000..5c6a32b
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospReqVO.java
@@ -0,0 +1,92 @@
+package com.ruoyi.datacollection.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@ApiModel(value = "ServiceSLTDCommonReqVO", description = "鐪佺珛鍚屽痉鍑哄叆闄㈣姹備俊鎭�")
+@Data
+public class ServiceSLTDInhospReqVO {
+ @ApiModelProperty(value = "鏈烘瀯ID 鏈烘瀯鍞竴缂栧彿")
+ private String orgId;
+
+ @ApiModelProperty(value = "闄㈠尯ID")
+ private Long campusId;
+
+ @ApiModelProperty(value = "褰撳墠椤�")
+ private Long current;
+
+ @ApiModelProperty(value = "姣忛〉鏁伴噺")
+ private Long size;
+
+ @ApiModelProperty(value = "鎮h�呭鍚� 蹇呭~涓�涓�")
+ private String patientName;
+
+
+ @ApiModelProperty(value = "韬唤璇佸彿 蹇呭~涓�涓�")
+ private String idCardNo;
+
+ @ApiModelProperty(value = "鐥呭尯id 蹇呭~涓�涓�")
+ private Long areaId;
+
+ @ApiModelProperty(value = "绉戝ID 蹇呭~涓�涓�")
+ private Long deptId;
+
+ @ApiModelProperty(value = "绉戝ID闆嗗悎")
+ private List<Long> deptIdList;
+
+ @ApiModelProperty(value = "璇婄枟璁板綍鍙� 蹇呭~涓�涓�")
+ private String healthcareRecordNo;
+
+ @ApiModelProperty(value = "璇婄枟璁板綍鍙烽泦鍚�")
+ private List<String> healthcareRecordNoList;
+
+ @ApiModelProperty(value = "鐥呭巻鍙� 蹇呭~涓�涓�")
+ private String medicalRecordNo;
+
+ @ApiModelProperty(value = "璇婄枟璁板綍Id 蹇呭~涓�涓�")
+ private Long healthcareRecordId;
+
+ @ApiModelProperty(value = "璇婄枟璁板綍ID闆嗗悎")
+ private List<Long> idList;
+
+ @ApiModelProperty(value = "灏辫瘖鍗″彿 蹇呭~涓�涓�")
+ private String medicalCardNo;
+
+ @ApiModelProperty(value = "鍏ラ櫌鏃堕棿-寮�濮嬫椂闂�")
+ private String startHeadTime;
+
+ @ApiModelProperty(value = "鍏ラ櫌鏃堕棿-缁撴潫鏃堕棿 yyyy-MM-dd")
+ private String startTailTime;
+
+ @ApiModelProperty(value = "鍑洪櫌鏃堕棿-寮�濮嬫椂闂� yyyy-MM-dd")
+ private String preOutHospitalHeadDate;
+
+ @ApiModelProperty(value = "鍑洪櫌鏃堕棿-缁撴潫鏃堕棿 yyyy-MM-dd")
+ private String preOutHospitalTailDate;
+
+ @ApiModelProperty(value = "灏辫瘖鏃堕棿-寮�濮嬫椂闂� : 闂ㄨ瘖璇婄枟璁板綍涓哄彿婧愭椂闂� 浣忛櫌璇婄枟璁板綍涓哄叆闄㈢櫥璁版椂闂� yyyy-MM-dd 鎴� yyyy-MM-dd HH:mm:ss锛堥棬鎬ヨ瘖澧為噺閲囬泦绮剧‘鍒扮锛�")
+ private String encounterTimeStart;
+
+ @ApiModelProperty(value = "灏辫瘖鏃堕棿-缁撴潫鏃堕棿 yyyy-MM-dd 鎴� yyyy-MM-dd HH:mm:ss锛堥棬鎬ヨ瘖澧為噺閲囬泦绮剧‘鍒扮锛�")
+ private String encounterTimeEnd;
+
+ @ApiModelProperty(value = "鍑洪櫌缁撶畻鏃堕棿-寮�濮嬫椂闂� yyyy-MM-dd")
+ private String outHospitalSettleHeadDate;
+
+ @ApiModelProperty(value = "鍑洪櫌缁撶畻鏃堕棿-缁撴潫鏃堕棿 yyyy-MM-dd")
+ private String outHospitalSettleTailDate;
+
+ @ApiModelProperty(value = "璇婄枟绫诲瀷锛� FH0108.01-闂ㄨ瘖 FH0108.02-浣忛櫌 FH0108.03-鎬ヨ瘖 FH0108.04-鐣欒" + "FH0108.05-鎶㈡晳FH0108.06-闂ㄨ瘖浣撴 FH0108.07-浣忛櫌浣撴")
+ private List<String> healthcareRecordTypeList;
+
+ @ApiModelProperty(value = "璇婄枟鐘舵�� 鍙傝�冨�煎煙鏂囨。2.6")
+ private List<String> statusList;
+
+ @ApiModelProperty(value = "鏄惁鍙栨渶杩戜竴娆¤瘖鐤椾俊鎭� 榛樿涓篺alse")
+ private Boolean recently;
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospResDTO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospResDTO.java
new file mode 100644
index 0000000..58d9e96
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDInhospResDTO.java
@@ -0,0 +1,233 @@
+package com.ruoyi.datacollection.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+import com.ruoyi.datacollection.domain.ServiceSLTDContactsResDTO;
+import com.ruoyi.datacollection.domain.ServiceSLTDDiagnosisResDTO;
+import com.ruoyi.datacollection.domain.ServiceSLTDMedicalRecordResDTO;
+
+@ApiModel(value = "ServiceSLTDCommonReqDTO", description = "鐪佺珛鍚屽痉鍑哄叆闄㈠搷搴斾俊鎭�")
+@Data
+public class ServiceSLTDInhospResDTO {
+ @ApiModelProperty(value = "鏈烘瀯ID 鏈烘瀯鍞竴缂栧彿")
+ private String orgId;
+
+ @ApiModelProperty(value = "鏈烘瀯ID 鏈烘瀯鍞竴缂栧彿")
+ private String campusId;
+
+ @ApiModelProperty(value = "璇婄枟璁板綍id 鎮h�呮瘡娆″氨璇婇兘涓嶇浉鍚�")
+ private Long healthcareRecordId;
+
+ @ApiModelProperty(value = "璇婄枟璁板綍鍙� 鎮h�呮瘡娆″氨璇婇兘涓嶇浉鍚�")
+ private String healthcareRecordNo;
+
+ @ApiModelProperty(value = "鎮h�卛d 鎮h�呮瘡娆″氨璇婇兘鐩稿悓")
+ private Long patientId;
+
+ @ApiModelProperty(value = "鎮h�呭悕绉�")
+ private String patientName;
+
+ @ApiModelProperty(value = "鎷奸煶")
+ private String pinyin;
+
+ @ApiModelProperty(value = "姘戞棌")
+ private String nation;
+
+ @ApiModelProperty(value = "灞呮皯韬唤璇佸彿")
+ private String idCardNo;
+
+ @ApiModelProperty(value = "璇婄枟娆℃暟")
+ private Integer healthcareRecordTimes;
+
+ @ApiModelProperty(value = "浣忛櫌娆℃暟")
+ private Integer hospitalizationNumber;
+
+ @ApiModelProperty(value = "灏辫瘖鍗d")
+ private Long medicalCardId;
+
+ @ApiModelProperty(value = "灏辫瘖鍗$被鍨�")
+ private String medicalCardType;
+
+ @ApiModelProperty(value = "灏辫瘖鍗$被鍨嬪悕绉�")
+ private String medicalCardTypeName;
+
+ @ApiModelProperty(value = "灏辫瘖鍗″彿")
+ private String medicalCardNo;
+
+ @ApiModelProperty(value = "鐥呭巻鍙� 鎮h�呮瘡娆″氨璇婇兘鐩稿悓")
+ private String medicalRecordNo;
+
+ @ApiModelProperty(value = "鎬у埆鎻忚堪")
+ private String gender;
+
+ @ApiModelProperty(value = "鎬у埆缂栫爜 鎬у埆缂栫爜瀛楀吀:GB/T2261.1.0-鏈煡鐨勬�у埆\n" + " GB/T2261.1.1-鐢穃n" + " GB/T2261.1.2-濂砛n" + " GB/T2261.1.9-鏈鏄庣殑鎬у埆")
+ private String genderCode;
+
+ @ApiModelProperty(value = "骞撮緞")
+ private String age;
+
+ @ApiModelProperty(value = "鍦板潃")
+ private String address;
+
+ @ApiModelProperty(value = "鐢熸棩")
+ private String birthday;
+
+ @ApiModelProperty(value = "鎵嬫満鍙�")
+ private String phone;
+
+ @ApiModelProperty(value = "鐥呭尯id")
+ private Long areaId;
+
+ @ApiModelProperty(value = "鐥呭尯鍚嶇О")
+ private String areaName;
+
+ @ApiModelProperty(value = "鎴块棿id")
+ private Long roomId;
+
+ @ApiModelProperty(value = "鎴垮彿")
+ private String roomNumber;
+
+ @ApiModelProperty(value = "搴婁綅id")
+ private Long bedId;
+
+ @ApiModelProperty(value = "搴婂彿")
+ private String bedNumber;
+
+ @ApiModelProperty(value = "鎶ょ悊绾у埆")
+ private String nursingLevel;
+
+ @ApiModelProperty(value = "鍏ラ櫌鐧昏鏃堕棿")
+ private String encounterTime;
+
+ @ApiModelProperty(value = "鍏ラ櫌鏃堕棿")
+ private String startTime;
+
+ @ApiModelProperty(value = "鍑洪櫌鏃堕棿")
+ private String preOutHospitalDate;
+
+ @ApiModelProperty(value = "缁撶畻鏃堕棿")
+ private String outHospitalSettleDate;
+
+ @ApiModelProperty(value = "璇婃柇缂栫爜: 鏈灏辫瘖鎮h�呮墍鏈夎瘖鏂搴旂殑icd缂栫爜锛岄�氳繃鈥溿�佲�濆垎闅�")
+ private String diagnosisCode;
+
+ @ApiModelProperty(value = "璇婃柇鍚嶇О 鏈灏辫瘖鎮h�呮墍鏈夎瘖鏂悕绉帮紝閫氳繃鈥溿�佲�濆垎闅�")
+ private String diagnosisName;
+
+ @ApiModelProperty(value = "璇婄枟鐘舵�� 鍙傝�冨�煎煙鏂囨。2.6")
+ private String healthcareRecordStatus;
+
+ @ApiModelProperty(value = "璇婄枟绫诲瀷: FH0108.01-闂ㄨ瘖\n" + " FH0108.02-浣忛櫌\n" + " FH0108.03-鎬ヨ瘖\n" + " FH0108.04-鐣欒\n" + " FH0108.05-鎶㈡晳FH0108.06-闂ㄨ瘖浣撴\n" + " FH0108.07-浣忛櫌浣撴")
+ private String healthcareType;
+
+ @ApiModelProperty(value = "绉戝id")
+ private Long deptId;
+
+ @ApiModelProperty(value = "绉戝鍚嶇О")
+ private String deptName;
+
+ @ApiModelProperty(value = "鍖荤敓id")
+ private Long doctorId;
+
+ @ApiModelProperty(value = "鍖荤敓濮撳悕")
+ private String doctorName;
+
+ @ApiModelProperty(value = "璇婄枟鍛ㄦ湡ID")
+ private Long healthcarePeriodId;
+
+ @ApiModelProperty(value = "鏈�鏂颁竴娆″叆闄㈡椂闂� 涓庡垱寤烘椂闂翠竴鑷�")
+ private String lastEncounterTime;
+
+ @ApiModelProperty(value = "涓荤鎶ゅ+ID")
+ private Long chiefNurseId;
+
+ @ApiModelProperty(value = "涓荤鎶ゅ+鍚嶇О")
+ private String chiefNurseName;
+
+ @ApiModelProperty(value = "璐圭敤绫诲埆")
+ private String costCategoryName;
+
+ @ApiModelProperty(value = "璐圭敤绫诲埆code")
+ private String costCategoryCode;
+
+ @ApiModelProperty(value = "璐圭敤鎬ц川")
+ private String costNatureName;
+
+ @ApiModelProperty(value = "璐圭敤鎬ц川code")
+ private String costNatureCode;
+
+ @ApiModelProperty(value = "鏂囧寲绋嬪害缂栫爜")
+ private String educationCode;
+
+ @ApiModelProperty(value = "鏂囧寲绋嬪害鎻忚堪")
+ private String education;
+
+ @ApiModelProperty(value = "鏄惁鏂扮敓鍎�")
+ private Boolean neonatal;
+
+ @ApiModelProperty(value = "濠氬Щ鐘跺喌缂栫爜")
+ private String marriageCode;
+
+ @ApiModelProperty(value = "濠氬Щ鐘跺喌鎻忚堪")
+ private String marriage;
+
+ @ApiModelProperty(value = "鑱屼笟鎻忚堪")
+ private String occupationType;
+
+ @ApiModelProperty(value = "鑱屼笟缂栫爜")
+ private String occupationTypeCode;
+
+ @ApiModelProperty(value = "澶嶈瘖鐘舵�� 0-鍚�,1-鏄�")
+ private Integer furtherConsultationStatus;
+
+ @ApiModelProperty(value = "绫嶈疮")
+ private String nativePlace;
+
+
+ @ApiModelProperty(value = "鎵嬬幆鍙�")
+ private String wristband;
+
+ @ApiModelProperty(value = "鍖荤枟绫诲瀷")
+ private String medicalType;
+
+ @ApiModelProperty(value = "鍖荤枟绫诲瀷鍚嶇О")
+ private String medicalTypeName;
+
+ @ApiModelProperty(value = "鍖荤敓缁処D")
+ private Long doctorGroupId;
+
+ @ApiModelProperty(value = "鍖荤敓缁勫悕绉�")
+ private String doctorGroupName;
+
+ @ApiModelProperty(value = "鍏ラ櫌璇婃柇缂栫爜")
+ private String admissionDiagnosisCode;
+
+ @ApiModelProperty(value = "鍏ラ櫌璇婃柇鍚嶇О")
+ private String admissionDiagnosisName;
+
+ @ApiModelProperty(value = "璐圭敤閲戦")
+ private Double billAmount;
+
+ @ApiModelProperty(value = "鐥呭巻鏂囦欢鐘舵��")
+ private Integer medicalRecordFileStatus;
+
+ @ApiModelProperty(value = "灏辫瘖鏉ユ簮ID")
+ private String encounterSourceId;
+
+ @ApiModelProperty(value = "涓昏鍑洪櫌璇婃柇")
+ private ServiceSLTDDiagnosisResDTO mainDischargeDiagnosis;
+
+
+
+ @ApiModelProperty(value = "鑱旂郴浜哄垪琛�")
+ private List<ServiceSLTDContactsResDTO> residentContactInfos;
+
+ @ApiModelProperty(value = "璇婃柇鍒楄〃")
+ private List<ServiceSLTDDiagnosisResDTO> diagnosisList;
+
+ @ApiModelProperty(value = "璇婃柇鍒楄〃")
+ private List<ServiceSLTDMedicalRecordResDTO> medicalRecordDataList;
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDMedicalRecordResDTO.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDMedicalRecordResDTO.java
new file mode 100644
index 0000000..9cf2b32
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ServiceSLTDMedicalRecordResDTO.java
@@ -0,0 +1,17 @@
+package com.ruoyi.datacollection.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel(value = "ServiceSLTDMedicalRecordResDTO", description = "鐪佺珛鍚屽痉鐥呭巻淇℃伅鍝嶅簲淇℃伅")
+@Data
+public class ServiceSLTDMedicalRecordResDTO {
+
+ @ApiModelProperty(value = "鐥呭巻鍊�: DE04.01.119.00-涓昏瘔\n" + "DE02.10.071.00-鐜扮梾鍙瞈n" + "DE02.10.099.00-鏃㈠線鍙瞈n" + "DE04.10.258.00-浣撴牸妫�鏌n" + "DE02.10.097.00-涓汉鍙瞈n" + "DE02.10.098.00-濠氳偛鍙瞈n" + "DE02.10.103.00-瀹舵棌鍙瞈n" + "DE02.10.022.00-杩囨晱鍙�")
+ private String code;
+
+ @ApiModelProperty(value = "鐥呭巻鍐呭")
+ private String content;
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospCheckInfo.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospCheckInfo.java
new file mode 100644
index 0000000..78572c9
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospCheckInfo.java
@@ -0,0 +1,71 @@
+package com.ruoyi.datacollection.domain;
+
+
+import com.ruoyi.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 绗笁鏂瑰巶鍟嗕綇闄㈡鏌ヤ俊鎭�
+ *
+ * @author ruoyi
+ * @date 2024-9-02
+ */
+@Data
+@ApiModel("绗笁鏂瑰巶鍟嗗嚭銆佸叆闄俊鎭�")
+public class ThiedInhospCheckInfo {
+
+ private String hospitalId;// 闄㈠尯ID
+ private String patIndex;// 鐥呬汉涓荤储寮�
+ private String patId;// 灏辫瘖ID
+ private String reqCard;// 鐢宠鍗曞彿
+ private String patNo;// 灏辫瘖鍙�
+ private String patType;// 鐥呬汉绫诲瀷
+ private String patName;// 鐥呬汉濮撳悕
+ private String patSex;// 鎬у埆
+ private String patBirth;// 鍑虹敓鏃ユ湡
+ private String patAge;// 鐥呬汉骞撮緞
+ private String patAgeUnit;// 鐥呬汉骞撮緞鍗曚綅
+ private String chargeType;// 鏀惰垂绫诲瀷浠g爜
+ private String patDiag;// 涓村簥璇婃柇
+ private String patDiagIcd;// 璇婃柇ICD10浠g爜
+ private String patAddress;// 鐥呬汉鑱旂郴鍦板潃
+ private String patNation;// 鐥呬汉鍥界睄
+ private String patIdCardNo;// 鐥呬汉韬唤璇佸彿
+ private String patPhone;// 鐥呬汉鑱旂郴鐢佃瘽
+ private String patHeight;// 鐥呬汉韬珮
+ private String patWeight;// 鐥呬汉浣撻噸
+ private String patWardId;// 鐥呬汉鐥呭尯
+ private String patBedNo;// 搴婂彿
+ private String reqDeptId;// 寮�鍗曠瀹D
+ private String reqDeptName;// 寮�鍗曠瀹ゅ悕绉�
+ private String reqDocId;// 鐢宠鍖荤敓ID
+ private String reqDocName;// 鐢宠鍖荤敓濮撳悕
+ private String reqDocComm;// 鍖荤敓澶囨敞
+ private String staffNum;// 鐢宠鍖荤敓宸ュ彿
+ private String reqTime;// 鐢宠鏃堕棿
+ private String printUser;// 鎵撳嵃鑰�
+ private String printTime;// 鎵撳嵃鏃堕棿
+ private String sampleUser;// 閲囨牱鑰�
+ private String sampleTime;// 閲囨牱鏃堕棿
+ private String sendUsder;// 浜ゆ帴鎶ゅ+
+ private String sendTime;// 绉讳氦缁欐姢澹椂闂�
+ private String emerFlag;// 鍔犳�ユ爣蹇�
+ private String sampleTypeId;// 鏍锋湰绫诲瀷ID
+ private String sampleType;// 鏍囨湰绫诲瀷鍚嶇О
+ private String performDeptID;// 鎵ц绉戝ID
+ private String performDeptName;// 鎵ц绉戝鍚嶇О
+ private String requestId;// 鐢宠鍗曞敮涓�ID
+ private String reqItemCode;// 鐢宠椤圭洰浠g爜
+ private String reqItemName;// 鐢宠椤圭洰鍚嶇О
+ private String itemPrice;// 鐢宠椤圭洰鍗曚环
+ private String qty;// 鐢宠椤圭洰鏁伴噺
+ private String chargeFlag;// 璁′环鏍囧織
+ private String detailId;// 鐢宠鏄庣粏鍞竴ID
+ private String itemTypeCode;// 璇婄枟椤圭洰鍒嗙被
+ private String itemClassCode;// 璇婄枟椤圭洰澶х被
+ private String orderId;// 鐥呬汉鍖诲槺ID
+
+}
+
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospInfo.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospInfo.java
new file mode 100644
index 0000000..17081eb
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedInhospInfo.java
@@ -0,0 +1,469 @@
+package com.ruoyi.datacollection.domain;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.ruoyi.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 绗笁鏂瑰巶鍟嗗嚭銆佸叆闄俊鎭�
+ *
+ * @author ruoyi
+ * @date 2024-9-02
+ */
+@Data
+@ApiModel("绗笁鏂瑰巶鍟嗗嚭銆佸叆闄俊鎭�")
+public class ThiedInhospInfo {
+
+ /**
+ * 鏁版嵁绫诲瀷
+ */
+ @ApiModelProperty("鐥呬汉涓荤储寮�")
+ @Excel(name = "鐥呬汉涓荤储寮�")
+ private String patiIndex;
+
+ /**
+ * 鎮h�呭鍚�
+ */
+ @ApiModelProperty("鎮h�呭鍚�")
+ @Excel(name = "鎮h�呭鍚�")
+ private String patiRecordName;
+
+ private String patiRecordId;
+
+
+ private List Education;
+
+
+ /**
+ * 鎶ゅ+ID
+ */
+ @ApiModelProperty(value = "鎶ゅ+ID")
+ private String nurseId;
+
+ /**
+ * 鎶ゅ+濮撳悕
+ */
+ @ApiModelProperty(value = "鎶ゅ+濮撳悕")
+ private String nurseName;
+
+ /**
+ * 鎮h�呭鍚�
+ */
+ @ApiModelProperty("鎮h�呭鍚�")
+ @Excel(name = "鎮h�呭鍚�")
+ private String currDeptCode;
+
+ private String admissDeptCode;
+
+ /**
+ * 鐥呬汉浠嬭川搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉浠嬭川搴忓彿")
+ @Excel(name = "鐥呬汉浠嬭川搴忓彿")
+ private String patiMediaId1;
+
+ /**
+ * 鐥呬汉浠嬭川鍙风爜
+ */
+ @ApiModelProperty("灏辫瘖鍗″彿")
+ @Excel(name = "灏辫瘖鍗″彿")
+ private String patiMediaNo;
+
+ /**
+ * 鐥呬汉浣忛櫌搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉浣忛櫌搴忓彿")
+ @Excel(name = "鐥呬汉浣忛櫌搴忓彿")
+ private String inpatientId1;
+
+ /**
+ * 鎬у埆
+ */
+ @ApiModelProperty("鎬у埆")
+ @Excel(name = "鎬у埆")
+ private String patiRecordGender;
+
+ /**
+ * 骞撮緞
+ */
+ @ApiModelProperty("骞撮緞")
+ @Excel(name = "骞撮緞")
+ private String age;
+
+ /**
+ * 韬唤璇佸彿
+ */
+ @ApiModelProperty("韬唤璇佸彿")
+ @Excel(name = "韬唤璇佸彿")
+ private String patiIdCardNo;
+
+ /**
+ * 鍏ラ櫌鍗曞彿
+ */
+ @ApiModelProperty("鍏ラ櫌鍗曞彿")
+ @Excel(name = "鍏ラ櫌鍗曞彿")
+ private String admitFormId;
+
+ /**
+ * 寤鸿棰勪氦閲戦
+ */
+ @ApiModelProperty("寤鸿棰勪氦閲戦")
+ @Excel(name = "寤鸿棰勪氦閲戦")
+ private String suggestAmount;
+
+ /**
+ * 灏辫瘖鍗″彿
+ */
+ @ApiModelProperty("灏辫瘖鍗″彿")
+ @Excel(name = "灏辫瘖鍗″彿")
+ private String patiMediaId;
+
+ /**
+ * 鐥呬汉绫诲埆搴忓彿
+ */
+ @ApiModelProperty("鐥呬汉绫诲埆搴忓彿")
+ @Excel(name = "鐥呬汉绫诲埆搴忓彿")
+ private String patiTypeId1;
+
+ /**
+ * 鐥呬汉绫诲埆鍚嶇О
+ */
+ @ApiModelProperty("鐥呬汉绫诲埆鍚嶇О")
+ @Excel(name = "鐥呬汉绫诲埆鍚嶇О")
+ private String patiTypeName1;
+
+ /**
+ * 鍖讳繚绫诲瀷
+ */
+ @ApiModelProperty("鍖讳繚绫诲瀷")
+ @Excel(name = "鍖讳繚绫诲瀷")
+ private String patiTypeId;
+
+ /**
+ * 鏁版嵁绫诲瀷
+ */
+ @ApiModelProperty("鍖讳繚绫诲瀷鍚嶇О")
+ @Excel(name = "鍖讳繚绫诲瀷鍚嶇О")
+ private String patiTypeName;
+
+ /**
+ * 浣忛櫌鐘舵��
+ * 1-灏氭湭鍏ョ锛�2-宸茬粡鍏ョ锛�3-宸查鍑洪櫌锛�4-宸插嚭闄紱
+ */
+ @ApiModelProperty("浣忛櫌鐘舵��")
+ @Excel(name = "浣忛櫌鐘舵��")
+ private String currStatus;
+
+ /**
+ * 鏁版嵁绫诲瀷
+ */
+ @ApiModelProperty("闄㈠尯ID")
+ @Excel(name = "闄㈠尯ID")
+ private String areaId;
+
+ /**
+ * 鍏ラ櫌鐥呭尯ID
+ */
+ @ApiModelProperty("鍏ラ櫌鐥呭尯ID")
+ @Excel(name = "鍏ラ櫌鐥呭尯ID")
+ private String admissWardId;
+
+ /**
+ * 鍏ラ櫌鐥呭尯鍚嶇О
+ */
+ @ApiModelProperty("鍏ラ櫌鐥呭尯鍚嶇О")
+ @Excel(name = "鍏ラ櫌鐥呭尯鍚嶇О")
+ private String admissWardName;
+
+ private String admissWardCode;
+
+ /**
+ * 鍏ラ櫌绉戝ID
+ */
+ @ApiModelProperty("鍏ラ櫌绉戝ID")
+ @Excel(name = "鍏ラ櫌绉戝ID")
+ private String admissDeptId;
+
+ /**
+ * 鍏ラ櫌绉戝鍚嶇О
+ */
+ @ApiModelProperty("鍏ラ櫌绉戝鍚嶇О")
+ @Excel(name = "鍏ラ櫌绉戝鍚嶇О")
+ private String admissDeptName;
+
+ /**
+ * 鍏ラ櫌搴婁綅Id
+ */
+ @ApiModelProperty("鍏ラ櫌搴婁綅Id")
+ @Excel(name = "鍏ラ櫌搴婁綅Id")
+ private String admissBedId;
+
+ /**
+ * 鍏ラ櫌搴婁綅搴忓彿
+ */
+ @ApiModelProperty("鍏ラ櫌搴婁綅搴忓彿")
+ @Excel(name = "鍏ラ櫌搴婁綅搴忓彿")
+ private String admissBedNo;
+
+ /**
+ * 褰撳墠鐥呭尯ID
+ */
+ @ApiModelProperty("褰撳墠鐥呭尯ID")
+ @Excel(name = "褰撳墠鐥呭尯ID")
+ private String currWardId;
+
+ /**
+ * 褰撳墠鐥呭尯ID
+ */
+ @ApiModelProperty("褰撳墠鐥呭尯ID")
+ @Excel(name = "褰撳墠鐥呭尯ID")
+ private String currWardCode;
+
+ /**
+ * 褰撳墠鐥呭尯鍚嶇О
+ */
+ @ApiModelProperty("褰撳墠鐥呭尯鍚嶇О")
+ @Excel(name = "褰撳墠鐥呭尯鍚嶇О")
+ private String currWardName;
+
+ /**
+ * 褰撳墠绉戝ID
+ */
+ @ApiModelProperty("褰撳墠绉戝ID")
+ @Excel(name = "褰撳墠绉戝ID")
+ private String currDeptId;
+
+ /**
+ * 褰撳墠绉戝鍚嶇О
+ */
+ @ApiModelProperty("褰撳墠绉戝鍚嶇О")
+ @Excel(name = "褰撳墠绉戝鍚嶇О")
+ private String currDeptName;
+
+ /**
+ * 褰撳墠搴婁綅搴忓彿
+ */
+ @ApiModelProperty("褰撳墠搴婁綅搴忓彿")
+ @Excel(name = "褰撳墠搴婁綅搴忓彿")
+ private String currBedNo1;
+
+ /**
+ * 褰撳墠搴婁綅ID
+ */
+ @ApiModelProperty("褰撳墠搴婁綅ID")
+ @Excel(name = "褰撳墠搴婁綅ID")
+ private String currBedId;
+
+ /**
+ * 浣忛櫌鍙�
+ */
+ @ApiModelProperty("浣忛櫌鍙�")
+ @Excel(name = "浣忛櫌鍙�")
+ private String inpatientId;
+
+ /**
+ * 搴婂彿
+ */
+ @ApiModelProperty("搴婂彿")
+ @Excel(name = "搴婂彿")
+ private String currBedNo;
+
+ /**
+ * 鍏ラ櫌鏃堕棿
+ */
+ @ApiModelProperty("鍏ラ櫌鏃堕棿")
+ @Excel(name = "鍏ラ櫌鏃堕棿")
+ private String admissDate;
+
+ /**
+ * 寮�鍗曞尰鐢�
+ */
+ @ApiModelProperty("寮�鍗曞尰鐢�")
+ @Excel(name = "寮�鍗曞尰鐢�")
+ private String DocName;
+
+ /**
+ * 涓绘不鍖诲笀
+ */
+ @ApiModelProperty("涓绘不鍖诲笀")
+ @Excel(name = "涓绘不鍖诲笀")
+ private String doctName;
+ /**
+ * 涓绘不鍖诲笀
+ */
+ @ApiModelProperty("涓绘不鍖诲笀")
+ @Excel(name = "涓绘不鍖诲笀")
+ private String doctId;
+
+ /**
+ * 璇婃柇ID
+ */
+ @ApiModelProperty("璇婃柇ID")
+ @Excel(name = "璇婃柇ID")
+ private String diagId;
+
+ /**
+ * 璇婃柇ICD10鐮�
+ */
+ @ApiModelProperty("璇婃柇ICD10鐮�")
+ @Excel(name = "璇婃柇ICD10鐮�")
+ private String diagIcd10;
+
+
+ /**
+ * 璇婃柇鍚嶇О
+ */
+ @ApiModelProperty("璇婃柇鍚嶇О")
+ @Excel(name = "璇婃柇鍚嶇О")
+ private String diagName;
+ /**
+ * 鑱旂郴浜�
+ */
+ @ApiModelProperty("鑱旂郴鍦板潃")
+ @Excel(name = "鑱旂郴鍦板潃")
+ private String contactPersonAddr;
+ /**
+ * 鑱旂郴浜�
+ */
+ @ApiModelProperty("鑱旂郴浜�")
+ @Excel(name = "鑱旂郴浜�")
+ private String contactPersonName;
+
+ /**
+ * 鑱旂郴浜虹數璇�
+ */
+ @ApiModelProperty("鑱旂郴浜虹數璇�")
+ @Excel(name = "鑱旂郴浜虹數璇�")
+ private String contactPersonPhone;
+
+ /**
+ * 鏁版嵁绫诲瀷
+ */
+ @ApiModelProperty("鍥界睄")
+ @Excel(name = "鍥界睄")
+ private String PatiNationality;
+
+ private String NationalityAddr;
+
+ private String patiNatureId;
+
+ //骞撮緞
+ private String treateAge;
+ //骞撮緞鍗曚綅
+ private String treatAgeunit;
+ private String patiNatureName;
+
+
+ /**
+ * 鏁版嵁绫诲瀷
+ */
+ @ApiModelProperty("鍥界睄")
+ @Excel(name = "鍥界睄")
+ private String patNatureId;
+ private String PatNation;
+
+
+ /**
+ * 姘戞棌
+ */
+ @ApiModelProperty("姘戞棌")
+ @Excel(name = "姘戞棌")
+ private String patiNation;
+ /**
+ * 鏁版嵁绫诲瀷
+ */
+ @ApiModelProperty("鑱屼笟")
+ @Excel(name = "鑱屼笟")
+ private String ProfessionId;
+
+ /**
+ * 濠氬Щ鐘舵��
+ */
+ @ApiModelProperty("濠氬Щ鐘舵��")
+ @Excel(name = "濠氬Щ鐘舵��")
+ private String PatiMaritalStatus;
+
+ /**
+ * 鐜颁綇鍦板潃
+ */
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ @ApiModelProperty("鐜颁綇鍦板潃")
+ @Excel(name = "鐜颁綇鍦板潃")
+ private String patiHomeAddr;
+
+ private String patiHomePhone;
+
+ /**
+ * 鑱旂郴鐢佃瘽
+ */
+ @ApiModelProperty("鑱旂郴鐢佃瘽")
+ @Excel(name = "鑱旂郴鐢佃瘽")
+ private String companyTelNum;
+
+ /**
+ * 鏁版嵁绫诲瀷
+ */
+ @ApiModelProperty("鍑虹敓鏃ユ湡")
+ @Excel(name = "鍑虹敓鏃ユ湡")
+ private String patiBirthday;
+
+ /**
+ * 浣忛櫌娆℃暟
+ */
+ @ApiModelProperty("浣忛櫌娆℃暟")
+ @Excel(name = "浣忛櫌娆℃暟")
+ private String inhospitalTimes;
+
+ /**
+ * 鍑洪櫌鏂瑰紡搴忓彿
+ */
+ @ApiModelProperty("鍑洪櫌鏂瑰紡搴忓彿")
+ @Excel(name = "鍑洪櫌鏂瑰紡搴忓彿 1.娌绘剤 2.濂借浆 3.鏈剤 4.姝讳骸 5.鍏跺畠")
+ private String outWayId;
+
+ /**
+ * 鍑洪櫌鏂瑰紡鍚嶇О
+ */
+ @ApiModelProperty("鍑洪櫌鏂瑰紡鍚嶇О")
+ @Excel(name = "鍑洪櫌鏂瑰紡鍚嶇О")
+ private String outWayName;
+
+ /**
+ * 浣忛櫌鎬昏垂鐢�
+ */
+ @ApiModelProperty("浣忛櫌鎬昏垂鐢�")
+ @Excel(name = "浣忛櫌鎬昏垂鐢�")
+ private String totalAmount;
+
+ /**
+ * 棰勫鍑洪櫌鏃ユ湡
+ */
+ @ApiModelProperty("棰勫鍑洪櫌鏃ユ湡")
+ @Excel(name = "棰勫鍑洪櫌鏃ユ湡")
+ private String preoutDate;
+
+ /**
+ * 缁撹处鏃ユ湡
+ */
+ @ApiModelProperty("缁撹处鏃ユ湡")
+ @Excel(name = "缁撹处鏃ユ湡")
+ private String cashDate;
+
+ /**
+ * 鐥呬汉鍑洪櫌鏃ユ湡
+ */
+ @ApiModelProperty("鐥呬汉鍑洪櫌鏃ユ湡")
+ @Excel(name = "鐥呬汉鍑洪櫌鏃ユ湡")
+ private String outDate;
+ private String RelationShip;
+
+
+}
+
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospCheckInfo.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospCheckInfo.java
new file mode 100644
index 0000000..59bf805
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospCheckInfo.java
@@ -0,0 +1,74 @@
+package com.ruoyi.datacollection.domain;
+
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * 绗笁鏂瑰巶鍟嗛棬璇婃鏌ヤ俊鎭�
+ *
+ * @author ruoyi
+ * @date 2024-9-02
+ */
+@Data
+@ApiModel("绗笁鏂瑰巶鍟嗛棬璇婁俊鎭�")
+public class ThiedOutHospCheckInfo {
+
+ private String hospitalId;// 闄㈠尯ID
+ private String patIndex;// 鐥呬汉涓荤储寮�
+ private String patId;// 浣忛櫌ID
+ private String patNo;// 浣忛櫌鍙�
+ private String reqCard;// 鐢宠鍗曞彿
+ private String patType;// 鐥呬汉绫诲瀷
+ private String patName;// 鐥呬汉濮撳悕
+ private String patSex;// 鎬у埆
+ private String patBirth;// 鍑虹敓鏃ユ湡
+ private String patAge;// 鐥呬汉骞撮緞
+ private String patAgeUnit;// 鐥呬汉骞撮緞鍗曚綅
+ private String chargeType;// 鏀惰垂绫诲瀷浠g爜
+ private String patDiag;// 涓村簥璇婃柇
+ private String patDiagIcd;// 璇婃柇ICD10浠g爜
+ private String patAddress;// 鐥呬汉鑱旂郴鍦板潃
+ private String patNation;// 鐥呬汉鍥界睄
+ private String patIdCardNo;// 鐥呬汉韬唤璇佸彿
+ private String patPhone;// 鐥呬汉鑱旂郴鐢佃瘽
+ private String patHeight;// 鐥呬汉韬珮
+ private String patWeight;// 鐥呬汉浣撻噸
+ private String patWardId;//鐥呬汉鐥呭尯ID
+ private String patWardName;// 鐥呬汉鐥呭尯鍚嶇О
+ private String patDeptId;// 鐥呬汉绉戝ID
+ private String patDeptName;//鐥呬汉绉戝鍚嶇О
+ private String patBedNo;// 搴婂彿
+ private String reqDeptId;// 寮�鍗曠瀹D
+ private String reqDeptName;//;// 寮�鍗曠瀹ゅ悕绉�
+ private String reqDocId;// 鐢宠鍖荤敓ID
+ private String reqDocName;// 鐢宠鍖荤敓濮撳悕
+ private String reqDocComm;// 鍖荤敓澶囨敞
+ private String staffNum;// 鐢宠鍖荤敓宸ュ彿
+ private String reqTime;// 鐢宠鏃堕棿
+ private String printUser;// 鎵撳嵃鑰�
+ private String printTime;// 鎵撳嵃鏃堕棿
+ private String sampleUser;// 閲囨牱鑰�
+ private String sampleTime;// 閲囨牱鏃堕棿
+ private String sendUsder;// 浜ゆ帴鎶ゅ+
+ private String sendTime;// 绉讳氦缁欐姢澹椂闂�
+ private String emerFlag;// 鍔犳�ユ爣蹇�
+ private String sampleTypeId;// 鏍囨湰绫诲瀷ID
+ private String sampleType;// 鏍囨湰绫诲瀷鍚嶇О
+ private String performDeptID;// 鎵ц绉戝ID
+ private String performDeptName;// 鎵ц绉戝鍚嶇О
+ private String requestId;// 鐢宠鍗曞敮涓�ID
+ private String reqItemCode;// 鐢宠椤圭洰浠g爜
+ private String reqItemName;// 鐢宠椤圭洰鍚嶇О
+ private String itemPrice;// 鐢宠椤圭洰鍗曚环
+ private String qty;// 鐢宠椤圭洰鏁伴噺
+ private String chargeFlag;// 璁′环鏍囧織
+ private String detailId;// 鐢宠鏄庣粏鍞竴ID
+ private String itemTypeCode;// 璇婄枟椤圭洰鍒嗙被
+ private String itemClassCode;// 璇婄枟椤圭洰澶х被
+ private String orderId;// 鐥呬汉鍖诲槺ID
+ private String admissTimes;// 浣忛櫌娆℃暟
+ private String entryTime;// 鍏ラ櫌鏃堕棿
+
+}
+
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospInfo.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospInfo.java
new file mode 100644
index 0000000..33beb76
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/domain/ThiedOutHospInfo.java
@@ -0,0 +1,121 @@
+package com.ruoyi.datacollection.domain;
+
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * 绗笁鏂瑰巶鍟嗛棬璇婁俊鎭�
+ *
+ * @author ruoyi
+ * @date 2024-9-02
+ */
+@Data
+@ApiModel("绗笁鏂瑰巶鍟嗛棬璇婁俊鎭�")
+public class ThiedOutHospInfo {
+
+ private String del; //鍒犻櫎鏍囧織
+ private String creator; // 鍒涘缓鑰�
+ private String createTime; //鍒涘缓鏃堕棿
+ private String updater; // 鏇存柊鑰�
+ private String updateTime;//鏇存柊鏃堕棿
+ private String treatID; // 鐥呬汉灏辫瘖搴忓彿
+ private String orgCode;//缁勭粐鏈烘瀯浠g爜
+ private String orgName;//缁勭粐鏈烘瀯鍚嶇О
+ private String treatDate;// 鐥呬汉灏辫瘖鏃ユ湡
+ private String departmentID;// 灏辫瘖绉戝浠g爜
+ private String hisDepartmentID;// 灏辫瘖绉戝浠g爜
+ private String departmentName;// 灏辫瘖绉戝鍚嶇О
+ private String doctorID;// 灏辫瘖鍖荤敓搴忓彿
+ private String doctorNum;//灏辫瘖鍖荤敓宸ュ彿
+ private String hisDoctorID;//灏辫瘖鍖荤敓搴忓彿
+ private String doctorName;// 灏辫瘖鍖荤敓鍚嶇О
+ private String patiRecordID;//鐥呬汉妗f搴忓彿
+ private String patiMediaID;// 鐥呬汉浠嬭川搴忓彿
+ private String patiMediaNum;// 鐥呬汉浠嬭川鍙风爜
+ private String patiTypeID;// 鐥呬汉绫诲埆搴忓彿
+ private String patiTypeName;// 鐥呬汉绫诲埆鍚嶇О
+ private String patiNatureID;// 鐥呬汉鎬ц川搴忓彿
+ private String patiNatureName;// 鐥呬汉鎬ц川鍚嶇О
+ private String patiName;// 鐥呬汉妗f濮撳悕
+ private String patiIndex;// 鐥呬汉涓荤储寮�
+ private String patiAge;// 灏辫瘖鐥呬汉骞撮緞
+ private String patiAgeUnit;// 鐥呬汉骞撮緞鍗曚綅
+ private String patiBirthday;// 鐥呬汉鍑虹敓鏃ユ湡
+ private String patiAddr;// 鐥呬汉浣忓潃
+ private String patiPhone;// 鐥呬汉鑱旂郴鐢佃瘽
+ private String patiSex;// 鐥呬汉妗f鎬у埆
+ private String patiIDCardno;// 鐥呬汉韬唤璇佸彿
+ private String patiSourceID;//鐥呬汉鏉ユ簮id
+ private String patiSource;//鐥呬汉鏉ユ簮
+ private String patiCompany;// 鐥呬汉鍗曚綅
+ private String specialPati;// 鐗规畩鐥呬汉绫诲瀷
+ private String treatStatus;// 鐥呬汉灏辫瘖鐘舵��
+ private String treatTimes;// 鐥呬汉灏辫瘖娆℃暟
+ private String visitFlag;// 鍒濊瘖澶嶈瘖鍒ゅ埆
+ private String regID;// 鎸傚彿璁板綍搴忓彿
+ private String goType;// 鐥呬汉灏辫瘖鍘诲悜
+ private String attackDate;// 鐥呬汉鍙戠梾鏃ユ湡
+ private String treatBeginDate;//灏辫瘖寮�濮嬫椂闂�
+ private String treatEndDate;// 灏辫瘖缁撴潫鏃堕棿
+ private String relateTreatID;// 瀵瑰簲灏辫瘖搴忓彿
+ private String treatChangeID;// 灏辫瘖鍙樺姩搴忓彿
+ private String infectious;// 浼犳煋鐥呯鍒ゅ埆
+ private String settleID;//缁撶畻绫诲埆搴忓彿
+ private String settleName;// 缁撶畻绫诲埆鍚嶇О
+ private String specialRemark;// 鐗规畩鐥呯
+ private String cycleID;//璇婄枟鍛ㄦ湡缂栫爜
+ private String transferID;// 杞瘖璁板綍搴忓彿
+ private String depositID;// 鐥呬汉浜ゆ搴忓彿
+ private String systemID;//绯荤粺妯″潡搴忓彿
+ private String operateType;//鎺ヨ瘖鎿嶄綔绫诲埆
+ private String emergency;//鏄惁鎬ヨ瘖鍒ゅ埆
+ private String emergencyRegisterID;// 鎬ヨ瘖鐧昏搴忓彿
+ private String doctorGroupID;// 鍖荤敓缁勫彿搴忓彿
+ private String doctorGroupName;//鍖荤敓缁勫彿鍚嶇О
+ private String interTreatID;//鎺ュ彛灏辫瘖搴忓彿
+ private String summaryTimes;//灏辫瘖灏忕粨娆℃暟
+ private String transportation;//浜ら�氬伐鍏�
+ private String evaluation;//璇勪及鍊�
+ private String diagIcd10;//璇婃柇ICD10
+ private String diagName;//璇婃柇鍚嶇О
+ private String nationCode;//姘戞棌缂栫爜
+ private String nation;//姘戞棌
+ private String citizenshipCode;//鍥界睄缂栫爜
+ private String citizenship;//鍥界睄
+ private String livingAddressCode;// 鐜颁綇鍧�缂栫爜
+ private String livingAddress;// 鐜颁綇鍧�
+ private String occupationCode;//浜虹兢鍒嗙被浠g爜
+ private String occupation;// 浜虹兢鍒嗙被
+ private String idcardTypeCode;// 璇佷欢绫诲瀷缂栫爜
+ private String idcardType;// 璇佷欢绫诲瀷
+ private String domicileCode;// 鎴风睄绫诲瀷缂栫爜
+ private String domicile;// 鎴风睄绫诲瀷
+ private String domicileAddressCode;// 鎴风睄缂栫爜
+ private String domicileAddress;// 鎴风睄
+ private String domicileAdrressDetails;// 鎴风睄璇︾粏鍦板潃
+ private String contacts;// 鑱旂郴浜�
+ private String contactsTel;// 鑱旂郴浜虹數璇�
+ private String mrCompletion;// 鐥呭巻瀹屾垚搴﹀瓧娈�
+ private String mrPrintFlag;// 鐥呭巻鎵撳嵃鏍囧織
+ private String syncFlag;// 灏辫瘖璁板綍鍚屾鏍囧織
+ private String patiHeight;// 韬珮
+ private String patiHeightUnit;// 韬珮鍗曚綅
+ private String patiWeight;// 浣撻噸
+ private String patiWeightUnit;// 浣撻噸鍗曚綅
+ private String zs;// 涓昏瘔
+ private String xbs;// 鐜扮梾鍙�
+ private String jws;// 鏃㈠線鍙�
+ private String breathe;// 鍛煎惛
+ private String breatheUnit;// 鍛煎惛鍗曚綅
+ private String ssy;// 鏀剁缉鍘�
+ private String ssyUnit;// 鏀剁缉鍘嬪崟浣�
+ private String szy;// 鑸掑紶鍘�
+ private String szyUnit;// 鑸掑紶鍘嬪崟浣�
+ private String temperature;// 浣撴俯
+ private String temperatureUnit;// 浣撴俯鍗曚綅
+ private String fzjc;// 杈呭姪妫�鏌�
+ private String tgjc;// 浣撴牸妫�鏌�
+
+}
+
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/HNGatherPatArchiveMapper.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/HNGatherPatArchiveMapper.java
new file mode 100644
index 0000000..37840cb
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/HNGatherPatArchiveMapper.java
@@ -0,0 +1,103 @@
+package com.ruoyi.datacollection.mapper;
+
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.entity.SysUserDept;
+import com.ruoyi.common.core.domain.entity.SysUserRole;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.outpatientvisit.domain.PatMedOuthosp;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.PatArchive;
+import com.ruoyi.common.core.domain.entity.Icd10;
+
+/**
+ * 娌冲崡閲囬泦鎮h�呬俊鎭疢apper鎺ュ彛
+ *
+ * @author smartor
+ * @date 2025-07-09
+ */
+@DataSource(value = DataSourceType.SLAVE)
+@Mapper
+public interface HNGatherPatArchiveMapper {
+
+ /**
+ * 鏌ヨ鎮h�呮。妗堝垪琛�
+ *
+ * @param patArchive 鎮h�呮。妗�
+ * @return 鎮h�呮。妗堥泦鍚�
+ */
+ public List<PatArchive> selectPatArchiveList(PatArchive patArchive);
+
+ /**
+ * 鐢ㄦ埛涓庤鑹蹭俊鎭�
+ *
+ * @param sysUser
+ * @return
+ */
+ public SysUserRole yhyjsxx(SysUser sysUser);
+
+ /**
+ * 鐢ㄦ埛涓庣瀹や俊鎭�
+ *
+ * @param sysUser
+ * @return
+ */
+ public SysUserDept yhyksxx(SysUser sysUser);
+
+ /**
+ * 鍑哄叆闄俊鎭�
+ *
+ * @param patMedInhosp
+ * @return
+ */
+ public List<PatMedInhosp> selectPatMedInhospList(PatMedInhosp patMedInhosp);
+
+ public Long selectPatMedInhospListCount(PatMedInhosp patMedInhosp);
+
+ List<PatArchive> selectPatArchiveListByLastId(@Param("lastRowNumber") long lastRowNumber, @Param("ps") int ps);
+
+ List<PatMedInhosp> selectPatMedInhospListByLastId(@Param("lastRowNumber") long lastRowNumber, @Param("ps") int ps);
+
+ public Long selectPatArchiveCount(PatMedInhosp patMedInhosp);
+
+ /**
+ * 闂ㄦ�ヨ瘖淇℃伅
+ *
+ * @param patMedOuthosp
+ * @return
+ */
+ public List<PatMedOuthosp> selectPatMedOuthospList(PatMedOuthosp patMedOuthosp);
+
+
+ /**
+ * /**
+ * 鏌ヨ鐤剧梾鍒楄〃
+ *
+ * @param icd10 鐤剧梾
+ * @return 鐤剧梾闆嗗悎
+ */
+ public List<Icd10> selectIcd10List(Icd10 icd10);
+
+ /**
+ * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鐢ㄦ埛鍒楄〃
+ *
+ * @param sysUser 鐢ㄦ埛淇℃伅
+ * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅
+ */
+ public List<SysUser> selectUserList(SysUser sysUser);
+
+ /**
+ * 鏌ヨ閮ㄩ棬绠$悊鏁版嵁
+ *
+ * @param dept 閮ㄩ棬淇℃伅
+ * @return 閮ㄩ棬淇℃伅闆嗗悎
+ */
+ public List<SysDept> selectDeptList(SysDept dept);
+
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/ServiceAppointRecordMapper.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/ServiceAppointRecordMapper.java
new file mode 100644
index 0000000..170ecff
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/mapper/ServiceAppointRecordMapper.java
@@ -0,0 +1,63 @@
+package com.ruoyi.datacollection.mapper;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import com.ruoyi.datacollection.domain.ServiceAppointRecord;
+
+/**
+ * 棰勭害璁板綍Mapper鎺ュ彛
+ *
+ * @author lihu
+ * @date 2026-07-06
+ */
+@Mapper
+public interface ServiceAppointRecordMapper
+{
+ /**
+ * 鏌ヨ棰勭害璁板綍
+ *
+ * @param id 棰勭害璁板綍涓婚敭
+ * @return 棰勭害璁板綍
+ */
+ public ServiceAppointRecord selectServiceAppointRecordById(Long id);
+
+ /**
+ * 鏌ヨ棰勭害璁板綍鍒楄〃
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 棰勭害璁板綍闆嗗悎
+ */
+ public List<ServiceAppointRecord> selectServiceAppointRecordList(ServiceAppointRecord serviceAppointRecord);
+
+ /**
+ * 鏂板棰勭害璁板綍
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 缁撴灉
+ */
+ public int insertServiceAppointRecord(ServiceAppointRecord serviceAppointRecord);
+
+ /**
+ * 淇敼棰勭害璁板綍
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 缁撴灉
+ */
+ public int updateServiceAppointRecord(ServiceAppointRecord serviceAppointRecord);
+
+ /**
+ * 鍒犻櫎棰勭害璁板綍
+ *
+ * @param id 棰勭害璁板綍涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteServiceAppointRecordById(Long id);
+
+ /**
+ * 鎵归噺鍒犻櫎棰勭害璁板綍
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteServiceAppointRecordByIds(Long[] ids);
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHNGatherPatArchiveService.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHNGatherPatArchiveService.java
new file mode 100644
index 0000000..1018036
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHNGatherPatArchiveService.java
@@ -0,0 +1,79 @@
+package com.ruoyi.datacollection.service;
+
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.outpatientvisit.domain.PatMedOuthosp;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.PatArchive;
+import com.ruoyi.common.core.domain.entity.Icd10;
+import com.ruoyi.datacollection.domain.HnDataGatherVO;
+
+/**
+ * 娌冲崡閲囬泦鎮h�呬俊鎭帴鍙�
+ *
+ * @author smartor
+ * @date 2023-03-04
+ */
+public interface IHNGatherPatArchiveService {
+
+ /**
+ * 鏌ヨ鎮h�呮。妗堝垪琛�
+ *
+ * @param patArchive 鎮h�呮。妗�
+ * @return 鎮h�呮。妗堥泦鍚�
+ */
+ public List<PatArchive> selectPatArchiveList(PatArchive patArchive);
+
+ /**
+ * 鍑哄叆闄俊鎭�
+ *
+ * @param patMedInhosp
+ * @return
+ */
+ public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp);
+
+ /**
+ * 娌冲崡鏁版嵁閲囬泦
+ *
+ * @param patMedInhosp
+ * @return
+ */
+ public Boolean hnDataGather(HnDataGatherVO patMedInhosp);
+
+ /**
+ * 闂ㄦ�ヨ瘖淇℃伅
+ *
+ * @param patMedOuthosp
+ * @return
+ */
+ public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp);
+
+
+ /**
+ * 鏌ヨ鐤剧梾鍒楄〃
+ *
+ * @param icd10 鐤剧梾
+ * @return 鐤剧梾闆嗗悎
+ */
+ public Integer selectIcd10List(Icd10 icd10);
+
+ /**
+ * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鐢ㄦ埛鍒楄〃
+ *
+ * @param sysUser 鐢ㄦ埛淇℃伅
+ * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅
+ */
+ public Integer selectUserList(SysUser sysUser);
+
+ /**
+ * 鏌ヨ閮ㄩ棬绠$悊鏁版嵁
+ *
+ * @param dept 閮ㄩ棬淇℃伅
+ * @return 閮ㄩ棬淇℃伅闆嗗悎
+ */
+ public Integer selectDeptList(SysDept dept);
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceAppointRecordService.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceAppointRecordService.java
new file mode 100644
index 0000000..d32c270
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceAppointRecordService.java
@@ -0,0 +1,61 @@
+package com.ruoyi.datacollection.service;
+
+import java.util.List;
+import com.ruoyi.datacollection.domain.ServiceAppointRecord;
+
+/**
+ * 棰勭害璁板綍Service鎺ュ彛
+ *
+ * @author lihu
+ * @date 2026-07-06
+ */
+public interface IServiceAppointRecordService
+{
+ /**
+ * 鏌ヨ棰勭害璁板綍
+ *
+ * @param id 棰勭害璁板綍涓婚敭
+ * @return 棰勭害璁板綍
+ */
+ public ServiceAppointRecord selectServiceAppointRecordById(Long id);
+
+ /**
+ * 鏌ヨ棰勭害璁板綍鍒楄〃
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 棰勭害璁板綍闆嗗悎
+ */
+ public List<ServiceAppointRecord> selectServiceAppointRecordList(ServiceAppointRecord serviceAppointRecord);
+
+ /**
+ * 鏂板棰勭害璁板綍
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 缁撴灉
+ */
+ public int insertServiceAppointRecord(ServiceAppointRecord serviceAppointRecord);
+
+ /**
+ * 淇敼棰勭害璁板綍
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 缁撴灉
+ */
+ public int updateServiceAppointRecord(ServiceAppointRecord serviceAppointRecord);
+
+ /**
+ * 鎵归噺鍒犻櫎棰勭害璁板綍
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑棰勭害璁板綍涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteServiceAppointRecordByIds(Long[] ids);
+
+ /**
+ * 鍒犻櫎棰勭害璁板綍淇℃伅
+ *
+ * @param id 棰勭害璁板綍涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteServiceAppointRecordById(Long id);
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceSLTDHealthcareRecordService.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceSLTDHealthcareRecordService.java
new file mode 100644
index 0000000..85b7fa1
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IServiceSLTDHealthcareRecordService.java
@@ -0,0 +1,102 @@
+package com.ruoyi.datacollection.service;
+
+import afu.org.checkerframework.checker.oigj.qual.O;
+import com.ruoyi.common.core.service.dto.InhospPositionRecord;
+import com.ruoyi.common.core.domain.entity.MedicationItem;
+import com.ruoyi.datacollection.domain.ServiceSLTDDeptReqVO;
+import com.ruoyi.datacollection.domain.ServiceSLTDInhospReqVO;
+import com.ruoyi.datacollection.domain.ServiceSLTDInhospResDTO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鐪佺珛鍚屽痉鍋ュ悍璁板綍鏌ヨService鎺ュ彛
+ *
+ * @author smartor
+ * @date 2025-08-14
+ */
+public interface IServiceSLTDHealthcareRecordService {
+
+ /**
+ * 閲囬泦鍦ㄩ櫌鎮h�呭嚭鍏ラ櫌銆侀棬鎬ヨ瘖淇℃伅
+ *
+ * @param reqVO 鏌ヨ璇锋眰鍙傛暟
+ * @return 鍋ュ悍璁板綍鍒楄〃
+ * 鍙傝��
+ * {
+ * "orgId": 20001001,
+ * "campusIds": 30001002,
+ * "startHeadTime":"2025-08-14",
+ * "startTailTime":"2025-08-14",
+ * "healthcareRecordTypeList":["FH0108.01"],
+ * "subjectCode": null,
+ * "healthcareRecordNo":null,
+ * "orgSubjectCode": null,
+ * "deptDimensions": null,
+ * "serviceScopes": null,
+ * "inpatientArea": null,
+ * "status": null
+ * }
+ */
+ List<ServiceSLTDInhospResDTO> queryHealthcareRecordList(ServiceSLTDInhospReqVO reqVO);
+
+ /**
+ * 閲囬泦鍦ㄩ櫌鎮h�呯敤鑽俊鎭�
+ *
+ * @param reqVO 鏌ヨ璇锋眰鍙傛暟
+ * @return 瀹為檯鑾峰彇鍒扮殑鑽搧鏁版嵁鏉℃暟
+ */
+ Integer queryMedicationItemList(ServiceSLTDInhospReqVO reqVO);
+
+ /**
+ * 閲囬泦鍖婚櫌鐢ㄦ埛淇℃伅
+ *
+ * @param reqVO
+ * @return 鍙傝��
+ * {
+ * "orgId": 20001001,
+ * "campusId": 30001002,
+ * "unitIds": null,
+ * "relationType": null,
+ * "searchText": null,
+ * "status": 1
+ * }
+ */
+ Boolean queryHospUserInfoList(ServiceSLTDInhospReqVO reqVO);
+
+ /**
+ * 閲囬泦绉戝鐥呭尯淇℃伅
+ *
+ * @param serviceSLTDDeptReqVO
+ * @return 鍙傝��
+ * {
+ * "orgId": 20001001,
+ * "campusIds": 30001002,
+ * "unitIds": null,
+ * "relationType": null,
+ * "searchText": null,
+ * "status": 1
+ * }
+ */
+ Boolean queryDeptWardAreaInfoList(ServiceSLTDDeptReqVO serviceSLTDDeptReqVO);
+
+ /**
+ * 鏌ヨ鍗曚釜鍦ㄩ櫌鎮h�呯殑<b>褰撳墠</b>绉戝 / 鐥呭尯 / 搴婁綅
+ * 锛堜笌鍏ラ櫌閲囬泦鍚屼竴涓帴鍙� {@code dtcQueryHealthcareRecordList}锛岀敤 {@code healthcareRecordNo} 鍗曟煡锛夈��
+ * <p>
+ * 鈿狅笍 <b>鍙彇鏁帮紝涓嶈惤搴�</b>锛氱敱璋冪敤鏂癸紙鏁版嵁閲囬泦妯″潡鐨�"鍦ㄩ櫌淇℃伅鍒锋柊"锛夎嚜宸变笌
+ * {@code pat_med_inhosp} 姣斿銆傚彇鏁板け璐ワ紙鏃犲搷搴� / 闈� 200锛�<b>鎶� RuntimeException</b>锛�
+ * 涓嶇敤绌哄垪琛ㄥ啋鍏�"璇ユ偅鑰呭凡涓嶅湪闄�"銆�
+ * <p>
+ * 鍏ュ弬绾﹀畾锛歿@code orgId} + {@code campusId} + {@code statusList=["FH0109.24"]} +
+ * {@code healthcareRecordNo}銆倇@code statusList} 鐢� HIS 渚ц繃婊ゆ帀宸插嚭闄�/棰勫嚭闄㈢殑璁板綍锛�
+ * 鍥犳<b>杩斿洖绌哄垪琛ㄥ嵆琛ㄧず"褰撳墠涓嶅湪鍏ラ櫌鐘舵��"</b>銆�
+ *
+ * @param reqVO 瑙佷笂
+ * @return 褰撳墠浣嶇疆璁板綍锛涚┖鍒楄〃 = 璇ユ偅鑰呭綋鍓嶄笉鍦�"鍏ラ櫌"鐘舵��
+ */
+ List<InhospPositionRecord> queryInhospPosition(ServiceSLTDInhospReqVO reqVO);
+
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IXHGatherPatArchiveService.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IXHGatherPatArchiveService.java
new file mode 100644
index 0000000..4e20ba6
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IXHGatherPatArchiveService.java
@@ -0,0 +1,31 @@
+package com.ruoyi.datacollection.service;
+
+import java.time.LocalDateTime;
+
+/**
+ * 娌冲崡閲囬泦鎮h�呬俊鎭帴鍙�
+ *
+ * @author smartor
+ * @date 2023-03-04
+ */
+public interface IXHGatherPatArchiveService {
+
+ /**
+ * 娌冲崡鏁版嵁閲囬泦
+ *
+ * @param patMedInhosp
+ * @return
+ */
+ public void getInHospDataGather(String cry, LocalDateTime startTime, LocalDateTime endTime);
+
+ /**
+ * 鑾峰彇棰勭害鍋滆瘖璁板綍淇℃伅
+ *
+ * @param cry 鍑哄叆闄㈢被鍨嬶細0-鍏ラ櫌锛�1-鍑洪櫌 2,棰勭害璁板綍
+ * @param startTime 寮�濮嬫椂闂�
+ * @param endTime 缁撴潫鏃堕棿
+ */
+ public void getAppointRecordInfo(String cry, LocalDateTime startTime, LocalDateTime endTime);
+
+
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HNGatherPatArchiveServiceImpl.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HNGatherPatArchiveServiceImpl.java
new file mode 100644
index 0000000..ea6cd3a
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HNGatherPatArchiveServiceImpl.java
@@ -0,0 +1,295 @@
+package com.ruoyi.datacollection.service.impl;
+
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.entity.SysUserDept;
+import com.ruoyi.common.core.domain.entity.SysUserRole;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.outpatientvisit.domain.PatMedOuthosp;
+import com.ruoyi.inhospvisit.api.InhospVisitFacade;
+import com.ruoyi.outpatientvisit.api.OuthospDataFacade;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
+import com.ruoyi.outpatientvisit.mapper.PatMedOuthospMapper;
+import com.ruoyi.datacollection.service.IHNGatherPatArchiveService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.*;
+import com.ruoyi.common.core.domain.entity.PatArchive;
+import com.ruoyi.patarchive.mapper.PatArchiveMapper;
+import com.ruoyi.common.core.domain.entity.Icd10;
+import com.ruoyi.common.mapper.Icd10Mapper;
+import com.ruoyi.system.mapper.ext.SysUser2Mapper;
+import com.ruoyi.system.mapper.ext.SysUserRole2Mapper;
+import com.ruoyi.system.mapper.ext.SysDept2Mapper;
+import com.ruoyi.system.mapper.ext.SysUserDeptMapper;
+import com.ruoyi.patarchive.mapper.ShardingMapper;
+import com.ruoyi.datacollection.mapper.HNGatherPatArchiveMapper;
+import com.ruoyi.datacollection.domain.HnDataGatherVO;
+
+/**
+ * 鎮h�呮。妗圫ervice涓氬姟灞傚鐞�
+ *
+ * @author smartor
+ * @date 2023-03-04
+ */
+@Slf4j
+@Service
+public class HNGatherPatArchiveServiceImpl implements IHNGatherPatArchiveService {
+ @Autowired
+ private HNGatherPatArchiveMapper hnGatherPatArchiveMapper;
+
+ @Autowired
+ private SysUser2Mapper sysUser2Mapper;
+
+ @Autowired
+ private SysUserRole2Mapper sysUserRoleMapper;
+
+ @Autowired
+ private SysDept2Mapper sysDept2Mapper;
+
+ @Autowired
+ private SysUserDeptMapper sysUserDeptMapper;
+
+ @Autowired
+ private Icd10Mapper icd10Mapper;
+
+ @Autowired
+ private PatMedOuthospMapper patMedOuthospMapper;
+
+ @Autowired
+ private InhospVisitFacade inhospVisitFacade;
+
+ @Autowired
+ private PatArchiveMapper patArchiveMapper;
+
+ @Autowired
+ private OuthospDataFacade outhospDataFacade;
+
+ @Autowired
+ private ShardingMapper shardingMapper;
+
+ private static final long SHARDING_THRESHOLD = 5_000_000L;
+ private static final String PAT_ARCHIVE_TABLE = "pat_archive";
+ private static final String PAT_MED_INHOSP_TABLE = "pat_med_inhosp";
+
+
+ @Override
+ public List<PatArchive> selectPatArchiveList(PatArchive patArchive) {
+ return hnGatherPatArchiveMapper.selectPatArchiveList(patArchive);
+ }
+
+// @Override
+// public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) {
+// // 寮傛鎵ц鏁翠釜鏁版嵁鍚屾浠诲姟
+// taskExecutor.execute(() -> {
+// log.info("寮�濮嬫墽琛屾暟鎹悓姝ヤ换鍔�...");
+// syncPatArchivesInOrder(); // 鍏堝悓姝ユ偅鑰�
+// syncPatMedInhosp(); // 鍐嶅悓姝ュ嚭鍏ラ櫌
+// log.info("鏁版嵁鍚屾浠诲姟鎻愪氦瀹屾瘯銆�");
+// });
+// return 0; // 杩斿洖0琛ㄧず浠诲姟宸叉彁浜ゅ埌鍚庡彴鎵ц
+// }
+
+
+ @Override
+ public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) {
+ List<PatMedInhosp> patMedInhospList = hnGatherPatArchiveMapper.selectPatMedInhospList(patMedInhosp);
+ for (PatMedInhosp pm : patMedInhospList) {
+ PatArchive patArchive = new PatArchive();
+ patArchive.setPatientno(pm.getPatno());
+ List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive);
+ if (CollectionUtils.isEmpty(patArchives)) {
+ //绌轰簡鐩存帴涓㈡帀
+ continue;
+ }
+ PatArchive pa = new PatArchive();
+ pa.setPatientno(patArchives.get(0).getPatientno());
+ List<PatArchive> patArchives1 = patArchiveMapper.selectPatArchiveList(pa);
+ if (CollectionUtils.isNotEmpty(patArchives1)) {
+ pm.setPatid(patArchives1.get(0).getId());
+ } else {
+ patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
+ pm.setPatid(patArchives.get(0).getId());
+ }
+ if (!Objects.isNull(patMedInhosp.getStartInHospTime()) && !Objects.isNull(patMedInhosp.getEndInHospTime())) {
+ //鍏ラ櫌
+ pm.setInhospstate("0");
+ pm.setCreateTime(new Date());
+ inhospVisitFacade.insertPatMedInhosp(pm);
+ } else if (!Objects.isNull(patMedInhosp.getStartOutHospTime()) && !Objects.isNull(patMedInhosp.getEndOutHospTime())) {
+ //鍑洪櫌
+ pm.setInhospstate("1");
+ pm.setUpdateTime(new Date());
+ PatMedInhosp pmi = new PatMedInhosp();
+ pmi.setSerialnum(pm.getSerialnum());
+ List<PatMedInhosp> patMedInhospList1 = inhospVisitFacade.selectPatMedInhospList(pmi);
+ if (CollectionUtils.isEmpty(patMedInhospList1)) {
+ pm.setCreateTime(new Date());
+ inhospVisitFacade.insertPatMedInhosp(pm);
+ } else {
+ pm.setInhospid(patMedInhospList1.get(0).getInhospid());
+ inhospVisitFacade.updatePatMedInhosp(pm);
+ }
+
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public Boolean hnDataGather(HnDataGatherVO hnDataGatherVO) {
+
+ LocalDate startDate = hnDataGatherVO.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+ LocalDate endDate = hnDataGatherVO.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+
+ Integer po = null;
+ // 寰幆澶勭悊姣忎竴澶�
+ for (LocalDate currentDate = startDate; !currentDate.isAfter(endDate); currentDate = currentDate.plusDays(1)) {
+ PatMedInhosp dailyCondition = new PatMedInhosp();
+ //澶勭悊鍏ラ櫌
+ LocalDateTime dayStart = currentDate.atStartOfDay();
+ LocalDateTime dayEnd = currentDate.atTime(23, 59, 59);
+ dailyCondition.setStartInHospTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant()));
+ dailyCondition.setEndInHospTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant()));
+ selectPatMedInhospList(dailyCondition);
+
+ //澶勭悊鍑洪櫌
+ dailyCondition.setStartInHospTime(null);
+ dailyCondition.setEndInHospTime(null);
+ dailyCondition.setStartOutHospTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant()));
+ dailyCondition.setEndOutHospTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant()));
+ selectPatMedInhospList(dailyCondition);
+
+ //澶勭悊闂ㄨ瘖
+ PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
+ patMedOuthosp.setBeginTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant()));
+ patMedOuthosp.setEndTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant()));
+ selectPatMedOuthospList(patMedOuthosp);
+ }
+ return true;
+ }
+
+
+ @Override
+ public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) {
+ List<PatMedOuthosp> patMedOuthosps = hnGatherPatArchiveMapper.selectPatMedOuthospList(patMedOuthosp);
+ log.info("selectPatMedOuthospList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", patMedOuthosps.size());
+ Integer i = null;
+ for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) {
+ //鑾峰彇鎮h�呭熀鏈俊鎭�
+ PatArchive patArchive = new PatArchive();
+ patArchive.setPatientno(patMedOuthosp1.getPatno());
+ List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive);
+
+ //鏍规嵁patno鍒ゆ柇鏈湴鎮h�呭熀鏈俊鎭槸鍚﹀瓨鍦�
+ PatArchive pa = new PatArchive();
+ pa.setPatientno(patMedOuthosp1.getPatno());
+ List<PatArchive> patArchives1 = patArchiveMapper.selectPatArchiveList(pa);
+ if (CollectionUtils.isNotEmpty(patArchives1)) {
+ patMedOuthosp1.setPatid(patArchives1.get(0).getId());
+ } else {
+ if (CollectionUtils.isEmpty(patArchives)) {
+ continue;
+ }
+ patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
+ patMedOuthosp1.setPatid(patArchives.get(0).getId());
+ }
+ i = outhospDataFacade.insert(patMedOuthosp1);
+ }
+
+ return i;
+ }
+
+ @Override
+ public Integer selectIcd10List(Icd10 icd10) {
+ List<Icd10> icd10s = hnGatherPatArchiveMapper.selectIcd10List(icd10);
+ log.info("selectIcd10List鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", icd10s.size());
+ int i = icd10Mapper.batchIcd10(icd10s);
+ return i;
+ }
+
+ @Override
+ public Integer selectUserList(SysUser sysUser) {
+ List<SysUser> sysUserList = hnGatherPatArchiveMapper.selectUserList(sysUser);
+ if (CollectionUtils.isEmpty(sysUserList)) return null;
+
+
+ log.info("sysUserList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", sysUserList.size());
+ int i = sysUser2Mapper.batchUser(sysUserList);
+ for (SysUser sysUser1 : sysUserList) {
+ log.info("sysUser1鐨処D涓猴細{}", sysUser1.getUserId());
+ log.info("sysUser1鐨凥ISUSERID涓猴細{}", sysUser1.getHisUserId());
+ //鏂板鐢ㄦ埛涓庤鑹�
+ SysUserRole yhyjsxx = hnGatherPatArchiveMapper.yhyjsxx(sysUser1);
+ if (yhyjsxx == null) continue;
+ yhyjsxx.setUserId(sysUser1.getUserId());
+ List<SysUserRole> userRoleList = new ArrayList<>();
+ userRoleList.add(yhyjsxx);
+ sysUserRoleMapper.batchUserRole(userRoleList);
+
+ //鏂板鐢ㄦ埛涓庨儴闂�
+ if (StringUtils.isEmpty(sysUser1.getHisUserId())) continue;
+ SysUserDept sysUserDept = hnGatherPatArchiveMapper.yhyksxx(sysUser1);
+ if (Objects.isNull(sysUserDept) || sysUserDept.getDeptId() == null) continue;
+ SysDept dept = new SysDept();
+ dept.setHisDeptId(sysUserDept.getDeptId().toString());
+ List<SysDept> sysDepts = sysDept2Mapper.selectDeptList(dept);
+ if (CollectionUtils.isNotEmpty(sysDepts)) {
+ sysUserDept.setDeptId(sysDepts.get(0).getDeptId());
+ sysUserDept.setDeptCode(sysDepts.get(0).getDeptCode());
+ }
+ sysUserDept.setUserId(sysUser1.getUserId());
+ sysUserDeptMapper.insertSysUserDept(sysUserDept);
+
+ }
+
+ return i;
+ }
+
+ @Override
+ public Integer selectDeptList(SysDept dept) {
+ List<SysDept> sysDepts = hnGatherPatArchiveMapper.selectDeptList(dept);
+ log.info("selectDeptList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", sysDepts.size());
+ int i = 0;
+ if (CollectionUtils.isNotEmpty(sysDepts)) i = sysDept2Mapper.batchDept(sysDepts);
+ return i;
+ }
+
+
+ /**
+ * 妫�鏌ュ苟鎵ц鍒嗚〃鐨勬牳蹇冩柟娉�
+ *
+ * @param tableName 瑕佹鏌ョ殑琛ㄥ悕
+ */
+ private synchronized void checkAndShard(String tableName) {
+ long currentCount = shardingMapper.getTableCount(tableName);
+
+ if (currentCount >= SHARDING_THRESHOLD) {
+ log.warn("琛� '{}' 宸茶揪鍒板垎琛ㄩ槇鍊� {}锛屽噯澶囨墽琛屽垎琛ㄦ搷浣�...", tableName, SHARDING_THRESHOLD);
+
+ String newTableName = tableName + "_" + java.time.LocalDate.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyy_MM"));
+ Long maxId = shardingMapper.getMaxId(tableName);
+ if (maxId == null) maxId = 0L;
+
+ shardingMapper.renameTable(tableName, newTableName);
+ log.info("宸插皢琛� '{}' 閲嶅懡鍚嶄负 '{}'", tableName, newTableName);
+
+ shardingMapper.createLikeTable(tableName, newTableName);
+ log.info("宸插垱寤烘柊琛� '{}'", tableName);
+
+ shardingMapper.setAutoIncrement(tableName, maxId + 1);
+ log.info("宸茶缃柊琛� '{}' 鐨勮嚜澧濱D璧峰鍊间负 {}", tableName, maxId + 1);
+
+ log.info("琛� '{}' 鐨勫垎琛ㄦ搷浣滃畬鎴愶紒", tableName);
+ }
+ }
+}
+
+
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceAppointRecordServiceImpl.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceAppointRecordServiceImpl.java
new file mode 100644
index 0000000..9188a7b
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceAppointRecordServiceImpl.java
@@ -0,0 +1,96 @@
+package com.ruoyi.datacollection.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.datacollection.mapper.ServiceAppointRecordMapper;
+import com.ruoyi.datacollection.domain.ServiceAppointRecord;
+import com.ruoyi.datacollection.service.IServiceAppointRecordService;
+
+/**
+ * 棰勭害璁板綍Service涓氬姟灞傚鐞�
+ *
+ * @author lihu
+ * @date 2026-07-06
+ */
+@Service
+public class ServiceAppointRecordServiceImpl implements IServiceAppointRecordService
+{
+ @Autowired
+ private ServiceAppointRecordMapper serviceAppointRecordMapper;
+
+ /**
+ * 鏌ヨ棰勭害璁板綍
+ *
+ * @param id 棰勭害璁板綍涓婚敭
+ * @return 棰勭害璁板綍
+ */
+ @Override
+ public ServiceAppointRecord selectServiceAppointRecordById(Long id)
+ {
+ return serviceAppointRecordMapper.selectServiceAppointRecordById(id);
+ }
+
+ /**
+ * 鏌ヨ棰勭害璁板綍鍒楄〃
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 棰勭害璁板綍
+ */
+ @Override
+ public List<ServiceAppointRecord> selectServiceAppointRecordList(ServiceAppointRecord serviceAppointRecord)
+ {
+ return serviceAppointRecordMapper.selectServiceAppointRecordList(serviceAppointRecord);
+ }
+
+ /**
+ * 鏂板棰勭害璁板綍
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertServiceAppointRecord(ServiceAppointRecord serviceAppointRecord)
+ {
+ serviceAppointRecord.setCreateTime(DateUtils.getNowDate());
+ return serviceAppointRecordMapper.insertServiceAppointRecord(serviceAppointRecord);
+ }
+
+ /**
+ * 淇敼棰勭害璁板綍
+ *
+ * @param serviceAppointRecord 棰勭害璁板綍
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateServiceAppointRecord(ServiceAppointRecord serviceAppointRecord)
+ {
+ serviceAppointRecord.setUpdateTime(DateUtils.getNowDate());
+ return serviceAppointRecordMapper.updateServiceAppointRecord(serviceAppointRecord);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎棰勭害璁板綍
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑棰勭害璁板綍涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteServiceAppointRecordByIds(Long[] ids)
+ {
+ return serviceAppointRecordMapper.deleteServiceAppointRecordByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎棰勭害璁板綍淇℃伅
+ *
+ * @param id 棰勭害璁板綍涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteServiceAppointRecordById(Long id)
+ {
+ return serviceAppointRecordMapper.deleteServiceAppointRecordById(id);
+ }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
new file mode 100644
index 0000000..8db65bb
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -0,0 +1,1816 @@
+package com.ruoyi.datacollection.service.impl;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.entity.SysUserDept;
+import com.ruoyi.common.core.domain.entity.SysUserRole;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.core.service.dto.InhospPositionRecord;
+import com.ruoyi.common.enums.EmergencyLevelEnum;
+import com.ruoyi.common.enums.ImportFlagEnum;
+import com.ruoyi.common.utils.http.HttpUtils;
+import com.ruoyi.common.utils.DistinctByProperty;
+import com.ruoyi.outpatientvisit.domain.PatMedOuthospError;
+import com.ruoyi.outpatientvisit.domain.PatMedOuthosp;
+import com.ruoyi.inhospvisit.api.InhospVisitFacade;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
+import com.ruoyi.outpatientvisit.mapper.PatMedOuthospErrorMapper;
+import com.ruoyi.patarchive.service.IPatArchiveService;
+import com.ruoyi.datacollection.service.IServiceSLTDHealthcareRecordService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.stereotype.Service;
+
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import com.ruoyi.common.core.domain.entity.PatArchive;
+import com.ruoyi.task.domain.ServiceSubtask;
+import com.ruoyi.task.mapper.ServiceSubtaskMapper;
+import com.ruoyi.system.mapper.ext.SysUser2Mapper;
+import com.ruoyi.system.mapper.ext.SysUserRole2Mapper;
+import com.ruoyi.system.mapper.ext.SysDept2Mapper;
+import com.ruoyi.system.mapper.ext.SysUserDeptMapper;
+import com.ruoyi.common.core.domain.entity.MedicationItem;
+import com.ruoyi.common.core.domain.entity.MedicationDoseInfo;
+import com.ruoyi.common.mapper.MedicationItemMapper;
+import com.ruoyi.common.mapper.MedicationDoseInfoMapper;
+import com.ruoyi.datacollection.domain.ServiceSLTDContactsResDTO;
+import com.ruoyi.datacollection.domain.ServiceSLTDDeptReqVO;
+import com.ruoyi.datacollection.domain.ServiceSLTDDiagnosisResDTO;
+import com.ruoyi.datacollection.domain.ServiceSLTDInhospReqVO;
+import com.ruoyi.datacollection.domain.ServiceSLTDInhospResDTO;
+import com.ruoyi.outpatientvisit.api.OuthospDataFacade;
+
+@Slf4j
+@Service
+public class ServiceSLTDHealthcareRecordServiceImpl implements IServiceSLTDHealthcareRecordService {
+
+ private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+ /**
+ * 鍦ㄩ櫌鎮h�呭綋鍓嶄綅缃煡璇㈠湴鍧�锛堢綉鍏虫牴璺緞 {@code sltd_pub_path} + 鍥哄畾鍚庣紑锛夈��
+ * <p>
+ * 涓�"鍏ラ櫌閲囬泦"鏄�<b>鍚屼竴涓帴鍙�</b>锛坽@code queryHealthcareRecordList} 鐢ㄧ殑涔熸槸瀹冿級锛�
+ * 鍖哄埆鍙槸鏈柟娉曟寜 {@code healthcareRecordNo} 鍗曟煡銆佸彧鍙栦綅缃瓧娈点�佷笉钀藉簱銆�
+ */
+ private static final String INHOSP_POSITION_PATH =
+ "/osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcQueryHealthcareRecordList";
+
+ /**
+ * 褰撳墠浣嶇疆鏌ヨ鐨勮繛鎺�/璇昏秴鏃讹細涓�杞鎸夋偅鑰呰皟鐢ㄥ嚑鍗冩锛�
+ * 涓嶈兘璁╀竴娆℃棤鍝嶅簲鎶婇噰闆嗙嚎绋嬫棤闄愭湡鎸備綇锛坽@code HttpUtils} 鑰佹柟娉曟病鏈夎秴鏃讹級
+ */
+ private static final int INHOSP_POSITION_CONNECT_TIMEOUT_MS = 5000;
+
+ private static final int INHOSP_POSITION_READ_TIMEOUT_MS = 15000;
+
+ @Autowired
+ private IPatArchiveService patArchiveService;
+
+ @Autowired
+ private InhospVisitFacade inhospVisitFacade;
+
+ @Autowired
+ private OuthospDataFacade outhospDataFacade;
+
+ @Autowired
+ private SysUser2Mapper sysUser2Mapper;
+
+ @Autowired
+ private SysDept2Mapper sysDeptMapper;
+
+ @Autowired
+ private SysUserDeptMapper sysUserDeptMapper;
+
+ @Autowired
+ private SysUserRole2Mapper sysUserRoleMapper;
+
+ @Autowired
+ private MedicationItemMapper medicationItemMapper;
+
+ @Autowired
+ private MedicationDoseInfoMapper medicationDoseInfoMapper;
+
+ @Autowired
+ private RedisTemplate<String, String> redisTemplate;
+
+ @Value("${sltd_pub_path}")
+ private String sltdPubPath;
+
+ @Value("${userPwd}")
+ private String userPwd;
+
+ @Value("${lwl_app_key}")
+ private String APP_KEY;
+
+
+ @Value("${spring.profiles.active}")
+ private String active;
+ @Autowired
+ private ServiceSubtaskMapper serviceSubtaskMapper;
+
+ @Autowired
+ private PatMedOuthospErrorMapper patMedOuthospErrorMapper;
+
+ @Override
+ public List<ServiceSLTDInhospResDTO> queryHealthcareRecordList(ServiceSLTDInhospReqVO reqVO) {
+ try {
+ Map<String, Object> requestParams = buildRequestParams(reqVO);
+ Map<String, String> headers = buildRequestHeaders();
+ log.info("璇锋眰鍙傛暟鍑洪櫌鏁版嵁鍦板潃锛歿},appKey:{}", sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcQueryHealthcareRecordList", APP_KEY);
+ String result = null;
+ if (reqVO.getSize() == null && reqVO.getCurrent() == null)
+ result = HttpUtils.sendPostByHeader(sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcQueryHealthcareRecordList", new Gson().toJson(requestParams), headers);
+ else
+ result = HttpUtils.sendPostByHeader(sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcPageHealthcareRecordList", new Gson().toJson(requestParams), headers);
+ log.info("queryHealthcareRecordList--result杩斿洖鐨勭粨鏋滃�硷細{}", result == null ? "绌哄��" : "鏈夊��");
+
+ String cry = determineCry(reqVO);
+ log.info("cry鐨勫�间负锛歿}", cry);
+ List<ServiceSLTDInhospResDTO> serviceSLTDInhospResDTOS = parseResponseData(result, CollectionUtils.isNotEmpty(reqVO.getStatusList()) ? reqVO.getStatusList() : reqVO.getHealthcareRecordTypeList(), cry, reqVO.getCampusId() != null ? reqVO.getCampusId().toString() : null);
+ log.info("serviceSLTDInhospResDTOS鏄惁杩斿洖鐨勬湁鍊硷細{}", CollectionUtils.isNotEmpty(serviceSLTDInhospResDTOS) ? "鏈�" : "娌℃湁");
+ return serviceSLTDInhospResDTOS;
+ } catch (Exception e) {
+ log.error("銆恞ueryHealthcareRecordList銆戣皟鐢ㄧ渷绔嬪悓寰峰仴搴疯褰曟煡璇㈡帴鍙e紓甯革紝璇锋眰鍙傛暟锛歿}", reqVO, e);
+ throw new RuntimeException("璋冪敤鐪佺珛鍚屽痉鍋ュ悍璁板綍鏌ヨ鎺ュ彛澶辫触:" + e.getMessage());
+ }
+ }
+
+ @Override
+ /**
+ * 鏌ヨ鑽搧淇℃伅鍒楄〃
+ * @return 杩斿洖瀹為檯鑾峰彇鍒扮殑鑽搧鏁版嵁鏉℃暟锛屽鏋滃嚭閿欏垯杩斿洖 null
+ */ public Integer queryMedicationItemList(ServiceSLTDInhospReqVO reqVO) {
+ try {
+ Map<String, Object> requestParams = buildRequestParams(reqVO);
+ Map<String, String> headers = buildRequestHeaders();
+ log.info("璇锋眰鍙傝嵂鍝佷俊鎭湴鍧�锛歿},appKey:{}", sltdPubPath + "/hbos-thirdparty-integration/standard/base/mc/service/medication/queryMedicationInfoPage", APP_KEY);
+ String result = HttpUtils.sendPostByHeader(sltdPubPath + "/hbos-thirdparty-integration/standard/base/mc/service/medication/queryMedicationInfoPage", new Gson().toJson(requestParams), headers);
+ List<Map<String, Object>> dataList = getDataList(result, 2);
+ log.info("銆恞ueryMedicationItemList銆戝叡鑾峰彇鍒皗}鏉¤嵂鍝佹暟鎹�", dataList.size());
+ int successCount = 0;
+ int failCount = 0;
+ for (Map<String, Object> dataItem : dataList) {
+ try {
+ MedicationItem medicationItem = convertToMedication(dataItem);
+ log.info("鍑嗗鎻掑叆鑽搧鏁版嵁锛歩temName={}, itemCode={}", medicationItem.getItemName(), medicationItem.getItemCode());
+ medicationItem.setCreateTime(new Date());
+ medicationItemMapper.insertMedicationItem(medicationItem);
+
+ // 濡傛灉鎻掑叆鎴愬姛涓旇繑鍥炰簡鑷 ID锛屽垯鎻掑叆瀛愯〃
+ if (medicationItem.getId() != null) {
+ List<MedicationDoseInfo> doseInfoList = medicationItem.getDoseInfoList();
+ if (CollectionUtils.isNotEmpty(doseInfoList)) {
+ for (MedicationDoseInfo doseInfo : doseInfoList) {
+ try {
+ doseInfo.setMedicationItemId(medicationItem.getId());
+ medicationDoseInfoMapper.insertMedicationDoseInfo(doseInfo);
+ log.debug("鎻掑叆鍓傞噺淇℃伅鎴愬姛锛歩temId={}, doseUnit={}", medicationItem.getId(), doseInfo.getDoseUnit());
+ } catch (Exception e) {
+ log.warn("鎻掑叆鍓傞噺淇℃伅澶辫触锛歩temId={}, doseUnit={}, 閿欒:{}", medicationItem.getId(), doseInfo.getDoseUnit(), e.getMessage(), e);
+ failCount++;
+ }
+ }
+ }
+ }
+ successCount++;
+ log.info("鉁� 鑽搧鏁版嵁鎻掑叆鎴愬姛锛歿}", medicationItem.getItemName());
+ } catch (Exception e) {
+ log.warn("銆恞ueryMedicationItemList銆戝崟鏉¤嵂鍝佹暟鎹彃鍏ュけ璐ワ細itemName={}, itemCode={}, 閿欒:{}", dataItem.get("itemName"), dataItem.get("itemCode"), e.getMessage(), e);
+ failCount++;
+ // 缁х画澶勭悊涓嬩竴鏉℃暟鎹紝涓嶄腑鏂暣涓惊鐜�
+ }
+ }
+ log.info("銆恞ueryMedicationItemList銆戞壒閲忔彃鍏ュ畬鎴愶紝鎬绘暟:{}, 鎴愬姛:{}, 澶辫触:{}", dataList.size(), successCount, failCount);
+ // 杩斿洖瀹為檯鑾峰彇鍒扮殑鑽搧鏁版嵁鏉℃暟锛岀敤浜庡垎椤靛垽鏂槸鍚﹁繕鏈夋洿澶氭暟鎹�
+ return dataList.size();
+ } catch (Exception e) {
+ log.error("銆恞ueryMedicationItemList銆戣皟鐢ㄧ渷绔嬪悓寰疯嵂鍝佷俊鎭煡璇㈡帴鍙e紓甯革紝璇锋眰鍙傛暟锛歿}", reqVO, e);
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ /**
+ * 閲囬泦绉戝鐥呭尯淇℃伅
+ *
+ * @param serviceSLTDDeptReqVO
+ * @return 鍙傝��
+ * {
+ * "orgId": 20001001,
+ * "campusIds": 30001002,
+ * "unitIds": null,
+ * "relationType": null,
+ * "searchText": null,
+ * "status": 1
+ * }
+ */
+ @Override
+ public Boolean queryDeptWardAreaInfoList(ServiceSLTDDeptReqVO serviceSLTDDeptReqVO) {
+ log.info("銆恞ueryDeptWardAreaInfoList銆戝紑濮嬭皟鐢ㄧ渷绔嬪悓寰风瀹ょ梾鍖烘煡璇㈡帴鍙o紝璇锋眰鍙傛暟锛歿}", serviceSLTDDeptReqVO);
+ try {
+ Map<String, Object> params = new HashMap<>();
+ if (serviceSLTDDeptReqVO.getOrgId() != null) {
+ params.put("orgId", Long.parseLong(serviceSLTDDeptReqVO.getOrgId()));
+ }
+ if (serviceSLTDDeptReqVO.getCampusIds() != null) {
+ params.put("campusIds", serviceSLTDDeptReqVO.getCampusIds());
+ }
+ params.put("subjectCode", serviceSLTDDeptReqVO.getSubjectCode());
+ params.put("orgSubjectCode", serviceSLTDDeptReqVO.getOrgSubjectCode());
+
+ params.put("deptDimensions", serviceSLTDDeptReqVO.getDeptDimensions());
+
+ params.put("serviceScopes", serviceSLTDDeptReqVO.getServiceScopes());
+ params.put("inpatientArea", serviceSLTDDeptReqVO.getInpatientArea());
+ params.put("status", serviceSLTDDeptReqVO.getStatus());
+
+
+ Map<String, String> headers = buildRequestHeaders();
+ String result = HttpUtils.sendPostByHeader(sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/dept/queryDeptList", new Gson().toJson(params), headers);
+ log.info("銆恞ueryDeptWardAreaInfoList銆戞帴鍙e搷搴旂粨鏋滐細{}", StringUtils.isEmpty(result) ? "绌虹殑" : "涓嶇┖");
+ List<Map<String, Object>> dataList = getDataList(result, 1);
+ log.info("-----------dataList鎺ュ彛鍝嶅簲缁撴灉锛歿}", dataList.size());
+ for (Map<String, Object> dataItem : dataList) {
+ SysDept sysDept = new SysDept();
+ sysDept.setOrgid("" + getLongValue(dataItem, "orgId"));
+ sysDept.setCampusid("" + getLongValue(dataItem, "campusId"));
+ sysDept.setHisDeptId("" + getLongValue(dataItem, "deptId"));
+ sysDept.setHisParentId(getStringValue(dataItem, "parentDeptId"));
+ //閫氳繃his鐨勭埗绉戝ID鍘绘壘鍒扮瀹D,濉厖parentId
+ if (StringUtils.isNotEmpty(getStringValue(dataItem, "parentDeptId"))) {
+ SysDept sd = new SysDept();
+ sd.setHisDeptId(getStringValue(dataItem, "parentDeptId"));
+ sd.setOrgid(getStringValue(dataItem, "orgId"));
+ List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sd);
+ if (CollectionUtils.isNotEmpty(sysDepts)) {
+ SysDept sysDept1 = sysDepts.get(0);
+ sysDept.setParentId(sysDept1.getDeptId());
+ sysDept.setParentName(sysDept1.getDeptName());
+ }
+ }
+ sysDept.setDeptName(getStringValue(dataItem, "deptName"));
+ Integer inpatientArea = getIntegerValue(dataItem, "inpatientArea");
+ if (inpatientArea != null && inpatientArea == 0) sysDept.setDeptType("1");
+ else if (inpatientArea != null && inpatientArea == 1) sysDept.setDeptType("2");
+ sysDept.setLeader("");
+ Integer status = getIntegerValue(dataItem, "status");
+ if (status != null & status == 0) sysDept.setStatus("1");
+ if (status != null & status == 1) sysDept.setStatus("0");
+ sysDept.setType("");
+ sysDept.setDeptCode("" + getLongValue(dataItem, "deptId"));
+ sysDept.setCreateBy(null);
+ sysDept.setCreateTime(new Date());
+ sysDept.setUpdateTime(new Date());
+ sysDept.setUpdateBy(null);
+
+ // 鎸� deptCode + orgid + campusid 鏌ラ噸锛岄伩鍏嶈法闄㈠尯绉戝閲嶅
+ SysDept sysDept1 = sysDeptMapper.selectDeptByCodeAndCampus(sysDept.getDeptCode(), sysDept.getOrgid(), sysDept.getCampusid());
+ if (Objects.isNull(sysDept1)) {
+ try {
+ int i = sysDeptMapper.insertDept(sysDept);
+ log.info("ServiceExternalServiceImpl---addDeptInfo鏄惁鏂板鎴愬姛锛歿}", i);
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ log.warn("銆恞ueryDeptWardAreaInfoList銆戠瀹ゅ凡瀛樺湪(骞跺彂鎻掑叆)锛岃烦杩囷細deptCode={}, orgid={}, campusid={}", sysDept.getDeptCode(), sysDept.getOrgid(), sysDept.getCampusid());
+ }
+ } else {
+ sysDept.setDeptId(sysDept1.getDeptId());
+ int i = sysDeptMapper.updateDept(sysDept);
+ log.info("ServiceExternalServiceImpl---addDeptInfo鏄惁淇敼鎴愬姛04锛歿}", i);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+
+ /**
+ * 閲囬泦鍖婚櫌鐢ㄦ埛淇℃伅
+ *
+ * @param reqVO
+ * @return
+ */
+ @Override
+ public Boolean queryHospUserInfoList(ServiceSLTDInhospReqVO reqVO) {
+ Map<String, Object> requestParams = buildRequestParams(reqVO);
+ Map<String, String> headers = buildRequestHeaders();
+ String result = HttpUtils.sendPostByHeader(sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/staff/queryStaffList", new Gson().toJson(requestParams), headers);
+ log.info("銆恞ueryHealthcareRecordList銆戞帴鍙e搷搴旂粨鏋滄槸鍚︽湁鍊硷細{}", StringUtils.isEmpty(result) ? "娌″��" : "鏈夊��");
+ List<Map<String, Object>> dataList = getDataList(result, 1);
+ for (Map<String, Object> dataItem : dataList) {
+ SysUser sysUser = new SysUser();
+ if (StringUtils.isEmpty(getStringValue(dataItem, "accountNo"))) {
+ continue;
+ }
+ sysUser.setUserName(getStringValue(dataItem, "accountNo"));
+ sysUser.setNickName(getStringValue(dataItem, "name"));
+ List diagnosisObjList = (List<?>) dataItem.get("qualifications");
+ if (CollectionUtils.isNotEmpty(diagnosisObjList)) {
+ for (Object diagnosis : diagnosisObjList) {
+ if (diagnosis instanceof Map) {
+ Map<String, Object> diagnosisMap = (Map<String, Object>) diagnosis;
+ String professionalTitleName = getStringValue(diagnosisMap, "professionalTitleName");
+ if (professionalTitleName.contains("鍖诲笀")) {
+ sysUser.setUserType("鍖荤敓");
+ }
+ if (professionalTitleName.contains("鎶�")) {
+ sysUser.setUserType("鎶ゅ+");
+ }
+ sysUser.setTitle(getStringValue(diagnosisMap, "professionalTitleName"));
+ }
+ }
+ }
+ //濡傛灉鐢ㄦ埛鐨勬偅鑰呰寖鍥翠负绌猴紝鍒欓粯璁や负0
+ if (StringUtils.isEmpty(sysUser.getSearchscope())) sysUser.setSearchscope("0");
+ sysUser.setPhonenumber(getStringValue(dataItem, "telephone"));
+ sysUser.setUserCode(getStringValue(dataItem, "jobNumber"));
+ //璁剧疆鎬у埆
+ String genderName = getStringValue(dataItem, "genderName");
+ if ("鐢�".equals(genderName)) sysUser.setSex("0");
+ else if ("濂�".equals(genderName)) sysUser.setSex("1");
+ else sysUser.setSex("2");
+
+ sysUser.setCreateTime(new Date());
+ sysUser.setUpdateTime(new Date());
+ sysUser.setUpdateBy("admin");
+ sysUser.setCreateBy("admin");
+ sysUser.setOrgid("" + getLongValue(dataItem, "orgId"));
+ BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
+ sysUser.setPassword(passwordEncoder.encode(userPwd));
+ SysUser sysUser1 = sysUser2Mapper.selectUserByUserName(sysUser.getUserName());
+ if (ObjectUtils.isNotEmpty(sysUser1)) {
+ //宸插瓨鍦細鐢变汉宸ョ淮鎶ょ殑瀛楁鏄笉闇�瑕佹洿鏂扮殑锛宱rgid/campusid淇濈暀鍘熷�间笉瑕嗙洊
+ sysUser.setSearchscope(null);
+ sysUser.setPassword(null);
+ sysUser.setUserId(sysUser1.getUserId());
+ sysUser.setOrgid(null);
+ sysUser.setCampusid(null);
+ sysUser2Mapper.updateUser(sysUser);
+ } else {
+ try {
+ sysUser2Mapper.insertUser(sysUser);
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ //骞跺彂鎻掑叆鍦烘櫙锛氶噸鏂版煡璇㈣幏鍙栧凡瀛樺湪璁板綍锛岄伩鍏嶉噸澶�
+ log.warn("銆恞ueryHospUserInfoList銆戠敤鎴峰凡瀛樺湪(骞跺彂鎻掑叆)锛岃烦杩囷細userName={}", sysUser.getUserName());
+ SysUser existingUser = sysUser2Mapper.selectUserByUserName(sysUser.getUserName());
+ if (ObjectUtils.isNotEmpty(existingUser)) {
+ sysUser.setUserId(existingUser.getUserId());
+ }
+ }
+ }
+
+ // 澶勭悊鐢ㄦ埛涓庨儴闂ㄧ殑鍏崇郴
+ List businessDepts = (List<?>) dataItem.get("businessDepts");
+ if (CollectionUtils.isNotEmpty(businessDepts)) {
+ List<List<String>> deptInfoList = new ArrayList<>();
+ List<List<String>> hospInfoList = new ArrayList<>();
+ log.info("------businessDepts鏄惁鏈夊�硷細{}", businessDepts.size());
+ for (Object businessDept : businessDepts) {
+ if (businessDept instanceof Map) {
+ Map<String, Object> businessDeptMap = (Map<String, Object>) businessDept;
+ log.info("------businessDeptMap鏄惁鏈夊�硷細{}", businessDeptMap);
+ String hisDeptId = getStringValue(businessDeptMap, "deptId");
+ log.info("------hisDeptId鏄惁鏈夊�硷細{}, reqVO.getOrgId()鐨勫�间负:{}", hisDeptId, reqVO.getCampusId());
+ //鍦ㄨ繖閲岋紝hisDeptId灏辨槸deptCode锛屾寜闄㈠尯+鏈烘瀯鏌ョ瀹わ紝閬垮厤璺ㄩ櫌鍖烘煡閿�
+ SysDept sysDept = sysDeptMapper.selectDeptByCodeAndCampus(hisDeptId, reqVO.getOrgId(), reqVO.getCampusId() != null ? reqVO.getCampusId().toString() : null);
+ log.info("------hisDeptId鏄惁鏈夊�硷細{}, reqVO.getCampusId()鐨勫�间负:{}", hisDeptId, reqVO.getCampusId());
+ if (Objects.isNull(sysDept)) continue;
+ SysUserDept sysUserDept = new SysUserDept();
+ sysUserDept.setUserId(sysUser.getUserId());
+ sysUserDept.setDeptType(sysDept.getDeptType());
+ sysUserDept.setDeptId(sysDept.getDeptId());
+ sysUserDept.setDeptCode(sysDept.getDeptCode());
+ sysUserDept.setDeptName(sysDept.getDeptName());
+ sysUserDept.setOrgid(sysDept.getOrgid());
+ sysUserDept.setCreateTime(new Date());
+ sysUserDept.setDelFlag(0L);
+
+ //鍒ゆ柇涓�涓嬬敤鎴�-閮ㄩ棬鍏崇郴鏄笉鏄凡缁忓瓨鍦ㄤ簡锛堟棤璁烘柊鐢ㄦ埛杩樻槸鑰佺敤鎴烽兘闇�瑕佸幓閲嶏級
+ if (ObjectUtils.isNotEmpty(sysUser.getUserId()) && ObjectUtils.isNotEmpty(sysDept)) {
+ SysUserDept sud = new SysUserDept();
+ sud.setUserId(sysUser.getUserId());
+ sud.setDeptId(sysDept.getDeptId());
+ sud.setOrgid(sysDept.getOrgid());
+ List<SysUserDept> sysUserDepts = sysUserDeptMapper.selectSysUserDeptList(sud);
+ if (CollectionUtils.isNotEmpty(sysUserDepts)) {
+ sysUserDept.setId(sysUserDepts.get(0).getId());
+ sysUserDeptMapper.updateSysUserDept(sysUserDept);
+ } else {
+ sysUserDeptMapper.insertSysUserDept(sysUserDept);
+ }
+ }
+ if (StringUtils.isNotEmpty(sysDept.getDeptType()) && sysDept.getDeptType().equals("1")) {
+ hospInfoList.add(Arrays.asList(sysDept.getDeptCode()));
+ } else if (StringUtils.isNotEmpty(sysDept.getDeptType()) && sysDept.getDeptType().equals("2")) {
+ deptInfoList.add(Arrays.asList(sysDept.getDeptCode()));
+ }
+ }
+ }
+ //灏嗛儴闂ㄦ垜鐥呭尯鏀惧埌鎸囧畾瀛楁涓�
+ Gson gson = new Gson();
+ sysUser.setHospInfo(gson.toJson(hospInfoList));
+ sysUser.setDeptInfo(gson.toJson(deptInfoList));
+ sysUser2Mapper.updateUser(sysUser);
+ }
+
+ //璁剧疆涓�涓粯璁よ鑹诧紙鍖荤敓瑙掕壊锛�
+ List<SysUserRole> userRoleList = new ArrayList();
+ SysUserRole sur = new SysUserRole();
+ sur.setUserId(sysUser.getUserId());
+ sur.setRoleId(4L);
+ sur.setOrgid(sysUser.getOrgid());
+
+ //鍏堟煡璇竴涓嬶紝鏄惁瀛樺湪
+ SysUserRole sysUserRole = sysUserRoleMapper.selectUserRoleByRoleIdAndUserId(4L, sysUser.getUserId());
+ if (ObjectUtils.isNotEmpty(sysUserRole)) continue;
+
+ userRoleList.add(sur);
+ sysUserRoleMapper.batchUserRole(userRoleList);
+ }
+
+ return true;
+ }
+
+ @Override
+ public List<InhospPositionRecord> queryInhospPosition(ServiceSLTDInhospReqVO reqVO) {
+ // 涓�"鍏ラ櫌閲囬泦"鍏辩敤鍚屼竴濂楀叆鍙傛瀯閫狅細orgId + campusIds + statusList + healthcareRecordNo
+ Map<String, Object> requestParams = buildRequestParams(reqVO);
+ Map<String, String> headers = buildRequestHeaders();
+ String url = sltdPubPath + INHOSP_POSITION_PATH;
+ String result = HttpUtils.sendPostByHeader(url, new Gson().toJson(requestParams), headers,
+ INHOSP_POSITION_CONNECT_TIMEOUT_MS, INHOSP_POSITION_READ_TIMEOUT_MS);
+ if (StringUtils.isEmpty(result)) {
+ // sendPostByHeader 鎶婂紓甯稿悶鎺夊悗杩斿洖绌轰覆锛氳繖閲岀粷涓嶈兘褰撴垚"璇ユ偅鑰呭凡涓嶅湪闄�"锛�
+ // 鍚﹀垯鎺ュ彛鏁翠綋涓嶅彲鐢ㄦ椂浼氳璁版垚"鍑犲崈涓偅鑰呴兘鍑洪櫌浜�"锛屼笌鐪熺浉鍙嶃��
+ throw new RuntimeException("鏌ヨ鍦ㄩ櫌鎮h�呭綋鍓嶄綅缃帴鍙f棤鍝嶅簲锛宧ealthcareRecordNo=" + reqVO.getHealthcareRecordNo());
+ }
+ // getDataList 鍦ㄨ繑鍥炵爜闈� 200 鏃舵姏 RuntimeException锛沝ata 涓� []锛堣鎮h�呭凡涓嶅湪鍏ラ櫌鐘舵�侊級鏃惰繑鍥炵┖鍒楄〃
+ List<Map<String, Object>> dataList = getDataList(result, 1);
+ List<InhospPositionRecord> records = new ArrayList<>(dataList.size());
+ for (Map<String, Object> dataItem : dataList) {
+ records.add(convertToInhospPosition(dataItem));
+ }
+ return records;
+ }
+
+ /**
+ * 鍋ュ悍璁板綍 JSON 鈫� 濂戠害 DTO 鐨勯�愬瓧娈垫惉杩愶紙鍙彇"褰撳墠浣嶇疆"瑕佺敤鐨勫瓧娈碉級銆�
+ * <p>
+ * 涓�寰嬭蛋 {@code getStringValue} / {@code getLongValue}锛氭帴鍙e绌哄�煎彲鑳借繑鍥� {@code null}銆�
+ * {@code ""} 鐢氳嚦缂哄瓧娈碉紝鐩存帴璁� Gson 鍙嶅簭鍒楀寲鍒� Long 瀛楁浼氬湪绌轰覆涓婃姏 NumberFormatException銆�
+ */
+ private InhospPositionRecord convertToInhospPosition(Map<String, Object> dataItem) {
+ InhospPositionRecord record = new InhospPositionRecord();
+ record.setHealthcareRecordNo(getStringValue(dataItem, "healthcareRecordNo"));
+ record.setPatientName(getStringValue(dataItem, "patientName"));
+ record.setDeptId(getLongValue(dataItem, "deptId"));
+ record.setDeptName(getStringValue(dataItem, "deptName"));
+ record.setAreaId(getLongValue(dataItem, "areaId"));
+ record.setAreaName(getStringValue(dataItem, "areaName"));
+ record.setBedNumber(getStringValue(dataItem, "bedNumber"));
+ record.setHealthcareRecordStatus(getStringValue(dataItem, "healthcareRecordStatus"));
+ return record;
+ }
+
+ private String determineCry(ServiceSLTDInhospReqVO reqVO) {
+ if (CollectionUtils.isEmpty(reqVO.getStatusList()) && CollectionUtils.isEmpty(reqVO.getHealthcareRecordTypeList()))
+ return null;
+ if (reqVO.getStatusList() != null) {
+ if (reqVO.getStatusList().contains("FH0109.24")) {
+ //鍏ラ櫌
+ return "0";
+ } else if (reqVO.getStatusList().contains("FH0109.27")) {
+ //鍑洪櫌
+ return "1";
+ } else if (reqVO.getStatusList().contains("FH0109.22") || reqVO.getStatusList().contains("FH0109.23") || reqVO.getStatusList().contains("FH0109.53")) {
+ //棰勫叆闄�
+ return "3";
+ }
+ }
+ if (reqVO.getHealthcareRecordTypeList() != null) {
+ if (reqVO.getHealthcareRecordTypeList().contains("FH0108.03") || reqVO.getHealthcareRecordTypeList().contains("FH0108.01")) {
+ //闂ㄦ�ヨ瘖
+ return "4";
+ }
+ }
+ return null;
+ }
+
+ private Map<String, Object> buildRequestParams(ServiceSLTDInhospReqVO reqVO) {
+ Map<String, Object> params = new HashMap<>();
+ if (reqVO.getOrgId() != null) {
+ params.put("orgId", Long.parseLong(reqVO.getOrgId()));
+ }
+ if (reqVO.getCampusId() != null) {
+ params.put("campusIds", reqVO.getCampusId());
+ }
+ if (reqVO.getStartHeadTime() != null) {
+ params.put("startHeadTime", reqVO.getStartHeadTime());
+ }
+ if (reqVO.getStartTailTime() != null) {
+ params.put("startTailTime", reqVO.getStartTailTime());
+ }
+ if (reqVO.getEncounterTimeStart() != null) {
+ params.put("encounterTimeStart", reqVO.getEncounterTimeStart());
+ }
+ if (reqVO.getEncounterTimeEnd() != null) {
+ params.put("encounterTimeEnd", reqVO.getEncounterTimeEnd());
+ }
+ if (reqVO.getPreOutHospitalHeadDate() != null) {
+ params.put("preOutHospitalHeadDate", reqVO.getPreOutHospitalHeadDate());
+ }
+ if (reqVO.getPreOutHospitalTailDate() != null) {
+ params.put("preOutHospitalTailDate", reqVO.getPreOutHospitalTailDate());
+ }
+ if (reqVO.getHealthcareRecordTypeList() != null && !reqVO.getHealthcareRecordTypeList().isEmpty()) {
+ params.put("healthcareRecordTypeList", reqVO.getHealthcareRecordTypeList());
+ }
+ if (reqVO.getStatusList() != null && !reqVO.getStatusList().isEmpty()) {
+ params.put("statusList", reqVO.getStatusList());
+ }
+ params.put("subjectCode", reqVO.getPatientName());
+ params.put("healthcareRecordNo", reqVO.getHealthcareRecordNo());
+ params.put("orgSubjectCode", reqVO.getIdCardNo());
+ if (reqVO.getDeptIdList() != null && !reqVO.getDeptIdList().isEmpty()) {
+ params.put("deptDimensions", reqVO.getDeptIdList());
+ }
+ params.put("serviceScopes", null);
+ params.put("inpatientArea", null);
+// params.put("status", reqVO.getStatusList() != null && !reqVO.getStatusList().isEmpty() ? reqVO.getStatusList().get(0) : null);
+ params.put("status", null);
+ // 鍒嗛〉鍙傛暟锛堥棬鎬ヨ瘖鍒嗛〉閲囬泦鏃朵娇鐢級
+ if (reqVO.getCurrent() != null) {
+ params.put("current", reqVO.getCurrent());
+ }
+ if (reqVO.getSize() != null) {
+ params.put("size", reqVO.getSize());
+ }
+ return params;
+ }
+
+ private Map<String, String> buildRequestHeaders() {
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Content-Type", "application/json");
+ headers.put("app-key", APP_KEY);
+ return headers;
+ }
+
+ private List<ServiceSLTDInhospResDTO> parseResponseData(String result, List<String> types, String cry, String campusId) {
+ try {
+ List<Map<String, Object>> dataList = getDataList(result, cry.equals("4") ? 2 : 1);
+ log.info("銆恜arseResponseData銆戞垚鍔熻В鏋恉ataList:{}鏉″仴搴疯褰曟暟鎹�", dataList.size());
+ if (dataList.size() >= 1500) {
+ // 鏉ユ湭鏉ユ帴鍙e崟娆′笂闄� 1500 鏉★細鍒拌繖閲岃鏄庢湰椤靛緢鍙兘宸茶鎴柇銆�
+ // 閲囬泦缂栨帓浼氭寜杩斿洖鏉℃暟浜屽垎閲嶉噰锛岃繖閲岀暀涓�鏉� error 渚夸簬浜嬪悗鏍稿
+ log.error("銆恜arseResponseData銆戞帴鍙e崟娆¤繑鍥炲凡杈� 1500 鏉′笂闄愶紝鏁版嵁鍙兘琚埅鏂細cry={}锛宼ypes={}", cry, types);
+ }
+ List<ServiceSLTDInhospResDTO> resultList = new ArrayList<>();
+ for (Map<String, Object> dataItem : dataList) {
+ try {
+ resultList.add(convertToDTO(dataItem));
+ } catch (Exception e) {
+ // 鍗曟潯鏁版嵁杞崲澶辫触涓嶅啀璁╂暣椤靛け璐ワ細鍐欓敊璇〃浜ょ粰浜哄伐澶勭悊锛屽叾浣欒褰曠収甯稿叆搴�
+ saveOuthospError(dataItem, "CONVERT", e.getMessage(), new Gson().toJson(dataItem), e);
+ }
+ }
+ log.info("銆恜arseResponseData銆戞垚鍔熻В鏋恟esultList:{}鏉″仴搴疯褰曟暟鎹�", resultList.size());
+
+ processResultList(resultList, types, cry, campusId);
+ return resultList;
+ } catch (Exception e) {
+ log.error("銆恜arseResponseData銆戣В鏋愬搷搴旀暟鎹紓甯革紝鍝嶅簲鍐呭锛歿}", result, e);
+ throw new RuntimeException("瑙f瀽鍝嶅簲鏁版嵁澶辫触", e);
+ }
+ }
+
+ /**
+ * 瑙f瀽鎺ュ彛杩斿洖鏁版嵁
+ *
+ * @param result 鎺ュ彛杩斿洖鏁版嵁
+ * @param flag 1浠h〃锛屾暟缁勫湪data閲岋紝2浠h〃鏁扮粍鍦╠ata/records閲�
+ * @return 瑙f瀽鍚庣殑鏁版嵁鍒楄〃
+ */
+
+ public List<Map<String, Object>> getDataList(String result, Integer flag) {
+ Gson gson = new Gson();
+ Type mapType = new TypeToken<Map<String, Object>>() {
+ }.getType();
+ Map<String, Object> responseMap = gson.fromJson(result, mapType);
+ log.info("銆恜arseResponseData銆戞帴鍙h繑鍥炴暟鎹殑responseMap锛歿}", Objects.isNull(responseMap) ? "绌虹殑" : "鏈夊��");
+ Number codeNum = (Number) responseMap.get("code");
+ String code = BigDecimal.valueOf(codeNum.longValue()).toPlainString();
+ if (StringUtils.isEmpty(code) || !code.equals("200")) {
+ log.error("銆恜arseResponseData銆戞帴鍙h繑鍥炲け璐ワ紝鍝嶅簲鐮侊細{}锛屽搷搴斿唴瀹癸細{}", code, result);
+ throw new RuntimeException("鎺ュ彛璋冪敤澶辫触锛屽搷搴旂爜锛�" + code);
+ }
+
+ Object dataObj = responseMap.get("data");
+ if (flag == 1) {
+ dataObj = responseMap.get("data");
+ } else if (flag == 2) {
+ //闂ㄦ�ヨ瘖鐨勫垎椤垫暟鎹槸鍦╮ecords涓�
+ dataObj = ((Map<String, Object>) responseMap.get("data")).get("records");
+ log.info("銆恜arseResponseData銆戞帴鍙h繑鍥炴暟鎹殑dataObj锛歿}", Objects.isNull(dataObj) ? "绌虹殑" : "鏈夊��");
+ }
+ if (dataObj == null) {
+ log.info("銆恜arseResponseData銆戞帴鍙h繑鍥炴暟鎹负绌�");
+ return new ArrayList<>();
+ }
+
+ // 鍏煎data涓烘暟缁勬垨瀵硅薄涓ょ鎯呭喌锛氭帴鍙f甯告椂data涓篬{...}]鏁扮粍锛�
+ // 寮傚父鎴栫┖鏁版嵁鏃跺彲鑳借繑鍥瀧}瀵硅薄锛岀洿鎺ユ寜List瑙f瀽浼氭姏JsonSyntaxException
+ List<Map<String, Object>> dataList;
+ if (dataObj instanceof List) {
+ String dataJson = gson.toJson(dataObj);
+ Type listType = new TypeToken<List<Map<String, Object>>>() {
+ }.getType();
+ dataList = gson.fromJson(dataJson, listType);
+ } else {
+ log.info("銆恜arseResponseData銆戞帴鍙h繑鍥瀌ata涓嶆槸鏁扮粍锛岃�屾槸瀵硅薄绫诲瀷锛宒ata鍐呭锛歿}", gson.toJson(dataObj));
+ return new ArrayList<>();
+ }
+
+ // 浣跨敤 Set 鍘婚噸锛岀‘淇濇病鏈夐噸澶嶇殑鏁版嵁
+ Set<Map<String, Object>> uniqueDataSet = new HashSet<>(dataList);
+ dataList = new ArrayList<>(uniqueDataSet);
+ return dataList;
+ }
+
+ private void processResultList(List<ServiceSLTDInhospResDTO> resultList, List<String> types, String cry, String campusId) {
+ // 闂ㄨ瘖(FH0108.01)鍜屾�ヨ瘖(FH0108.03)鍦ㄤ笟鍔′笂鏄悓涓�绫绘暟鎹紝鍏辩敤鍚屼竴涓� resultList銆�
+ // 鑻� types 鍚屾椂鍖呭惈涓よ�咃紝outHospitalDate 浼氳璋冪敤涓ゆ瀵艰嚧閲嶅鍏ュ簱銆�
+ // 鍥犳鍙 types 涓惈鏈変换鎰忎竴涓棬鎬ヨ瘖绫诲瀷锛屽氨鍙鐞嗕竴娆°��
+ boolean outpProcessed = false;
+ for (String type : types) {
+ switch (type) {
+ case "FH0108.01":
+ case "FH0108.03":
+ if (!outpProcessed) {
+ log.info("銆恜arseResponseData銆戣В鏋愰棬鎬ヨ瘖鏁版嵁锛宼ypes={}", types);
+ outHospitalDate(resultList);
+ outpProcessed = true;
+ } else {
+ log.info("銆恜arseResponseData銆戦棬鎬ヨ瘖鏁版嵁宸插鐞嗭紝璺宠繃 type={}", type);
+ }
+ break;
+ case "FH0109.24":
+ log.info("銆恜arseResponseData銆戣В鏋愪綇闄㈡暟鎹�");
+ inHospitalDate(resultList, cry);
+ break;
+ case "FH0109.22":
+ log.info("銆恜arseResponseData銆戣В鏋愰浣忛櫌鏁版嵁");
+ inHospitalDate(resultList, cry);
+ break;
+ case "FH0109.23":
+ log.info("銆恜arseResponseData銆戣В鏋愰浣忛櫌锛堝緟瀹夊簥锛夋暟鎹�");
+ inHospitalDate(resultList, cry);
+ break;
+ case "FH0109.27":
+ log.info("銆恜arseResponseData銆戣В鏋愬嚭闄㈡暟鎹�");
+ inHospitalDate(resultList, cry);
+ break;
+ case "FH0109.53":
+ log.info("銆恜arseResponseData銆戣В鏋愰浣忛櫌锛堝叾浠栵級鏁版嵁");
+ inHospitalDate(resultList, cry);
+ break;
+ default:
+ log.warn("銆恜arseResponseData銆戞湭鐭ョ殑鏁版嵁绫诲瀷锛歿}", type);
+ break;
+ }
+ }
+ }
+
+ private Boolean outHospitalDate(List<ServiceSLTDInhospResDTO> resultList) {
+ // 闂ㄦ�ヨ瘖鍦� HIS 渚у彧鑳芥寜澶╂煡锛岄噰闆嗕换鍔℃瘡鍗婂皬鏃堕兘浼氭妸褰撳ぉ涓婁竾涓瘖鐤楄褰曢噸鏂版媺涓�閬嶏紝
+ // 鍏朵腑缁濆ぇ澶氭暟涓婁竴杞凡缁忓叆搴撱�傝繖閲屽厛鏁撮〉鎵归噺鏌ラ噸锛屾妸宸插叆搴撶殑鐩存帴璺宠繃锛�
+ // 鍙鏂板璁板綍鍋�"妗f澶勭悊 + 鍏ュ簱"锛屽惁鍒欐瘡鏉¢噸澶嶆暟鎹兘瑕佽蛋涓�閬�
+ // Redis鍔犻攣 + 妗f鏌ラ噸 + 妗f鏇存柊 + countBySerialnum + insert锛屼竴涓囨潯灏辨槸鍑犱竾娆� SQL锛屽崐灏忔椂璺戜笉瀹屻��
+ Set<String> pageSerialnums = new HashSet<>();
+ List<ServiceSLTDInhospResDTO> uniqueList = new ArrayList<>();
+ List<ServiceSLTDInhospResDTO> noSerialnumList = new ArrayList<>();
+ Map<String, List<String>> serialnumsByDate = new LinkedHashMap<>();
+ for (ServiceSLTDInhospResDTO dto : resultList) {
+ if (Objects.isNull(dto)) {
+ continue;
+ }
+ String serialnum = dto.getHealthcareRecordNo();
+ if (StringUtils.isEmpty(serialnum)) {
+ // 娌℃湁璇婄枟璁板綍鍙峰氨娌℃硶鏌ラ噸锛屼繚鎸佸師鏈夎涓虹収甯稿鐞嗭紙鍏ュ簱鐜妭杩樹細鍐嶅厹涓�娆★級
+ log.warn("銆恛utHospitalDate銆戣瘖鐤楄褰曞彿涓虹┖锛屾棤娉曟煡閲嶏紝鎸夋柊澧炲鐞嗭細patientName={}", dto.getPatientName());
+ noSerialnumList.add(dto);
+ continue;
+ }
+ if (!pageSerialnums.add(serialnum)) {
+ // 鍚屼竴椤靛唴閲嶅鐨勮褰曪紝鍙鐞嗕竴鏉�
+ continue;
+ }
+ uniqueList.add(dto);
+ // 鎸夊氨璇婃棩鏈熷垎缁勶紙璺ㄩ浂鐐规椂鏈�澶氫袱涓棩鏈燂級锛屼繚璇佹煡閲嶇殑鍒嗚〃鍜屽叆搴撴椂鍒嗚〃璺敱涓�鑷�
+ String admitDateStr = formatAdmitDate(dto.getLastEncounterTime());
+ serialnumsByDate.computeIfAbsent(admitDateStr == null ? "" : admitDateStr, k -> new ArrayList<>()).add(serialnum);
+ }
+
+ // 涓�娆� SQL 鏌ュ嚭杩欎竴椤甸噷宸茬粡鍏ュ簱鐨� serialnum锛堝彇浠i�愭潯 countBySerialnum锛�
+ Set<String> existingSerialnums = new HashSet<>();
+ for (Map.Entry<String, List<String>> entry : serialnumsByDate.entrySet()) {
+ try {
+ existingSerialnums.addAll(outhospDataFacade.selectExistingSerialnums(entry.getKey(), entry.getValue()));
+ } catch (Exception e) {
+ // 鎵归噺鏌ラ噸澶辫触涓嶅奖鍝嶆纭�э細涓嬮潰鍏ュ簱鏃舵瘡鏉¤繕浼氬啀鏌ヤ竴娆¢噸锛屽彧鏄參涓�浜�
+ log.error("銆恛utHospitalDate銆戞壒閲忔煡閲嶅け璐ワ紝閫�鍖栦负閫愭潯鏌ラ噸锛屽氨璇婃棩鏈燂細{}", entry.getKey(), e);
+ }
+ }
+
+ List<PatMedOuthosp> batchList = new ArrayList<>();
+ int existSkipCount = 0;
+ for (ServiceSLTDInhospResDTO dto : uniqueList) {
+ if (existingSerialnums.contains(dto.getHealthcareRecordNo())) {
+ existSkipCount++;
+ continue;
+ }
+ PatMedOuthosp patMedOuthosp = buildNewOuthosp(dto);
+ if (patMedOuthosp != null) {
+ batchList.add(patMedOuthosp);
+ }
+ }
+ for (ServiceSLTDInhospResDTO dto : noSerialnumList) {
+ PatMedOuthosp patMedOuthosp = buildNewOuthosp(dto);
+ if (patMedOuthosp != null) {
+ batchList.add(patMedOuthosp);
+ }
+ }
+ log.info("銆恛utHospitalDate銆戞湰椤祘}鏉★紝鍘婚噸鍚巤}鏉★紝宸插叆搴撹烦杩噞}鏉★紝寰呭叆搴搟}鏉�",
+ resultList.size(), uniqueList.size(), existSkipCount, batchList.size());
+
+ // 鎵归噺鎻掑叆锛岃嚜鍔ㄥ拷鐣ラ噸澶�
+ if (CollectionUtils.isNotEmpty(batchList)) {
+ //杩欓噷鐢ㄨ嚜鍔ㄥ拷鐣ラ噸澶嶄細鏈夐棶棰橈紝濡傛灉琛ㄩ噸鏂板缓锛宻erialnum绱㈠紩浼氫涪澶便�傚氨鏃犳硶鍘婚噸锛屾墍浠ヨ繕鏄渶瑕佸唴瀛橀噷鍘婚噸
+ batchList = DistinctByProperty.distinctByProperty(batchList, PatMedOuthosp::getSerialnum);
+ int insertCount = 0;
+ int skipCount = 0;
+ List<String> failSerialnums = new ArrayList<>();
+ for (PatMedOuthosp patMedOuthosp : batchList) {
+ try {
+ int inserted = outhospDataFacade.insert(patMedOuthosp);
+ if (inserted > 0) {
+ insertCount += inserted;
+ } else {
+ // 杩斿洖0琛ㄧず宸插瓨鍦紙閲嶅閲囬泦锛夋垨灏辫瘖鏃堕棿涓虹┖锛屽睘浜庢甯歌烦杩囷紝涓嶇畻澶辫触
+ skipCount++;
+ }
+ } catch (Exception e) {
+ // 鍗曟潯鍏ュ簱澶辫触涓嶅啀涓柇閲囬泦锛氳惤閿欒琛ㄤ氦缁欎汉宸ュ鐞嗭紝閲囬泦鏂偣鐓у父鎺ㄨ繘
+ failSerialnums.add(patMedOuthosp.getSerialnum());
+ saveOuthospError(null, patMedOuthosp, "INSERT", e.getMessage(), new Gson().toJson(patMedOuthosp), e);
+ }
+ }
+ log.info("鎵归噺鎻掑叆闂ㄦ�ヨ瘖璁板綍锛屾�绘暟锛歿}, 瀹為檯鎻掑叆锛歿}, 璺宠繃锛堝凡瀛樺湪/鏃犲氨璇婃椂闂达級锛歿}, 钀介敊璇〃锛歿}",
+ batchList.size(), insertCount, skipCount, failSerialnums.size());
+
+ if (!failSerialnums.isEmpty()) {
+ // 澶辫触鏄庣粏宸查�愭潯鍐欒繘 pat_med_outhosp_error锛岃繖閲屽彧鎻愮ず锛屼笉鍐嶆姏寮傚父闃绘柇閲囬泦
+ log.error("闂ㄦ�ヨ瘖璁板綍鍏ュ簱澶辫触 {} 鏉★紝宸插啓鍏� pat_med_outhosp_error 绛変汉宸ュ鐞嗭紝serialnum锛歿}",
+ failSerialnums.size(), failSerialnums);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 澶勭悊鍗曟潯鏂板璁板綍鐨勬偅鑰呮。妗堝苟鏋勫缓闂ㄦ�ヨ瘖璁板綍锛�
+ * 澶辫触鏃跺啓閿欒琛ㄤ氦缁欎汉宸ュ鐞嗗苟杩斿洖 null锛屼笉褰卞搷鍚屼竴椤甸噷鍏朵粬璁板綍
+ */
+ private PatMedOuthosp buildNewOuthosp(ServiceSLTDInhospResDTO dto) {
+ try {
+ PatArchive patArchive = processPatientArchive(dto);
+ return buildPatMedOuthosp(dto, patArchive);
+ } catch (Exception e) {
+ saveOuthospError(dto, null, "ARCHIVE", e.getMessage(), new Gson().toJson(dto), e);
+ return null;
+ }
+ }
+
+ /** 閲囬泦澶辫触鐨勫師濮嬭褰曟潵鑷帴鍙h繑鍥炵殑 Map锛堟暟鎹浆鎹㈠け璐ユ椂杩樻病鏈� DTO锛� */
+ private void saveOuthospError(Map<String, Object> dataItem, String errorType, String errorMsg,
+ String rawData, Throwable cause) {
+ PatMedOuthospError error = new PatMedOuthospError();
+ error.setSerialnum(getStringValue(dataItem, "healthcareRecordNo"));
+ error.setOuthospno(getStringValue(dataItem, "healthcareRecordNo"));
+ error.setPatname(getStringValue(dataItem, "patientName"));
+ error.setPatno(getStringValue(dataItem, "medicalRecordNo"));
+ error.setCampusid(getStringValue(dataItem, "campusId"));
+ error.setOrgid(getStringValue(dataItem, "orgId"));
+ doSaveOuthospError(error, errorType, errorMsg, rawData, cause);
+ }
+
+ /** 閲囬泦澶辫触鐨勫師濮嬭褰曟潵鑷� DTO / 寰呭叆搴撶殑 PatMedOuthosp */
+ private void saveOuthospError(ServiceSLTDInhospResDTO dto, PatMedOuthosp patMedOuthosp, String errorType,
+ String errorMsg, String rawData, Throwable cause) {
+ PatMedOuthospError error = new PatMedOuthospError();
+ if (dto != null) {
+ error.setSerialnum(dto.getHealthcareRecordNo());
+ error.setOuthospno(dto.getHealthcareRecordNo());
+ error.setPatname(dto.getPatientName());
+ error.setPatno(dto.getMedicalRecordNo());
+ error.setCampusid(dto.getCampusId());
+ error.setOrgid(dto.getOrgId());
+ error.setAdmitdate(parseDate(dto.getLastEncounterTime()));
+ }
+ if (patMedOuthosp != null) {
+ if (StringUtils.isEmpty(error.getSerialnum())) {
+ error.setSerialnum(patMedOuthosp.getSerialnum());
+ }
+ error.setOuthospno(patMedOuthosp.getOuthospno());
+ error.setPatname(patMedOuthosp.getPatname());
+ error.setPatno(patMedOuthosp.getPatno());
+ error.setCampusid(patMedOuthosp.getCampusid());
+ error.setOrgid(patMedOuthosp.getOrgid());
+ error.setAdmitdate(patMedOuthosp.getAdmitdate());
+ }
+ doSaveOuthospError(error, errorType, errorMsg, rawData, cause);
+ }
+
+ /**
+ * 鍐欓棬鎬ヨ瘖閲囬泦澶辫触璁板綍琛紝浜ょ粰浜哄伐澶勭悊銆�
+ * 杩欓噷鍏滀綇涓�鍒囧紓甯革細杩為敊璇〃閮藉啓涓嶈繘鍘绘椂鍙墦鏃ュ織锛堝甫鍘熷鏁版嵁锛夛紝缁濅笉鍥犱负鍐欓敊璇〃澶辫触鑰屼腑鏂噰闆�
+ */
+ private void doSaveOuthospError(PatMedOuthospError error, String errorType, String errorMsg,
+ String rawData, Throwable cause) {
+ error.setErrorType(errorType);
+ error.setErrorMsg(truncate(errorMsg == null || errorMsg.isEmpty() ? String.valueOf(cause) : errorMsg, 1000));
+ error.setRawData(rawData);
+ error.setFailCount(1);
+ error.setHandleStatus("0");
+ error.setGatherDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
+ error.setCreateTime(DateUtils.getNowDate());
+ try {
+ patMedOuthospErrorMapper.insertPatMedOuthospError(error);
+ log.error("銆愰棬鎬ヨ瘖閲囬泦銆憑} 澶辫触锛屽凡鍐欏叆 pat_med_outhosp_error 绛変汉宸ュ鐞嗭紝serialnum={}锛屾偅鑰�={}锛屽師鍥�={}",
+ errorType, error.getSerialnum(), error.getPatname(), error.getErrorMsg(), cause);
+ } catch (Exception ex) {
+ log.error("銆愰棬鎬ヨ瘖閲囬泦銆憑} 澶辫触锛屼笖鍐欏叆閿欒琛ㄤ篃澶辫触锛宻erialnum={}锛屽師濮嬫暟鎹細{}",
+ errorType, error.getSerialnum(), rawData, ex);
+ }
+ }
+
+ /** 鎴柇瓒呴暱鏂囨湰锛岄伩鍏嶈秴鍑洪敊璇〃瀛楁闀垮害瀵艰嚧钀借〃澶辫触 */
+ private String truncate(String text, int maxLength) {
+ if (text == null) {
+ return null;
+ }
+ return text.length() <= maxLength ? text : text.substring(0, maxLength);
+ }
+
+ private PatMedOuthosp buildPatMedOuthosp(ServiceSLTDInhospResDTO dto, PatArchive patArchive) {
+ PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
+ patMedOuthosp.setOuthospno(dto.getHealthcareRecordNo());
+ patMedOuthosp.setSerialnum(dto.getHealthcareRecordNo());
+ patMedOuthosp.setPatid(patArchive.getId());
+ patMedOuthosp.setPatname(patArchive.getName());
+ patMedOuthosp.setPatno(patArchive.getPatientno());
+ patMedOuthosp.setDeptcode("" + dto.getDeptId());
+ patMedOuthosp.setDeptname(dto.getDeptName());
+ patMedOuthosp.setDiagname(dto.getDiagnosisName());
+ patMedOuthosp.setIcd10code(dto.getDiagnosisCode());
+ patMedOuthosp.setDrcode("" + dto.getDoctorId());
+ patMedOuthosp.setDrname(dto.getDoctorName());
+ patMedOuthosp.setAdmitdate(parseDate(dto.getLastEncounterTime()));
+ patMedOuthosp.setSchemestatus(1L);
+ patMedOuthosp.setMainsuit(dto.getDiagnosisName());
+ patMedOuthosp.setHpi(null);
+ patMedOuthosp.setCreateTime(new Date());
+ patMedOuthosp.setOrgid(dto.getOrgId());
+ patMedOuthosp.setCampusid(dto.getCampusId());
+ patMedOuthosp.setFuflag("1");
+ if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1"))
+ patMedOuthosp.setFuflag("0");
+ return patMedOuthosp;
+ }
+
+ private Date parseDate(String dateStr) {
+ if (StringUtils.isEmpty(dateStr)) {
+ return null;
+ }
+ try {
+ return new SimpleDateFormat(DATE_FORMAT).parse(dateStr);
+ } catch (ParseException e) {
+ log.warn("銆恜arseDate銆戣В鏋愭棩鏈熷け璐ワ細{}", dateStr, e);
+ return null;
+ }
+ }
+
+ /**
+ * 鍙栧氨璇婃棩鏈熺殑 yyyy-MM-dd 閮ㄥ垎锛屼笌 buildPatMedOuthosp 閲岀殑 admitdate 淇濇寔瀹屽叏涓�鑷寸殑瑙f瀽瑙勫垯锛�
+ * 淇濊瘉鎵归噺鏌ラ噸鐢ㄧ殑鍒嗚〃鍜屽叆搴撴椂璺敱鍒扮殑鍒嗚〃鏄悓涓�寮�
+ */
+ private String formatAdmitDate(String lastEncounterTime) {
+ Date admitDate = parseDate(lastEncounterTime);
+ if (admitDate == null) {
+ return null;
+ }
+ return new SimpleDateFormat("yyyy-MM-dd").format(admitDate);
+ }
+
+ private Boolean inHospitalDate(List<ServiceSLTDInhospResDTO> resultList, String cry) {
+ int failCount = 0;
+ for (ServiceSLTDInhospResDTO dto : resultList) {
+ if (Objects.isNull(dto)) continue;
+ try {
+ PatArchive patArchive = processPatientArchive(dto);
+ processPatientInhospInfo(dto, patArchive, cry);
+ } catch (Exception e) {
+ failCount++;
+ log.error("銆恑nHospitalDate銆戝崟鏉¤褰曞鐞嗗け璐ワ紝宸茶烦杩囩户缁噰闆嗐�俿tate={}, serialnum={}, patname={}, patno={}, orgid={}, campusId={}",
+ cry, dto.getHealthcareRecordNo(), dto.getPatientName(), dto.getMedicalRecordNo(),
+ dto.getOrgId(), dto.getCampusId(), e);
+ }
+ }
+ if (failCount > 0) {
+ log.warn("銆恑nHospitalDate銆戞湰椤靛叡{}鏉★紝澶辫触{}鏉″凡璺宠繃锛屽叾浣檣}鏉″鐞嗗畬鎴愶紝state={}",
+ resultList.size(), failCount, resultList.size() - failCount, cry);
+ }
+ return true;
+ }
+
+ private void processPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) {
+ PatMedInhosp patMedInhosp = buildPatientInhospInfo(dto, patArchive, cry);
+ PatMedInhosp queryInhosp = new PatMedInhosp();
+ queryInhosp.setPatno(StringUtils.trim(patArchive.getPatientno()));
+ queryInhosp.setSerialnum(StringUtils.trim(patMedInhosp.getSerialnum()));
+ queryInhosp.setOrgid(StringUtils.trim(dto.getOrgId()));
+ queryInhosp.setInhospstate(cry);
+// log.info("----------------杩欓噷鐨勫叆鍙備负锛歿},{}", queryInhosp.getPatno(), queryInhosp.getSerialnum());
+ List<PatMedInhosp> existingInhosps = inhospVisitFacade.selectPatMedInhosp(queryInhosp);
+
+ if (cry.equals("0")) {
+ //鍏ラ櫌鏁版嵁澶勭悊
+ if (CollectionUtils.isEmpty(existingInhosps)) {
+ //濡傛灉涓虹┖锛岃鍏堝垽鏂紝棰勫叆闄㈡槸鍚︽湁鍊硷紝鏈夊�肩殑璇濆垯鏇存柊
+ queryInhosp.setInhospstate("3");
+ List<PatMedInhosp> patMedInhospList = inhospVisitFacade.selectPatMedInhosp(queryInhosp);
+ if (CollectionUtils.isNotEmpty(patMedInhospList)) {
+ //濡傛灉棰勫叆闄笉涓虹┖锛屽垯杩涜淇敼锛堥鍏ラ櫌鈫掑叆闄級
+ patMedInhosp.setInhospid(patMedInhospList.get(0).getInhospid());
+ inhospVisitFacade.updatePatMedInhosp(patMedInhosp);
+ log.info("鐢遍鍏ラ櫌鏇存柊涓哄叆闄細serialnum={}", patMedInhosp.getSerialnum());
+ } else {
+ //濡傛灉鍑洪櫌涓嶄负绌猴紝鍒欎笉杩涜澶勭悊
+ queryInhosp.setInhospstate("1");
+ patMedInhospList = inhospVisitFacade.selectPatMedInhosp(queryInhosp);
+ if (CollectionUtils.isNotEmpty(patMedInhospList)) {
+ //濡傛灉涓嶄负绌猴紝鍒欏皢鍏ラ櫌鏃堕棿杩涜鏇存柊
+ PatMedInhosp pmOut = patMedInhospList.get(0);
+ //鏈鍏ラ櫌鏁版嵁锛堣繖閲� existingInhosps 蹇呬负绌猴紝鍙� existingInhosps.get(0) 浼氫笅鏍囪秺鐣岋級
+ PatMedInhosp pmIn = patMedInhosp;
+ pmOut.setStarttime(pmIn.getStarttime());
+ pmOut.setUpdateTime(new Date());
+ inhospVisitFacade.updatePatMedInhosp(pmOut);
+ //鐪佺珛鍚屽痉闇�瑕佸皢寮�濮嬫棩鏈熶笌鍏ラ櫌鏃ユ湡鐩哥瓑鐨勪换鍔★紝鏀规垚涓嶆墽琛�
+ try {
+ if ("sltd".equals(active) && DateUtils.isSameDay(pmOut.getStarttime(), pmIn.getEndtime())) {
+ ServiceSubtask serviceSubtask = new ServiceSubtask();
+ serviceSubtask.setInhospid(pmOut.getInhospid());
+ serviceSubtask.setSendstate(4L);
+ serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
+ }
+ //閫氳繃鍏ラ櫌鏃堕棿锛屽拰鎮h�呯殑缂栧彿鍘绘煡涓�涓嬪嚭闄㈡椂闂达紝鏄惁瀛樺湪锛屽鏋滃瓨鍦紝鍒欒鎮h�呮槸鍐嶅叆闄㈢殑锛岄渶瑕佹敼鎴愪笉鎵ц
+ //鍑洪櫌鏃堕棿鍙瘮杈冨埌澶╋紝涓嶆瘮杈冩椂鍒嗙
+ if (pmIn.getStarttime() != null) {
+ Date dayStart = DateUtils.truncate(pmIn.getStarttime(), Calendar.DAY_OF_MONTH);
+ Date dayEnd = DateUtils.addDays(dayStart, 1);
+ List<PatMedInhosp> outInhosps = inhospVisitFacade.selectOutInhospByPatnoAndOutDate(
+ StringUtils.trim(pmIn.getPatno()), dayStart, dayEnd);
+ if (CollectionUtils.isNotEmpty(outInhosps)) {
+ //瀛樺湪鍑洪櫌璁板綍锛岃鏄庤鎮h�呮槸鍐嶅叆闄紝鎶婁笂涓�娆″嚭闄骇鐢熺殑瀛愪换鍔℃敼鎴愪笉鎵ц
+ ServiceSubtask outSubtask = new ServiceSubtask();
+ outSubtask.setInhospid(outInhosps.get(0).getInhospid());
+ outSubtask.setSendstate(4L);
+ outSubtask.setRemark("鎮h�呭啀鍏ラ櫌");
+ outSubtask.setUpdateTime(new Date());
+ serviceSubtaskMapper.updateServiceSubtaskByCondition(outSubtask);
+ log.info("鎮h�呭啀鍏ラ櫌锛屽皢涓婃鍑洪櫌璁板綍鐨勫瓙浠诲姟鏀逛负涓嶆墽琛岋細patno={}, 鍑洪櫌inhospid={}, 鍑洪櫌鏃堕棿={}, 鏈鍏ラ櫌鏃堕棿={}",
+ pmIn.getPatno(), outInhosps.get(0).getInhospid(), outInhosps.get(0).getEndtime(), pmIn.getStarttime());
+ }
+ }
+
+ } catch (Exception e) {
+ log.error("灏嗗嚭闄㈡椂闂寸瓑浜庡叆闄㈡椂闂寸殑inhospid鐨勪换鍔℃洿鏂板け璐ヤ簡, inhospid={}", pmOut.getInhospid(), e);
+ }
+ return;
+ }
+ }
+
+ //濡傛灉閮戒负绌猴紝鍒欒繘琛屾柊澧�
+ if (CollectionUtils.isEmpty(patMedInhospList)) {
+ try {
+ inhospVisitFacade.insertPatMedInhosp(patMedInhosp);
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ log.warn("鍏ラ櫌璁板綍宸插瓨鍦紝璺宠繃锛歴erialnum={}, orgid={}, state={}", patMedInhosp.getSerialnum(), patMedInhosp.getOrgid(), patMedInhosp.getInhospstate());
+ }
+ }
+ }
+
+ } else if (cry.equals("1")) {
+ // 鍑洪櫌鏁版嵁澶勭悊
+ if (CollectionUtils.isNotEmpty(existingInhosps)) {
+ // 宸插瓨鍦ㄥ嚭闄㈣褰曪紝鐩存帴鏇存柊锛堜繚鎸佹渶鏂版暟鎹級
+ patMedInhosp.setInhospid(existingInhosps.get(0).getInhospid());
+ inhospVisitFacade.updatePatMedInhosp(patMedInhosp);
+ log.info("鍑洪櫌璁板綍宸插瓨鍦紝鎵ц鏇存柊锛歴erialnum={}, orgid={}", patMedInhosp.getSerialnum(), patMedInhosp.getOrgid());
+ } else {
+ // 涓嶅瓨鍦ㄥ嚭闄㈣褰曪紝鍏堟煡棰勫叆闄紙state=3锛夛紝鍐嶆煡鍏ラ櫌锛坰tate=0锛�
+ queryInhosp.setInhospstate("3");
+// log.info("-----鏌ヨ棰勫叆闄㈣褰曪紝鍏ュ弬涓猴細{}", queryInhosp);
+ List<PatMedInhosp> patMedInhospList = inhospVisitFacade.selectPatMedInhosp(queryInhosp);
+ log.info("----棰勫叆闄㈡煡璇㈢粨鏋滐細{}", CollectionUtils.isEmpty(patMedInhospList) ? "绌�" : patMedInhospList.get(0).getSerialnum());
+ if (CollectionUtils.isNotEmpty(patMedInhospList)) {
+ // 瀛樺湪棰勫叆闄㈣褰曪紝鏇存柊涓哄嚭闄㈢姸鎬�
+ patMedInhosp.setInhospid(patMedInhospList.get(0).getInhospid());
+ inhospVisitFacade.updatePatMedInhosp(patMedInhosp);
+ log.info("鐢遍鍏ラ櫌鏇存柊涓哄嚭闄細serialnum={}", patMedInhosp.getSerialnum());
+ } else {
+ // 鍐嶆煡鍏ラ櫌璁板綍锛坰tate=0锛�
+ queryInhosp.setInhospstate("0");
+ patMedInhospList = inhospVisitFacade.selectPatMedInhosp(queryInhosp);
+ log.debug("鍏ラ櫌鏌ヨ缁撴灉锛歿}", CollectionUtils.isEmpty(patMedInhospList) ? "绌�" : patMedInhospList.size());
+ if (CollectionUtils.isNotEmpty(patMedInhospList)) {
+ // 瀛樺湪鍏ラ櫌璁板綍锛屾洿鏂颁负鍑洪櫌鐘舵��
+ patMedInhosp.setInhospid(patMedInhospList.get(0).getInhospid());
+ inhospVisitFacade.updatePatMedInhosp(patMedInhosp);
+ log.info("鐢卞叆闄㈡洿鏂颁负鍑洪櫌锛歴erialnum={}", patMedInhosp.getSerialnum());
+ } else {
+ // 棰勫叆闄㈠拰鍏ラ櫌鍧囦笉瀛樺湪锛岀洿鎺ユ柊澧炲嚭闄㈣褰�
+ try {
+ inhospVisitFacade.insertPatMedInhosp(patMedInhosp);
+ log.info("鏂板鍑洪櫌璁板綍锛歴erialnum={}", patMedInhosp.getSerialnum());
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ log.warn("鍑洪櫌璁板綍宸插瓨鍦紝璺宠繃锛歴erialnum={}, orgid={}, state={}", patMedInhosp.getSerialnum(), patMedInhosp.getOrgid(), patMedInhosp.getInhospstate());
+ }
+ }
+ }
+ }
+ } else if ("3".equals(cry)) {
+ //棰勫叆闄㈡暟鎹鐞嗭細浠讳竴鐘舵�佸瓨鍦ㄥ垯涓嶆柊澧烇紱閮戒笉瀛樺湪鎵嶆柊澧�
+ String serialnum = patMedInhosp.getSerialnum() == null ? "" : patMedInhosp.getSerialnum().trim();
+ String orgid = patMedInhosp.getOrgid() == null ? "" : patMedInhosp.getOrgid().trim();
+ String state = patMedInhosp.getInhospstate() == null ? "" : patMedInhosp.getInhospstate();
+ String lockKey = "inhosp:lock:" + serialnum + ":" + orgid + ":" + state;
+
+ Boolean locked = false;
+ try {
+ locked = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 10, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ log.warn("Redis閿佽幏鍙栧け璐ワ紝闄嶇骇涓虹洿鎺ユ彃鍏ワ細{}", e.getMessage());
+ locked = null; // 鏍囪Redis涓嶅彲鐢�
+ }
+
+ if (locked == null || Boolean.TRUE.equals(locked)) {
+ try {
+ queryInhosp.setInhospstate(null);
+ queryInhosp.setSchemestatus(null);
+ queryInhosp.setPatno(null);
+ List<PatMedInhosp> patMedInhospList3 = inhospVisitFacade.selectPatMedInhosp(queryInhosp);
+ if (CollectionUtils.isEmpty(patMedInhospList3)) {
+ try {
+ //鑾峰彇涓�涓嬪叆闄㈢敵璇峰崟
+ //鏍规嵁 encounterSourceId 鑾峰彇 importanceFlagCode emergencyLevelCode
+ if (active.equals("sltd")) {
+ Map<String, String> applyInfo = hospitalizedApply(dto.getEncounterSourceId(), dto.getOrgId());
+ if (ObjectUtils.isNotEmpty(applyInfo)) {
+ patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode"));
+ patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode"));
+ }
+ }
+ inhospVisitFacade.insertPatMedInhosp(patMedInhosp);
+ log.debug("鎴愬姛鎻掑叆棰勫叆闄㈣褰曪細serialnum={}", patMedInhosp.getSerialnum());
+ } catch (Exception e) {
+ log.warn("棰勫叆闄㈣褰曟彃鍏ュけ璐ワ紙鍙兘宸插瓨鍦級锛歴erialnum={}, orgid={}, state={}, 閿欒锛歿}", patMedInhosp.getSerialnum(), patMedInhosp.getOrgid(), patMedInhosp.getInhospstate(), e.getMessage());
+ }
+ }
+ } finally {
+ if (Boolean.TRUE.equals(locked)) {
+ try {
+ redisTemplate.delete(lockKey);
+ } catch (Exception e) {
+ log.warn("Redis閿侀噴鏀惧け璐ワ細{}", e.getMessage());
+ }
+ }
+ }
+ } else {
+ log.debug("棰勫叆闄㈣褰曟鍦ㄨ鍏朵粬绾跨▼澶勭悊锛岃烦杩囷細serialnum={}", patMedInhosp.getSerialnum());
+ }
+ }
+ }
+
+ private PatMedInhosp buildPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) {
+ log.info("----------------buildPatientInhospInfo杩欓噷杩涙潵浜嗗悧锛焮}", cry);
+ PatMedInhosp patMedInhosp = new PatMedInhosp();
+ patMedInhosp.setPatid(patArchive.getId());
+ patMedInhosp.setPatno(patArchive.getPatientno());
+ patMedInhosp.setPatname(patArchive.getName());
+ patMedInhosp.setNurseId(dto.getChiefNurseId() == null ? "" : dto.getChiefNurseId().toString());
+ patMedInhosp.setNurseName(dto.getChiefNurseName());
+ patMedInhosp.setSerialnum(dto.getHealthcareRecordNo());
+ patMedInhosp.setInhospno(dto.getHealthcareRecordNo());
+ patMedInhosp.setFuflag("1");
+
+ if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1"))
+ patMedInhosp.setFuflag("0");
+ if ("0".equals(cry)) {
+ patMedInhosp.setInhospstate("0");
+ if (CollectionUtils.isNotEmpty(dto.getDiagnosisList()) && dto.getDiagnosisList().size() > 0) {
+ for (ServiceSLTDDiagnosisResDTO diagnosis : dto.getDiagnosisList()) {
+ if (diagnosis.getIsMainDiagnosis() == 1) {
+ patMedInhosp.setDiagname(diagnosis.getDiagnosisDictName() == null ? "" : diagnosis.getDiagnosisDictName());
+ patMedInhosp.setIcd10code(diagnosis.getDiagnosisDictCode() == null ? "" : diagnosis.getDiagnosisDictCode());
+ }
+ }
+ }
+ }
+ if ("1".equals(cry)) {
+ patMedInhosp.setInhospstate("1");
+ ServiceSLTDDiagnosisResDTO mainDischargeDiagnosis = dto.getMainDischargeDiagnosis();
+// log.info("-----------mainDischargeDiagnosis鐨勫�兼湁浜嗗悧?{}", mainDischargeDiagnosis);
+ if (!Objects.isNull(mainDischargeDiagnosis)) {
+ if (mainDischargeDiagnosis.getIsMainDiagnosis() == 1) {
+ patMedInhosp.setLeavediagname(StringUtils.defaultString(mainDischargeDiagnosis.getDiagnosisDictName(), ""));
+ patMedInhosp.setLeaveicd10code(StringUtils.defaultString(mainDischargeDiagnosis.getDiagnosisDictCode(), ""));
+ }
+ }
+ }
+ if ("3".equals(cry)) {
+ patMedInhosp.setInhospstate("3");
+ if (CollectionUtils.isNotEmpty(dto.getDiagnosisList()) && dto.getDiagnosisList().size() > 0) {
+ for (ServiceSLTDDiagnosisResDTO diagnosis : dto.getDiagnosisList()) {
+ if (diagnosis.getIsMainDiagnosis() == 1) {
+ patMedInhosp.setDiagname(diagnosis.getDiagnosisDictName() == null ? "" : diagnosis.getDiagnosisDictName());
+ patMedInhosp.setIcd10code(diagnosis.getDiagnosisDictCode() == null ? "" : diagnosis.getDiagnosisDictCode());
+ }
+ }
+ }
+ }
+ patMedInhosp.setHospitalcode(dto.getOrgId());
+ patMedInhosp.setBedNo(dto.getBedNumber());
+ patMedInhosp.setStarttime(parseDate(dto.getStartTime()));
+ patMedInhosp.setEndtime(parseDate(dto.getPreOutHospitalDate()));
+
+ if ("1".equals(cry)) {
+ setDischargeInfo(patMedInhosp, dto);
+ } else {
+ setAdmissionInfo(patMedInhosp, dto);
+ patMedInhosp.setEncounterSourceId(dto.getEncounterSourceId() == null ? "" : dto.getEncounterSourceId());
+ if (StringUtils.isNotEmpty(dto.getEncounterSourceId()) && active.equals("sltd")) {
+ //鏍规嵁 encounterSourceId 鑾峰彇 importanceFlagCode emergencyLevelCode
+ Map<String, String> applyInfo = hospitalizedApply(dto.getEncounterSourceId(), dto.getOrgId());
+ if (!Objects.isNull(applyInfo)) {
+ patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode"));
+ patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode"));
+ }
+ }
+ }
+
+ patMedInhosp.setDrname(dto.getDoctorName());
+ patMedInhosp.setDrcode("" + dto.getDoctorId());
+ patMedInhosp.setSchemestatus("0".equals(cry) ? 1L : 2L);
+ patMedInhosp.setDelFlag("0");
+ patMedInhosp.setOrgid(dto.getOrgId());
+ patMedInhosp.setCampusid(dto.getCampusId());
+ if (StringUtils.isNotEmpty(dto.getHealthcareRecordStatus()) && dto.getHealthcareRecordStatus().equals("FH0109.25"))
+ patMedInhosp.setRemark("棰勫嚭闄�");
+ if (active.equals("nhfy") && dto.getAreaId() != null && dto.getAreaId().toString().equals("40003483") && StringUtils.isNotEmpty(patMedInhosp.getPatname())) {
+ //鍗楀崕闄勪竴鐨勪骇绉戯紝瑕佹眰涓嶇敓鎴愨�滀箣瀛愩�佷箣濂炽�佷箣濠粹�濈殑闅忚浠诲姟
+ if (patMedInhosp.getPatname().contains("涔嬪瓙") || patMedInhosp.getPatname().contains("涔嬪コ") || patMedInhosp.getPatname().contains("涔嬪┐")) {
+ patMedInhosp.setDeptcheckFlag("3");
+ patMedInhosp.setWardcheckFlag("3");
+ patMedInhosp.setDiagcheckFlag("3");
+ patMedInhosp.setRemark(patMedInhosp.getRemark() + ";涓嶇敓鎴愪箣瀛愩�佷箣濂炽�佷箣濠撮棶鍗�");
+ }
+ }
+
+ //鐩墠鍙湁鐪佺珛鍚屽痉
+ if (active.equals("sltd")) {
+ Map<String, String> drugInfoMap = queryMedicalOrders(dto);
+ if (drugInfoMap != null && !drugInfoMap.isEmpty()) {
+ patMedInhosp.setMedicalName(drugInfoMap.get("drugItemNames"));
+ patMedInhosp.setMedicalCode(drugInfoMap.get("drugItemIds"));
+ patMedInhosp.setMedicalCompany(drugInfoMap.get("drugManufacturerNames"));
+ log.info("鑾峰彇鑽搧淇℃伅鎴愬姛锛氬悕绉�={}, 缂栫爜={}, 鍘傚={}", drugInfoMap.get("drugItemNames"), drugInfoMap.get("drugItemIds"), drugInfoMap.get("drugManufacturerNames"));
+ }
+ }
+ return patMedInhosp;
+ }
+
+ /**
+ * 鏌ヨ鍖诲槺淇℃伅骞舵嫾鎺ヨ嵂鍝佷俊鎭�
+ *
+ * @param dto 鍋ュ悍璁板綍璇锋眰瀵硅薄
+ * @return 杩斿洖鍖呭惈涓変釜瀛楁 Map锛�
+ * - drugItemNames: 鑽搧鍚嶇О鍒楄〃锛堥�楀彿鍒嗛殧锛�
+ * - drugItemIds: 鑽搧缂栫爜鍒楄〃锛堥�楀彿鍒嗛殧锛�
+ * - drugManufacturerNames: 鑽搧鍘傚鍒楄〃锛堥�楀彿鍒嗛殧锛�
+ * <p>
+ * 瑙勫垯锛�
+ * 1. 涓変釜瀛楁椤哄簭浣嶇疆淇濇寔涓�鑷�
+ * 2. 濡傛灉涓変釜瀛楁閮戒负绌猴紝鍒欒烦杩囪璁板綍
+ * 3. 濡傛灉鑷冲皯鏈変竴涓瓧娈垫湁鍊硷紝鍒欏叾浠栦袱涓负绌虹敤绌哄瓧绗︿覆浠f浛
+ */
+ private Map<String, String> queryMedicalOrders(ServiceSLTDInhospResDTO dto) {
+ Map<String, String> result = new HashMap<>();
+ List<String> itemNames = new ArrayList<>();
+ List<String> itemIds = new ArrayList<>();
+ List<String> manufacturerNames = new ArrayList<>();
+
+ try {
+ // 鑾峰彇鎮h�呯殑鍖诲槺淇℃伅
+ Map<String, Object> medicineInfoReq = new HashMap<>();
+ medicineInfoReq.put("orgId", dto.getOrgId());
+ medicineInfoReq.put("patientId", dto.getPatientId());
+ medicineInfoReq.put("campusId", dto.getCampusId());
+ medicineInfoReq.put("medicalRecordNo", dto.getMedicalRecordNo());
+ log.info("銆恞ueryMedicalOrders銆戣姹傚弬鏁帮細{}", medicineInfoReq);
+ Map<String, String> headers = buildRequestHeaders();
+ String resultStr = HttpUtils.sendPostByHeader(sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/doctorOrder/queryDoctorOrderList", new Gson().toJson(medicineInfoReq), headers);
+
+ if (StringUtils.isEmpty(resultStr)) {
+ log.warn("銆恞ueryMedicalOrders銆戞帴鍙h繑鍥炰负绌猴紝patientId={}", dto.getPatientId());
+ return result;
+ }
+
+ // 瑙f瀽杩斿洖鏁版嵁
+ Gson gson = new Gson();
+ Type mapType = new TypeToken<Map<String, Object>>() {
+ }.getType();
+ Map<String, Object> responseMap = gson.fromJson(resultStr, mapType);
+
+ // 妫�鏌ヨ繑鍥炵爜
+ Object codeObj = responseMap.get("code");
+ if (codeObj != null) {
+ String code = BigDecimal.valueOf(((Number) codeObj).longValue()).toPlainString();
+ if (!"200".equals(code)) {
+ log.error("銆恞ueryMedicalOrders銆戞帴鍙h繑鍥炲け璐ワ紝code={}, message={}", code, responseMap.get("message"));
+ return null;
+ }
+ }
+
+ // 鑾峰彇 data 鏁扮粍
+ Object dataObj = responseMap.get("data");
+ if (dataObj instanceof List) {
+ List<?> dataList = (List<?>) dataObj;
+
+ // 閬嶅巻鍖诲槺鍒楄〃锛屾彁鍙栬嵂鍝佷俊鎭�
+ Set<String> processedItemIds = new HashSet<>(); // 鐢ㄤ簬鍘婚噸锛堝彧鏍规嵁 itemId 鍘婚噸锛�
+
+ for (Object item : dataList) {
+ if (item instanceof Map) {
+ Map<String, Object> itemMap = (Map<String, Object>) item;
+
+ // 鍙鐞嗚嵂鍝佺浉鍏崇殑鍖诲槺锛坕temDomain 涓� FH0134.01 琛ㄧず鑽搧锛�
+ Object itemDomainObj = itemMap.get("itemDomain");
+ if (itemDomainObj == null || !"FH0134.01".equals(itemDomainObj.toString())) {
+ continue;
+ }
+
+ // 鑾峰彇涓変釜瀛楁
+ Object itemNameObj = itemMap.get("itemName");
+ Object itemIdObj = itemMap.get("itemId");
+ Object manufacturerNameObj = itemMap.get("manufacturerName");
+
+ // 鍒ゆ柇鏄惁閮戒负绌�
+ boolean allEmpty = (itemNameObj == null || StringUtils.isEmpty(itemNameObj.toString())) && (itemIdObj == null || StringUtils.isEmpty(itemIdObj.toString())) && (manufacturerNameObj == null || StringUtils.isEmpty(manufacturerNameObj.toString()));
+
+ // 濡傛灉涓変釜閮戒负绌猴紝鍒欒烦杩�
+ if (allEmpty) {
+ continue;
+ }
+
+ // 鑷冲皯鏈変竴涓湁鍊硷紝澶勭悊姣忎釜瀛楁
+ String itemName = (itemNameObj != null && StringUtils.isNotEmpty(itemNameObj.toString())) ? itemNameObj.toString() : "";
+
+ // itemId 鐗规畩澶勭悊锛氶伩鍏嶇瀛﹁鏁版硶锛圙son 鍙兘灏嗘暟瀛楄В鏋愪负 Double锛�
+ String itemId = "";
+ if (itemIdObj != null && StringUtils.isNotEmpty(itemIdObj.toString())) {
+ if (itemIdObj instanceof Number) {
+ // 濡傛灉鏄暟鍊肩被鍨嬶紝杞崲涓烘暣鏁板瓧绗︿覆锛岄伩鍏嶇瀛﹁鏁版硶
+ itemId = String.valueOf(((Number) itemIdObj).longValue());
+ } else {
+ itemId = itemIdObj.toString();
+ }
+ }
+
+ String manufacturerName = (manufacturerNameObj != null && StringUtils.isNotEmpty(manufacturerNameObj.toString())) ? manufacturerNameObj.toString() : "";
+
+ // 鍙牴鎹� itemId 鍘婚噸锛堝悓涓�缂栫爜鐨勮嵂鍝佸彧淇濈暀涓�涓級
+ if (StringUtils.isNotEmpty(itemId)) {
+ if (processedItemIds.contains(itemId)) {
+ log.info("銆恞ueryMedicalOrders銆戣烦杩囬噸澶嶈嵂鍝侊紙鐩稿悓缂栫爜锛夛細鍚嶇О={}, 缂栫爜={}", itemName, itemId);
+ continue;
+ }
+ processedItemIds.add(itemId);
+ } else {
+ // itemId 涓虹┖鏃讹紝浣跨敤 itemName 浣滀负鍘婚噸渚濇嵁
+ if (processedItemIds.contains(itemName)) {
+ log.info("銆恞ueryMedicalOrders銆戣烦杩囬噸澶嶈嵂鍝侊紙鐩稿悓鍚嶇О锛夛細鍚嶇О={}", itemName);
+ continue;
+ }
+ processedItemIds.add(itemName);
+ }
+
+ // 娣诲姞鍒板垪琛�
+ itemNames.add(itemName);
+ itemIds.add(itemId);
+ manufacturerNames.add(manufacturerName);
+
+ log.info("銆恞ueryMedicalOrders銆戞彁鍙栬嵂鍝佷俊鎭細鍚嶇О={}, 缂栫爜={}, 鍘傚={}", itemName, itemId, manufacturerName);
+ }
+ }
+ } else {
+ log.info("銆恞ueryMedicalOrders銆慸ata 涓嶆槸鏁扮粍绫诲瀷锛宲atientId={}", dto.getPatientId());
+ }
+
+ // 灏嗗垪琛ㄦ嫾鎺ユ垚閫楀彿鍒嗛殧鐨勫瓧绗︿覆
+ if (!itemNames.isEmpty()) {
+ result.put("drugItemNames", String.join(",", itemNames));
+ result.put("drugItemIds", String.join(",", itemIds));
+ result.put("drugManufacturerNames", String.join(",", manufacturerNames));
+ }
+
+ log.info("銆恞ueryMedicalOrders銆戞垚鍔熸彁鍙杮}鏉¤嵂鍝佷俊鎭紝patientId={}", itemNames.size(), dto.getPatientId());
+
+ } catch (Exception e) {
+ log.error("銆恞ueryMedicalOrders銆戞煡璇㈠尰鍢变俊鎭け璐ワ紝patientId={}", dto.getPatientId(), e);
+ }
+
+ return result;
+ }
+
+ private void setDischargeInfo(PatMedInhosp patMedInhosp, ServiceSLTDInhospResDTO dto) {
+ patMedInhosp.setLeaveldeptcode("" + dto.getDeptId());
+ patMedInhosp.setLeaveldeptname(dto.getDeptName());
+ patMedInhosp.setLeavediagname(dto.getMainDischargeDiagnosis() == null ? null : dto.getMainDischargeDiagnosis().getDiagnosisDictName());
+ patMedInhosp.setLeaveicd10code(dto.getMainDischargeDiagnosis() == null ? null : dto.getMainDischargeDiagnosis().getDiagnosisDictCode());
+ patMedInhosp.setOutWayId(null);
+ patMedInhosp.setOutWayName(null);
+ patMedInhosp.setLeavehospitaldistrictid("" + dto.getAreaId());
+ patMedInhosp.setLeavehospitaldistrictcode("" + dto.getAreaId());
+ patMedInhosp.setLeavehospitaldistrictname(dto.getAreaName());
+ patMedInhosp.setLeaveldeptid("" + dto.getDeptId());
+ }
+
+ private void setAdmissionInfo(PatMedInhosp patMedInhosp, ServiceSLTDInhospResDTO dto) {
+ patMedInhosp.setDeptcode("" + dto.getDeptId());
+ patMedInhosp.setDeptname(dto.getDeptName());
+ patMedInhosp.setDiagname(dto.getAdmissionDiagnosisName());
+ patMedInhosp.setIcd10code(dto.getAdmissionDiagnosisCode());
+ patMedInhosp.setHospitaldistrictid("" + dto.getAreaId());
+ patMedInhosp.setHospitaldistrictcode("" + dto.getAreaId());
+ patMedInhosp.setHospitaldistrictname(dto.getAreaName());
+ }
+
+ /**
+ * 鏍规嵁鍏ラ櫌鐢宠鍗旾D鏌ヨ鍏ラ櫌鐢宠鍗曡鎯�
+ * 鍙彁鍙� importanceFlagCode锛坕mportanceFlagCodeList閫楀彿鎷兼帴锛夊拰 emergencyLevelCode 涓や釜鍊�
+ */
+ private Map<String, String> hospitalizedApply(String encounterSourceId, String orgid) {
+ Map<String, String> applyInfo = new HashMap<>();
+ Map<String, String> headers = buildRequestHeaders();
+ log.info("闄㈢敵璇峰崟ID鏌ヨ鍏ラ櫌鐢宠鍗曪細{},appKey:{}", sltdPubPath + "/sf/hospitalizedApply/query", APP_KEY);
+ //璁剧疆鍏ュ弬
+ Map<String, Object> requestParams = new HashMap<>();
+ requestParams.put("applyId", encounterSourceId);
+ requestParams.put("orgId", orgid);
+
+ String result = null;
+ if (StringUtils.isNotEmpty(encounterSourceId) && StringUtils.isNotEmpty(orgid))
+ result = HttpUtils.sendPostByHeader(sltdPubPath + "/sf/hospitalizedApply/query", new Gson().toJson(requestParams), headers);
+
+ if (StringUtils.isEmpty(result)) {
+ log.error("銆恏ospitalizedApply銆戞帴鍙h繑鍥炰负绌猴紝applyId={}", encounterSourceId);
+ return applyInfo;
+ }
+ try {
+ Gson gson = new Gson();
+ Type mapType = new TypeToken<Map<String, Object>>() {
+ }.getType();
+ Map<String, Object> responseMap = gson.fromJson(result, mapType);
+ Object dataObj = responseMap == null ? null : responseMap.get("data");
+ if (dataObj instanceof Map) {
+ Map<String, Object> data = (Map<String, Object>) dataObj;
+ //閲嶈鎬ф爣璁扮紪鐮侊紝鎺ュ彛杩斿洖鏄暟缁勶紝闇�瑕佽浆鎹负瀛楀吀鍚嶇О
+ Object importanceFlagCodeListObj = data.get("importanceFlagCodeList");
+ if (importanceFlagCodeListObj instanceof List) {
+ List<?> importanceFlagCodeList = (List<?>) importanceFlagCodeListObj;
+ // 杩囨护鎺� null 鍊�
+ List<String> nonNullList = importanceFlagCodeList.stream().filter(Objects::nonNull).map(Object::toString).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
+
+ if (!nonNullList.isEmpty()) {
+ String importanceFlagLabel;
+ if (nonNullList.size() == 1) {
+ // 鍙湁涓�涓�硷紝鐩存帴閫氳繃鏋氫妇鑾峰彇鎻忚堪
+ importanceFlagLabel = ImportFlagEnum.getDescByCode(nonNullList.get(0));
+ } else {
+ // 澶氫釜鍊硷紝鐢ㄩ�楀彿鎷兼帴鏋氫妇鎻忚堪
+ StringBuilder labelBuilder = new StringBuilder();
+ for (String code : nonNullList) {
+ String label = ImportFlagEnum.getDescByCode(code);
+ if (StringUtils.isNotEmpty(label)) {
+ labelBuilder.append(label).append(",");
+ }
+ }
+ importanceFlagLabel = StringUtils.stripEnd(labelBuilder.toString(), ",");
+ }
+
+ if (StringUtils.isNotEmpty(importanceFlagLabel)) {
+ applyInfo.put("importanceFlagCode", importanceFlagLabel);
+ }
+ }
+ }
+ //绱ф�ョ▼搴︾紪鐮侊紝閫氳繃鏋氫妇杞崲鎻忚堪
+ Object emergencyLevelCodeObj = data.get("emergencyLevelCode");
+ if (emergencyLevelCodeObj != null) {
+ String emergencyLevelLabel = EmergencyLevelEnum.getDescByCode(emergencyLevelCodeObj.toString());
+ if (StringUtils.isNotEmpty(emergencyLevelLabel)) {
+ applyInfo.put("emergencyLevelCode", emergencyLevelLabel);
+ }
+ }
+ } else {
+ log.error("銆恏ospitalizedApply銆戞帴鍙h繑鍥瀌ata涓嶆槸瀵硅薄锛宎pplyId={}锛宺esult锛歿}", encounterSourceId, result);
+ }
+ } catch (Exception e) {
+ log.error("銆恏ospitalizedApply銆戣В鏋愬叆闄㈢敵璇峰崟璇︽儏澶辫触锛宎pplyId={}", encounterSourceId, e);
+ }
+ log.info("銆恏ospitalizedApply銆慳pplyId={}锛宨mportanceFlagCode={}锛宔mergencyLevelCode={}", encounterSourceId, applyInfo.get("importanceFlagCode"), applyInfo.get("emergencyLevelCode"));
+ return applyInfo;
+ }
+
+ /**
+ * 澶勭悊鎮h�呮。妗堬紙鏂板鎴栨洿鏂帮級
+ * 浣跨敤 Redis 鍒嗗竷寮忛攣闃叉骞跺彂閲嶅鎻掑叆
+ */
+ private PatArchive processPatientArchive(ServiceSLTDInhospResDTO dto) {
+ // 鏋勫缓閿佺殑 key锛氬熀浜� patientno 鎴� idcardno
+ String lockKey = "pat_archive_lock:" + (StringUtils.isNotEmpty(dto.getMedicalRecordNo()) ? dto.getMedicalRecordNo() : dto.getIdCardNo());
+
+ // 灏濊瘯鑾峰彇鍒嗗竷寮忛攣锛屾渶澶氱瓑寰� 3 绉掞紝閿佸畾 10 绉掕嚜鍔ㄩ噴鏀�
+ Boolean lockAcquired = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 10, TimeUnit.SECONDS);
+
+ if (lockAcquired == null || !lockAcquired) {
+ log.warn("銆恜rocessPatientArchive銆戣幏鍙栧垎甯冨紡閿佸け璐ワ紝璺宠繃鏈澶勭悊锛堝叾浠栫嚎绋嬫鍦ㄥ鐞嗭級锛宲atientno={}", dto.getMedicalRecordNo());
+ // 绛夊緟涓�娈垫椂闂村悗閲嶈瘯鏌ヨ
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ try {
+ return doProcessPatientArchive(dto);
+ } finally {
+ // 閲婃斁閿�
+ if (lockAcquired != null && lockAcquired) {
+ redisTemplate.delete(lockKey);
+ }
+ }
+ }
+
+ /**
+ * 瀹為檯鎵ц鎮h�呮。妗堝鐞嗛�昏緫
+ */
+ private PatArchive doProcessPatientArchive(ServiceSLTDInhospResDTO dto) {
+ List<PatArchive> existingArchives = null;
+ log.info("銆恜rocessPatientArchive銆戞柊澧炴偅鑰呮。妗堬紝鏌ヨ鍏ュ弬淇℃伅patientno:{}锛宨dcardno:{}", dto.getMedicalRecordNo(), dto.getIdCardNo());
+ // 绗竴姝ワ細鎸� patientno 绮剧‘鏌ラ噸锛堜笌鎻掑叆鏃朵娇鐢ㄧ殑 medicalRecordNo 涓�鑷达級
+ String patientno = StringUtils.isEmpty(dto.getMedicalRecordNo()) ? null : dto.getMedicalRecordNo();
+ if (StringUtils.isNotEmpty(patientno)) {
+ PatArchive queryByPatientNo = new PatArchive();
+ queryByPatientNo.setPatientno(patientno);
+ existingArchives = patArchiveService.selectPatArchiveList(queryByPatientNo);
+ log.debug("銆恜rocessPatientArchive銆戞寜patientno鏌ヨ锛宲atientno={}, 缁撴灉鏁伴噺={}", patientno, existingArchives.size());
+ }
+
+ // 绗簩姝ワ細鎸� patientno 鏌ヤ笉鍒版椂锛屾寜 idcardno 鏌ラ噸锛堝垎姝R锛岄伩鍏岮ND鏉′欢婕忔煡锛�
+ if (CollectionUtils.isEmpty(existingArchives) && StringUtils.isNotEmpty(dto.getIdCardNo())) {
+ PatArchive queryByIdCard = new PatArchive();
+ queryByIdCard.setIdcardno(dto.getIdCardNo().trim());
+ existingArchives = patArchiveService.selectPatArchiveList(queryByIdCard);
+ log.debug("銆恜rocessPatientArchive銆戞寜idcardno鏌ヨ锛宨dcardno={}, 缁撴灉鏁伴噺={}", dto.getIdCardNo(), existingArchives.size());
+ }
+
+ PatArchive patArchive = buildPatientArchive(dto);
+ log.info("銆恜rocessPatientArchive銆戞偅鑰呮。妗堟煡閲嶅畬鎴愶紝patientno={}, 鏄惁宸插瓨鍦�={}", patArchive.getPatientno(), CollectionUtils.isEmpty(existingArchives) ? "鍚�" : "鏄�(id=" + existingArchives.get(0).getId() + ")");
+
+ if (CollectionUtils.isEmpty(existingArchives)) {
+ try {
+ // 鏈�缁堢‘璁ゆ煡璇紙闃插尽鎬х紪绋嬶細闃叉Redis閿佸け鏁堢瓑鏋佺鎯呭喌锛�
+ PatArchive finalQuery = new PatArchive();
+ if (StringUtils.isNotEmpty(dto.getIdCardNo())) {
+ finalQuery.setIdcardno(dto.getIdCardNo().trim());
+ }
+ if (StringUtils.isNotEmpty(dto.getMedicalRecordNo())) {
+ finalQuery.setPatientno(dto.getMedicalRecordNo());
+ }
+
+ List<PatArchive> finalCheck = patArchiveService.selectPatArchiveList(finalQuery);
+ log.info("銆恜rocessPatientArchive銆戞渶缁堢‘璁ゆ煡璇紝patientno={}, idcardno={}, 缁撴灉鏁伴噺={}", dto.getMedicalRecordNo(), dto.getIdCardNo(), finalCheck.size());
+
+ if (CollectionUtils.isEmpty(finalCheck)) {
+ patArchiveService.insertPatArchive(patArchive);
+ log.info("銆恜rocessPatientArchive銆戔湏 鏂板鎮h�呮。妗堟垚鍔燂紝patientno={}, id={}", patArchive.getPatientno(), patArchive.getId());
+ } else {
+ // 鍏朵粬绾跨▼宸茬粡鎻掑叆锛岀洿鎺ヤ娇鐢ㄥ凡鏈夎褰�
+ existingArchives = finalCheck;
+ patArchive.setId(existingArchives.get(0).getId());
+ patArchive.setNotrequiredFlag(existingArchives.get(0).getNotrequiredFlag());
+ patArchive.setNotrequiredreason(existingArchives.get(0).getNotrequiredreason());
+ log.info("銆恜rocessPatientArchive銆戞。妗堝凡琚叾浠栫嚎绋嬪垱寤猴紝浣跨敤宸叉湁璁板綍锛宨d={}", patArchive.getId());
+ }
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ log.warn("銆恜rocessPatientArchive銆戞偅鑰呮。妗堝凡瀛樺湪(骞跺彂鎻掑叆寮傚父)锛岃烦杩囷細patientno={}, idcardno={}", patArchive.getPatientno(), patArchive.getIdcardno());
+ // 骞跺彂鎻掑叆鍦烘櫙锛岄噸鏂版煡璇㈣幏鍙栧凡瀛樺湪鐨勮褰�
+ PatArchive queryRetry = new PatArchive();
+ queryRetry.setPatientno(patArchive.getPatientno());
+ if (StringUtils.isNotEmpty(patArchive.getIdcardno())) {
+ queryRetry.setIdcardno(patArchive.getIdcardno());
+ }
+ existingArchives = patArchiveService.selectPatArchiveList(queryRetry);
+ if (CollectionUtils.isNotEmpty(existingArchives)) {
+ patArchive.setId(existingArchives.get(0).getId());
+ patArchive.setNotrequiredFlag(existingArchives.get(0).getNotrequiredFlag());
+ patArchive.setNotrequiredreason(existingArchives.get(0).getNotrequiredreason());
+ log.info("銆恜rocessPatientArchive銆戜粠寮傚父鎭㈠锛岃幏鍙栧凡鏈夋。妗堬紝id={}", patArchive.getId());
+ }
+ }
+ } else {
+ patArchive.setId(existingArchives.get(0).getId());
+ patArchive.setNotrequiredFlag(existingArchives.get(0).getNotrequiredFlag());
+ patArchive.setNotrequiredreason(existingArchives.get(0).getNotrequiredreason());
+ patArchiveService.updateArchive(patArchive);
+ log.info("銆恜rocessPatientArchive銆戔湏 鏇存柊鎮h�呮。妗堬紝patientno={}, id={}", patArchive.getPatientno(), patArchive.getId());
+ }
+
+ return patArchive;
+ }
+
+ private PatArchive buildPatientArchive(ServiceSLTDInhospResDTO dto) {
+ PatArchive patArchive = new PatArchive();
+ patArchive.setPatientno(StringUtils.isEmpty(dto.getMedicalRecordNo()) ? null : dto.getMedicalRecordNo());
+ patArchive.setPatidHis(dto.getPatientId() == null ? null : String.valueOf(dto.getPatientId()));
+ patArchive.setIdcardno(StringUtils.isEmpty(dto.getIdCardNo()) ? "" + dto.getMedicalCardId() : dto.getIdCardNo().trim());
+ patArchive.setName(dto.getPatientName());
+ patArchive.setSourcefrom(2L);
+ patArchive.setPattype("2");
+ patArchive.setSex("鐢�".equals(dto.getGender()) ? 1L : 2L);
+ patArchive.setNation(dto.getNation());
+ patArchive.setNativePlace(dto.getNativePlace());
+ patArchive.setPlaceOfResidence(dto.getAddress());
+ patArchive.setBirthdate(parseDate(dto.getBirthday()));
+ patArchive.setTelcode(dto.getPhone());
+ if (CollectionUtils.isNotEmpty(dto.getResidentContactInfos())) {
+ patArchive.setRelativetelcode(dto.getResidentContactInfos().get(0).getTelecom());
+ }
+ patArchive.setDelFlag("0");
+ patArchive.setCreateTime(new Date());
+ patArchive.setUpdateTime(new Date());
+ patArchive.setOrgid("" + dto.getOrgId());
+ patArchive.setCampusid(dto.getCampusId());
+ return patArchive;
+ }
+
+ private ServiceSLTDInhospResDTO convertToDTO(Map<String, Object> dataItem) {
+ ServiceSLTDInhospResDTO dto = new ServiceSLTDInhospResDTO();
+ dto.setOrgId(getStringValue(dataItem, "orgId"));
+ dto.setCampusId(getStringValue(dataItem, "campusId"));
+ dto.setHealthcareRecordId(getLongValue(dataItem, "healthcareRecordId"));
+ dto.setHealthcareRecordNo(getStringValue(dataItem, "healthcareRecordNo"));
+ dto.setPatientId(getLongValue(dataItem, "patientId"));
+ dto.setPatientName(getStringValue(dataItem, "patientName"));
+ dto.setPinyin(getStringValue(dataItem, "pinyin"));
+ dto.setNation(getStringValue(dataItem, "nation"));
+ dto.setIdCardNo(getStringValue(dataItem, "idCardNo"));
+ dto.setHealthcareRecordTimes(getIntegerValue(dataItem, "healthcareRecordTimes"));
+ dto.setHospitalizationNumber(getIntegerValue(dataItem, "hospitalizationNumber"));
+ dto.setMedicalCardId(getLongValue(dataItem, "medicalCardId"));
+ dto.setMedicalCardType(getStringValue(dataItem, "medicalCardType"));
+ dto.setMedicalCardTypeName(getStringValue(dataItem, "medicalCardTypeName"));
+ dto.setMedicalCardNo(getStringValue(dataItem, "medicalCardNo"));
+ dto.setMedicalRecordNo(getStringValue(dataItem, "medicalRecordNo"));
+ dto.setGender(getStringValue(dataItem, "gender"));
+ dto.setGenderCode(getStringValue(dataItem, "genderCode"));
+ dto.setAge(getStringValue(dataItem, "age"));
+ dto.setBirthday(getStringValue(dataItem, "birthday"));
+ dto.setPhone(getStringValue(dataItem, "phone"));
+ dto.setEducation(getStringValue(dataItem, "education"));
+ dto.setEducationCode(getStringValue(dataItem, "educationCode"));
+ dto.setNeonatal(getBooleanValue(dataItem, "neonatal"));
+ dto.setMarriage(getStringValue(dataItem, "marriage"));
+ dto.setMarriageCode(getStringValue(dataItem, "marriageCode"));
+ dto.setOccupationType(getStringValue(dataItem, "occupationType"));
+ dto.setOccupationTypeCode(getStringValue(dataItem, "occupationTypeCode"));
+ dto.setNativePlace(getStringValue(dataItem, "nativePlace"));
+ dto.setAreaId(getLongValue(dataItem, "areaId"));
+ dto.setAreaName(getStringValue(dataItem, "areaName"));
+ dto.setRoomId(getLongValue(dataItem, "roomId"));
+ dto.setRoomNumber(getStringValue(dataItem, "roomNumber"));
+ dto.setBedId(getLongValue(dataItem, "bedId"));
+ dto.setBedNumber(getStringValue(dataItem, "bedNumber"));
+ dto.setEncounterTime(getStringValue(dataItem, "encounterTime"));
+ dto.setStartTime(getStringValue(dataItem, "startTime"));
+ dto.setPreOutHospitalDate(getStringValue(dataItem, "preOutHospitalDate"));
+ dto.setLastEncounterTime(getStringValue(dataItem, "lastEncounterTime"));
+ dto.setDiagnosisCode(getStringValue(dataItem, "diagnosisCode"));
+ dto.setDiagnosisName(getStringValue(dataItem, "diagnosisName"));
+ dto.setHealthcareRecordStatus(getStringValue(dataItem, "healthcareRecordStatus"));
+ dto.setHealthcareType(getStringValue(dataItem, "healthcareType"));
+ dto.setDeptId(getLongValue(dataItem, "deptId"));
+ dto.setDeptName(getStringValue(dataItem, "deptName"));
+ dto.setDoctorId(getLongValue(dataItem, "doctorId"));
+ dto.setDoctorName(getStringValue(dataItem, "doctorName"));
+ dto.setHealthcarePeriodId(getLongValue(dataItem, "healthcarePeriodId"));
+ dto.setChiefNurseId(getLongValue(dataItem, "chiefNurseId"));
+ dto.setChiefNurseName(getStringValue(dataItem, "chiefNurseName"));
+ dto.setCostCategoryName(getStringValue(dataItem, "costCategoryName"));
+ dto.setCostCategoryCode(getStringValue(dataItem, "costCategoryCode"));
+ dto.setCostNatureName(getStringValue(dataItem, "costNatureName"));
+ dto.setCostNatureCode(getStringValue(dataItem, "costNatureCode"));
+ dto.setEncounterSourceId(getStringValue(dataItem, "encounterSourceId"));
+ dto.setFurtherConsultationStatus(getIntegerValue(dataItem, "furtherConsultationStatus"));
+ Object mainDiagObj = dataItem.get("mainDischargeDiagnosis");
+ if (mainDiagObj instanceof Map) {
+ Map<String, Object> mainDiagMap = (Map<String, Object>) mainDiagObj;
+ ServiceSLTDDiagnosisResDTO mainDiag = new ServiceSLTDDiagnosisResDTO();
+ mainDiag.setDiagnosisDictCode(getStringValue(mainDiagMap, "diagnosisDictCode"));
+ mainDiag.setDiagnosisDictName(getStringValue(mainDiagMap, "diagnosisDictName"));
+ mainDiag.setDiagnosisCategory(getStringValue(mainDiagMap, "diagnosisCategory"));
+ mainDiag.setRecordType(getIntegerValue(mainDiagMap, "recordType"));
+ mainDiag.setIsMainDiagnosis(getIntegerValue(mainDiagMap, "isMainDiagnosis"));
+ dto.setMainDischargeDiagnosis(mainDiag);
+ }
+ Object contactsObj = dataItem.get("residentContactInfos");
+ if (contactsObj instanceof List) {
+ dto.setResidentContactInfos(parseContacts((List<?>) contactsObj));
+ }
+
+ Object diagnosisObj = dataItem.get("diagnosisList");
+ if (diagnosisObj instanceof List) {
+ dto.setDiagnosisList(parseDiagnosis((List<?>) diagnosisObj));
+ }
+
+ return dto;
+ }
+
+ private MedicationItem convertToMedication(Map<String, Object> dataItem) {
+ MedicationItem dto = new MedicationItem();
+ dto.setOrgId(getLongValue(dataItem, "orgId"));
+ dto.setIdentificationCode(getStringValue(dataItem, "identificationCode"));
+ dto.setWbm(getStringValue(dataItem, "wbm"));
+ dto.setMedicationCommonName(getStringValue(dataItem, "medicationCommonName"));
+ dto.setManufacturerName(getStringValue(dataItem, "manufacturerName"));
+ dto.setItemCode(getStringValue(dataItem, "itemCode"));
+ dto.setSmallLargePackageRatio(getLongValue(dataItem, "smallLargePackageRatio"));
+ dto.setRemark(getStringValue(dataItem, "remark"));
+ dto.setItemName(getStringValue(dataItem, "itemName"));
+ dto.setMedicationType(getStringValue(dataItem, "medicationType"));
+ Object mainDiagObj = dataItem.get("doseInfoList");
+ List<MedicationDoseInfo> doseInfoList = new ArrayList<>();
+ if (mainDiagObj instanceof List) {
+ List<Map<String, Object>> mainDiagList = (List<Map<String, Object>>) mainDiagObj;
+ for (Map<String, Object> mainDiagMap : mainDiagList) {
+ MedicationDoseInfo medicationDoseInfo = new MedicationDoseInfo();
+ medicationDoseInfo.setDoseSmallPackageRation(getBigDecimalValue(mainDiagMap, "doseSmallPackageRation"));
+ medicationDoseInfo.setDose(getLongValue(mainDiagMap, "dose"));
+ medicationDoseInfo.setDoseSmallPackageNum(getLongValue(mainDiagMap, "doseSmallPackageNum"));
+ medicationDoseInfo.setDoseUnit(getStringValue(mainDiagMap, "doseUnit"));
+ medicationDoseInfo.setDoseUnitType(getLongValue(mainDiagMap, "doseUnitType"));
+ doseInfoList.add(medicationDoseInfo);
+ }
+ }
+ dto.setDoseInfoList(doseInfoList);
+ dto.setAntimicrobialGradeCode(getStringValue(dataItem, "antimicrobialGradeCode"));
+ dto.setLicenseNumber(getStringValue(dataItem, "licenseNumber"));
+ dto.setDefaultUsageName(getStringValue(dataItem, "defaultUsageName"));
+ dto.setSpecialDrugsName(getStringValue(dataItem, "specialDrugsName"));
+ dto.setAntimicrobialGradeName(getStringValue(dataItem, "antimicrobialGradeName"));
+ dto.setCommonPinyin(getStringValue(dataItem, "commonPinyin"));
+ dto.setCommonWbm(getStringValue(dataItem, "commonWbm"));
+ dto.setManufacturerId(getLongValue(dataItem, "manufacturerId"));
+ dto.setDefaultUsageId(getLongValue(dataItem, "defaultUsageId"));
+ dto.setSpecification(getStringValue(dataItem, "specification"));
+ dto.setSmallPackageUnit(getStringValue(dataItem, "smallPackageUnit"));
+ dto.setItemId(getLongValue(dataItem, "itemId"));
+ dto.setSpecialDrugsCode(getStringValue(dataItem, "specialDrugsCode"));
+ dto.setPinyin(getStringValue(dataItem, "pinyin"));
+ dto.setDoseFormName(getStringValue(dataItem, "doseFormName"));
+ dto.setLargePackageUnit(getStringValue(dataItem, "largePackageUnit"));
+ dto.setRetailPrice(getBigDecimalValue(dataItem, "retailPrice"));
+ dto.setStatus(getLongValue(dataItem, "status"));
+ return dto;
+ }
+
+
+ private List<ServiceSLTDContactsResDTO> parseContacts(List<?> contactsList) {
+ List<ServiceSLTDContactsResDTO> contacts = new ArrayList<>();
+ for (Object contactObj : contactsList) {
+ if (contactObj instanceof Map) {
+ Map<String, Object> contactMap = (Map<String, Object>) contactObj;
+ ServiceSLTDContactsResDTO contact = new ServiceSLTDContactsResDTO();
+ contact.setName(getStringValue(contactMap, "name"));
+ contact.setRelationshipCode(getStringValue(contactMap, "relationshipCode"));
+ contact.setRelationship(getStringValue(contactMap, "relationship"));
+ contact.setTelecom(getStringValue(contactMap, "telecom"));
+ contact.setCurrentAddress(getStringValue(contactMap, "currentAddress"));
+ contacts.add(contact);
+ }
+ }
+ return contacts;
+ }
+
+ private List<ServiceSLTDDiagnosisResDTO> parseDiagnosis(List<?> diagnosisList) {
+ List<ServiceSLTDDiagnosisResDTO> diagnosis = new ArrayList<>();
+ for (Object diagnosisObj : diagnosisList) {
+ if (diagnosisObj instanceof Map) {
+ Map<String, Object> diagnosisMap = (Map<String, Object>) diagnosisObj;
+ ServiceSLTDDiagnosisResDTO diag = new ServiceSLTDDiagnosisResDTO();
+ diag.setDiagnosisDictCode(getStringValue(diagnosisMap, "diagnosisDictCode"));
+ diag.setDiagnosisDictName(getStringValue(diagnosisMap, "diagnosisDictName"));
+ diag.setDiagnosisCategory(getStringValue(diagnosisMap, "diagnosisCategory"));
+ diag.setRecordType(getIntegerValue(diagnosisMap, "recordType"));
+ diag.setIsMainDiagnosis(getIntegerValue(diagnosisMap, "isMainDiagnosis"));
+ diagnosis.add(diag);
+ }
+ }
+ return diagnosis;
+ }
+
+ private String getStringValue(Map<String, Object> map, String key) {
+ Object value = map.get(key);
+ if (value == null) {
+ return null;
+ }
+
+ // 鍙鐞嗘暟瀛楃被鍨嬶紝閬垮厤绉戝璁℃暟娉�
+ return value instanceof Number ? new BigDecimal(value.toString()).toPlainString() : value.toString();
+ }
+
+ private BigDecimal getBigDecimalValue(Map<String, Object> map, String key) {
+ Object value = map.get(key);
+ if (value == null) {
+ return null;
+ }
+
+ // 鍙鐞嗘暟瀛楃被鍨嬶紝閬垮厤绉戝璁℃暟娉�
+ return new BigDecimal(value.toString());
+ }
+
+ private Long getLongValue(Map<String, Object> map, String key) {
+ Object value = map.get(key);
+ if (value == null) return null;
+ if (value instanceof Number) {
+ return ((Number) value).longValue();
+ }
+ try {
+ return Long.parseLong(value.toString());
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ }
+
+ private Integer getIntegerValue(Map<String, Object> map, String key) {
+ Object value = map.get(key);
+ if (value == null) return null;
+ if (value instanceof Number) {
+ return ((Number) value).intValue();
+ }
+ try {
+ return Integer.parseInt(value.toString());
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ }
+
+ private Boolean getBooleanValue(Map<String, Object> map, String key) {
+ Object value = map.get(key);
+ if (value == null) return null;
+ if (value instanceof Boolean) {
+ return (Boolean) value;
+ }
+ return Boolean.parseBoolean(value.toString());
+ }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/XHGatherPatArchiveServiceImpl.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/XHGatherPatArchiveServiceImpl.java
new file mode 100644
index 0000000..ee318ce
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/XHGatherPatArchiveServiceImpl.java
@@ -0,0 +1,593 @@
+package com.ruoyi.datacollection.service.impl;
+
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.entity.SysUserDept;
+import com.ruoyi.common.core.domain.entity.SysUserRole;
+import com.ruoyi.common.utils.HttpUtil;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.http.HttpUtils;
+import com.ruoyi.message.SendResult;
+import com.ruoyi.message.sms.SmsSendRequest;
+import com.ruoyi.message.sms.SmsSenderFactory;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
+import com.ruoyi.inhospvisit.api.InhospVisitFacade;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.lang.reflect.Type;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import com.ruoyi.common.core.domain.entity.PatArchive;
+import com.ruoyi.patarchive.service.IPatArchiveService;
+import com.ruoyi.datacollection.service.IXHGatherPatArchiveService;
+import com.ruoyi.datacollection.domain.ServiceAppointRecord;
+import com.ruoyi.datacollection.service.IServiceAppointRecordService;
+import com.ruoyi.datacollection.domain.ThiedInhospInfo;
+
+/**
+ * 鏂板崕鏁版嵁閲囬泦澶勭悊
+ *
+ * @author smartor
+ * @date 2023-03-04
+ */
+@Slf4j
+@Service
+public class XHGatherPatArchiveServiceImpl implements IXHGatherPatArchiveService {
+
+ @Value("${hosp_info_url}")
+ private String hospInfoUrl;
+ @Autowired
+ InhospVisitFacade inhospVisitFacade;
+ @Autowired
+ IPatArchiveService patArchiveService;
+ @Autowired
+ IServiceAppointRecordService iServiceAppointRecordService;
+ @Autowired
+ private SysConfigMapper sysConfigMapper;
+
+ /**
+ * 娑堟伅鍙戦�佹柟宸ュ巶锛堢煭淇�/寰俊鍏紬鍙凤級锛屾浛浠e師鏉ョ洿鎺ユ敞鍏� xhsms* 閰嶇疆 + HttpUtils 鐨勫啓娉�
+ */
+ @Autowired
+ private SmsSenderFactory smsSenderFactory;
+
+
+ /**
+ * 鑾峰彇鎮h�呭嚭鍏ラ櫌淇℃伅
+ *
+ * @param cry 鍑哄叆闄㈢被鍨嬶細0-鍏ラ櫌锛�1-鍑洪櫌
+ * @param startTime 寮�濮嬫椂闂�
+ * @param endTime 缁撴潫鏃堕棿
+ */
+ @Transactional
+ public void getInHospDataGather(String cry, LocalDateTime startTime, LocalDateTime endTime) {
+ String typeName = "0".equals(cry) ? "鍏ラ櫌" : "鍑洪櫌";
+ log.info("銆恎etInHospInfo銆戝紑濮嬭幏鍙杮}鎮h�呬俊鎭紝鏃堕棿鑼冨洿锛歿} ~ {}", typeName, startTime, endTime);
+ long startTimeMillis = System.currentTimeMillis();
+
+ try {
+ // 绗竴姝ワ細鏋勫缓璇锋眰鍙傛暟骞惰皟鐢℉IS鎺ュ彛
+ List<ThiedInhospInfo> thiedInhospInfoList = fetchHisData(cry, startTime, endTime);
+
+ if (CollectionUtils.isEmpty(thiedInhospInfoList)) {
+ log.info("銆恎etInHospInfo銆憑}鎮h�呬俊鎭负绌猴紝璺宠繃澶勭悊", typeName);
+ return;
+ }
+
+ log.info("銆恎etInHospInfo銆戣幏鍙栧埌{}鏉}鎮h�呬俊鎭�", thiedInhospInfoList.size(), typeName);
+
+ // 绗簩姝ワ細淇濆瓨鍘熷鏁版嵁鍒版枃浠讹紙鐢ㄤ簬澶囦唤锛�
+ saveRawDataToFile(cry, thiedInhospInfoList);
+
+ // 绗笁姝ワ細澶勭悊鎮h�呮暟鎹�
+ processPatientData(thiedInhospInfoList, cry);
+
+ long endTimeMillis = System.currentTimeMillis();
+ log.info("銆恎etInHospInfo銆憑}鎮h�呬俊鎭鐞嗗畬鎴愶紝鑰楁椂锛歿}ms", typeName, endTimeMillis - startTimeMillis);
+
+ } catch (Exception e) {
+ log.error("銆恎etInHospInfo銆戣幏鍙杮}鎮h�呬俊鎭紓甯�", typeName, e);
+ throw new RuntimeException("鑾峰彇" + typeName + "鎮h�呬俊鎭け璐�", e);
+ }
+ }
+
+ /**
+ * 鑾峰彇棰勭害鍋滆瘖璁板綍淇℃伅
+ *
+ * @param cry 鍑哄叆闄㈢被鍨嬶細0-鍏ラ櫌锛�1-鍑洪櫌 2,棰勭害璁板綍
+ * @param startTime 寮�濮嬫椂闂�
+ * @param endTime 缁撴潫鏃堕棿
+ */
+ public void getAppointRecordInfo(String cry, LocalDateTime startTime, LocalDateTime endTime) {
+ log.info("銆恎etAppointRecordInfo銆戝紑濮嬭幏鍙栧彇棰勭害鍋滆瘖璁板綍淇℃伅锛屾椂闂磋寖鍥达細{} ~ {}", startTime, endTime);
+ long startTimeMillis = System.currentTimeMillis();
+
+ try {
+ // 绗竴姝ワ細鏋勫缓璇锋眰鍙傛暟骞惰皟鐢℉IS鎺ュ彛
+ List<ServiceAppointRecord> appointRecordFromHIS = getAppointRecordFromHIS(cry, startTime, endTime);
+
+ if (CollectionUtils.isEmpty(appointRecordFromHIS)) {
+ log.info("銆恎etAppointRecordInfo銆戣幏鍙栭绾﹀仠璇婅褰曚俊鎭负绌猴紝璺宠繃澶勭悊");
+ return;
+ }
+ log.info("銆恎etAppointRecordInfo銆戣幏鍙栭绾﹀仠璇婅褰曚俊鎭瘂}鏉�", appointRecordFromHIS.size());
+ SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("yytz.sms.template");
+ if (sysConfig != null) {
+ String smsContemt = sysConfig.getConfigValue();
+ // 绗簩姝ワ細澶勭悊鍋滆瘖璁板綍淇℃伅
+ for (ServiceAppointRecord serviceAppointRecord : appointRecordFromHIS) {
+ String replace = smsContemt.replace("${patFileName}", StringUtils.defaultString(serviceAppointRecord.getPatFileName())).replace("${registTimeRange}", StringUtils.defaultString(serviceAppointRecord.getRegistTimeRange())).replace("${registDeptName}", StringUtils.defaultString(serviceAppointRecord.getRegistDeptName())).replace("${treatDoctName}", StringUtils.defaultString(serviceAppointRecord.getTreatDoctName()));
+ //鐭俊鍙戦�佸凡鏀跺彛鍒� ruoyi-message 妯″潡锛堟柊鍗庨�氶亾璧拌〃鍗曟ā寮忥紝涓庡師瀹炵幇涓�鑷达級
+ SendResult sendResult = smsSenderFactory.send("xh",
+ SmsSendRequest.of(serviceAppointRecord.getPatTel(), replace));
+ if (sendResult.isOk()) {
+ log.info("---澶勭悊鍋滆瘖璁板綍淇℃伅鍙戦�佹垚鍔�,鍏ュ弬涓�:{}", sendResult.getRawResponse());
+ serviceAppointRecord.setSendTime(new Date());
+ serviceAppointRecord.setSenderName("绯荤粺绠$悊鍛�");
+ iServiceAppointRecordService.insertServiceAppointRecord(serviceAppointRecord);
+ } else {
+ log.info("澶勭悊鍋滆瘖璁板綍淇℃伅鍙戦�佸け璐�");
+ iServiceAppointRecordService.insertServiceAppointRecord(serviceAppointRecord);
+ }
+ }
+ }
+ long endTimeMillis = System.currentTimeMillis();
+ log.info("銆恎etAppointRecordInfo銆憑},棰勭害鍋滆瘖璁板綍淇℃伅澶勭悊瀹屾垚锛岃�楁椂锛歿}ms", endTimeMillis - startTimeMillis);
+
+ } catch (Exception e) {
+ log.error("銆恎etAppointRecordInfo銆戣幏鍙栭绾﹀仠璇婅褰曚俊鎭鐞嗗紓甯�", e);
+ throw new RuntimeException("鑾峰彇棰勭害鍋滆瘖璁板綍淇℃伅澶勭悊寮傚父", e);
+ }
+ }
+
+
+ /**
+ * 绗竴姝ワ細璋冪敤HIS鎺ュ彛鑾峰彇鏁版嵁
+ */
+ private List<ThiedInhospInfo> fetchHisData(String cry, LocalDateTime startTime, LocalDateTime endTime) {
+ try {
+ // 鏋勫缓璇锋眰鍙傛暟
+ Map<String, String> requestParams = buildRequestParams(cry, startTime, endTime);
+
+ // 鏋勫缓璇锋眰澶�
+ Map<String, String> headers = buildRequestHeaders(startTime);
+
+ // 鍙戦�丠TTP璇锋眰
+ String result = HttpUtils.sendPostByHeader(hospInfoUrl, new Gson().toJson(requestParams), headers);
+
+ // 瑙f瀽鍝嶅簲鏁版嵁
+ return parseResponseData(result);
+
+ } catch (Exception e) {
+ log.error("銆恌etchHisData銆戣皟鐢℉IS鎺ュ彛寮傚父", e);
+ throw e;
+ }
+ }
+
+
+ private List<ServiceAppointRecord> getAppointRecordFromHIS(String cry, LocalDateTime startTime, LocalDateTime endTime) {
+ try {
+ // 鏋勫缓璇锋眰鍙傛暟
+ Map<String, String> requestParams = buildRequestParams(cry, startTime, endTime);
+
+ // 鏋勫缓璇锋眰澶�
+ Map<String, String> headers = buildRequestHeaders(startTime);
+
+ // 鍙戦�丠TTP璇锋眰
+ log.info("銆恎etAppointRecordFromHIS銆戝彂閫丠TTP璇锋眰锛岃姹傚弬鏁帮細{},璇锋眰鍦板潃锛歿}", new Gson().toJson(requestParams), hospInfoUrl);
+ String result = HttpUtils.sendPostByHeader(hospInfoUrl, new Gson().toJson(requestParams), headers);
+
+ // 瑙f瀽鍝嶅簲鏁版嵁
+ return parseResponseData2(result);
+
+ } catch (Exception e) {
+ log.error("銆恌etchHisData銆戣皟鐢℉IS鎺ュ彛寮傚父", e);
+ throw e;
+ }
+ }
+
+
+ /**
+ * 绗簩姝ワ細淇濆瓨鍘熷鏁版嵁鍒版枃浠�
+ */
+ private void saveRawDataToFile(String cry, List<ThiedInhospInfo> dataList) {
+ try {
+ String typeName = "0".equals(cry) ? "鍏ラ櫌淇℃伅" : "鍑洪櫌淇℃伅";
+ String filename = typeName + "_" + System.currentTimeMillis() + ".json";
+ String filePath = "D:\\public\\HIS鏁版嵁閲囬泦\\" + filename;
+
+ File file = new File(filePath);
+ File parentDir = file.getParentFile();
+ if (!parentDir.exists()) {
+ parentDir.mkdirs();
+ }
+
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+
+ // 灏嗘暟鎹啓鍏ユ枃浠�
+ try (FileWriter writer = new FileWriter(file)) {
+ writer.write(new Gson().toJson(dataList));
+ }
+
+ log.info("銆恠aveRawDataToFile銆戝師濮嬫暟鎹凡淇濆瓨鍒版枃浠讹細{}", filePath);
+
+ } catch (Exception e) {
+ log.error("銆恠aveRawDataToFile銆戜繚瀛樺師濮嬫暟鎹埌鏂囦欢寮傚父", e);
+ // 鏂囦欢淇濆瓨澶辫触涓嶅奖鍝嶄富娴佺▼锛屽彧璁板綍鏃ュ織
+ }
+ }
+
+ /**
+ * 绗笁姝ワ細澶勭悊鎮h�呮暟鎹�
+ */
+ private void processPatientData(List<ThiedInhospInfo> thiedInhospInfoList, String cry) {
+ int successCount = 0;
+ int skipCount = 0;
+ int errorCount = 0;
+
+ for (ThiedInhospInfo thiedInhospInfo : thiedInhospInfoList) {
+ try {
+ if (processSinglePatient(thiedInhospInfo, cry)) {
+ successCount++;
+ } else {
+ skipCount++;
+ }
+ } catch (Exception e) {
+ errorCount++;
+ log.error("銆恜rocessPatientData銆戝鐞嗘偅鑰呮暟鎹紓甯革紝鎮h�匢D锛歿}", thiedInhospInfo.getPatiMediaNo(), e);
+ }
+ }
+
+ log.info("銆恜rocessPatientData銆戞偅鑰呮暟鎹鐞嗗畬鎴愶紝鎴愬姛锛歿}锛岃烦杩囷細{}锛屽け璐ワ細{}", successCount, skipCount, errorCount);
+ }
+
+ /**
+ * 鏋勫缓璇锋眰澶�
+ */
+ private Map<String, String> buildRequestHeaders(LocalDateTime startTime) {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
+ Map<String, String> header = new HashMap<>();
+// header.put("x-hcsb-serviceno", "IS044056");
+ header.put("x-hcsb-serviceno", "IS002347");
+ header.put("x-hcsb-version", "2.0");
+ header.put("x-hcsb-sourcesyscode", "14");
+ header.put("x-hcsb-token", "ArGE2JnHtxG/Zx5nrnGY4eOfMUJGGJokAJHigG1BrCY=");
+ header.put("x-hcsb-msgdate", startTime.format(formatter));
+ return header;
+ }
+
+
+ /**
+ * 鏋勫缓璇锋眰鍙傛暟
+ */
+ private Map<String, String> buildRequestParams(String cry, LocalDateTime startTime, LocalDateTime endTime) {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
+ Map<String, String> req = new HashMap<>();
+
+ if ("1".equals(cry)) {
+ // 鍑洪櫌鍙傛暟
+ req.put("cashStartDate", startTime.format(formatter));
+ req.put("cashEndDate", endTime.format(formatter));
+ req.put("currStatus", "4");
+ } else if ("0".equals(cry)) {
+ // 鍏ラ櫌鍙傛暟
+ req.put("admissStartDate", startTime.format(formatter));
+ req.put("admissEndDate", endTime.format(formatter));
+ req.put("currStatus", "2");
+ } else if ("2".equals(cry)) {
+ // 棰勭害璁板綍鏌ヨ
+ req.put("appointRegistDateBegin", startTime.format(formatter));
+ req.put("appointRegistDateEnd", endTime.format(formatter));
+ // 鎺掔彮鍋滆瘖 锛堥绾︾姸鎬佹爣蹇�(0:宸查绾� 1:宸叉寕鍙� 2:宸查��鍙� 3:宸插氨璇� -1:鐥呬汉鍙栨秷 -2:鍖婚櫌鍙栨秷 -3:鎺掔彮鍋滆瘖)锛�
+ req.put("scheduleStatusFlag", "-3");
+ }
+
+ return req;
+ }
+
+ /**
+ * 瑙f瀽鍝嶅簲鏁版嵁
+ */
+ private List<ThiedInhospInfo> parseResponseData(String result) {
+ try {
+ Gson gson = new Gson();
+ JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
+
+ // 鏍¢獙data瀛楁鏄惁涓篔sonObject
+ JsonElement dataElement = jsonObject.get("data");
+ if (dataElement == null || !dataElement.isJsonObject()) {
+ log.info("銆恜arseResponseData銆戝搷搴旀暟鎹腑data瀛楁涓虹┖鎴栭潪瀵硅薄绫诲瀷锛屽師濮嬫暟鎹細{}", result);
+ return new ArrayList<>();
+ }
+
+ JsonObject dataObject = dataElement.getAsJsonObject();
+ JsonElement resultElement = dataObject.get("result");
+ if (resultElement == null || !resultElement.isJsonArray()) {
+ log.info("銆恜arseResponseData銆戝搷搴旀暟鎹腑result瀛楁涓虹┖鎴栭潪鏁扮粍绫诲瀷锛屽師濮嬫暟鎹細{}", result);
+ return new ArrayList<>();
+ }
+
+ JsonArray resultArray = resultElement.getAsJsonArray();
+ Type resultType = new TypeToken<List<ThiedInhospInfo>>() {
+ }.getType();
+ return gson.fromJson(resultArray, resultType);
+ } catch (Exception e) {
+ log.error("銆恜arseResponseData銆戣В鏋愬搷搴旀暟鎹紓甯革紝鍘熷鏁版嵁锛歿}", result, e);
+ throw e;
+ }
+ }
+
+ /**
+ * 瑙f瀽鍝嶅簲鏁版嵁
+ */
+ private List<ServiceAppointRecord> parseResponseData2(String result) {
+ try {
+ Gson gson = new Gson();
+ JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
+
+ // 鏍¢獙data瀛楁鏄惁涓篔sonObject
+ JsonElement dataElement = jsonObject.get("data");
+ if (dataElement == null || !dataElement.isJsonObject()) {
+ log.warn("銆恜arseResponseData2銆戝搷搴旀暟鎹腑data瀛楁涓虹┖鎴栭潪瀵硅薄绫诲瀷锛屽師濮嬫暟鎹細{}", result);
+ return new ArrayList<>();
+ }
+
+ JsonObject dataObject = dataElement.getAsJsonObject();
+ JsonElement resultElement = dataObject.get("result");
+ if (resultElement == null || !resultElement.isJsonArray()) {
+ log.warn("銆恜arseResponseData2銆戝搷搴旀暟鎹腑result瀛楁涓虹┖鎴栭潪鏁扮粍绫诲瀷锛屽師濮嬫暟鎹細{}", result);
+ return new ArrayList<>();
+ }
+
+ JsonArray resultArray = resultElement.getAsJsonArray();
+ Type resultType = new TypeToken<List<ServiceAppointRecord>>() {
+ }.getType();
+ return gson.fromJson(resultArray, resultType);
+ } catch (Exception e) {
+ log.error("銆恜arseResponseData2銆戣В鏋愬搷搴旀暟鎹紓甯革紝鍘熷鏁版嵁锛歿}", result, e);
+ throw e;
+ }
+ }
+
+
+ /**
+ * 澶勭悊鍗曚釜鎮h�呮暟鎹�
+ */
+ private boolean processSinglePatient(ThiedInhospInfo thiedInhospInfo, String cry) {
+ // 楠岃瘉韬唤璇佸彿
+ if (StringUtils.isEmpty(thiedInhospInfo.getPatiIdCardNo())) {
+ log.warn("銆恜rocessSinglePatient銆戞偅鑰呰韩浠借瘉鍙蜂负绌猴紝璺宠繃澶勭悊锛屾偅鑰呯紪鍙凤細{}", thiedInhospInfo.getPatiMediaNo());
+ return false;
+ }
+
+ // 澶勭悊鎮h�呮。妗堜俊鎭�
+ PatArchive patArchive = processPatientArchive(thiedInhospInfo, cry);
+
+ // 澶勭悊鎮h�呬綇闄俊鎭�
+ processPatientInhospInfo(thiedInhospInfo, patArchive, cry);
+
+ return true;
+ }
+
+ /**
+ * 澶勭悊鎮h�呮。妗堜俊鎭�
+ */
+ private PatArchive processPatientArchive(ThiedInhospInfo thiedInhospInfo, String cry) {
+ // 鏌ヨ鎮h�呮槸鍚﹀凡瀛樺湪
+ PatArchive queryArchive = new PatArchive();
+ queryArchive.setIdcardno(thiedInhospInfo.getPatiIdCardNo().trim());
+ List<PatArchive> existingArchives = patArchiveService.selectPatArchiveList(queryArchive);
+
+ // 鏋勫缓鎮h�呮。妗堜俊鎭�
+ PatArchive patArchive = buildPatientArchive(thiedInhospInfo, cry);
+
+ // 淇濆瓨鎴栨洿鏂版偅鑰呮。妗�
+ if (CollectionUtils.isEmpty(existingArchives)) {
+ patArchiveService.insertPatArchive(patArchive);
+ log.debug("銆恜rocessPatientArchive銆戞柊澧炴偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno());
+ } else {
+ patArchive.setId(existingArchives.get(0).getId());
+ patArchiveService.updateArchive(patArchive);
+ log.debug("銆恜rocessPatientArchive銆戞洿鏂版偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno());
+ }
+
+ return patArchive;
+ }
+
+ /**
+ * 澶勭悊鎮h�呬綇闄俊鎭�
+ */
+ private void processPatientInhospInfo(ThiedInhospInfo thiedInhospInfo, PatArchive patArchive, String cry) {
+ // 鏋勫缓浣忛櫌淇℃伅
+ PatMedInhosp patMedInhosp = buildPatientInhospInfo(thiedInhospInfo, patArchive, cry);
+
+ // 鏌ヨ鏄惁宸插瓨鍦ㄤ綇闄㈣褰�
+ PatMedInhosp queryInhosp = new PatMedInhosp();
+ queryInhosp.setPatno(patArchive.getPatientno());
+ queryInhosp.setSerialnum(patMedInhosp.getSerialnum());
+ queryInhosp.setCry(Integer.valueOf(cry));
+ List<PatMedInhosp> existingInhosps = inhospVisitFacade.selectPatMedInhospList(queryInhosp);
+
+ // 淇濆瓨鎴栨洿鏂颁綇闄俊鎭�
+ if (CollectionUtils.isNotEmpty(existingInhosps)) {
+ patMedInhosp.setInhospid(existingInhosps.get(0).getInhospid());
+ inhospVisitFacade.updatePatMedInhosp(patMedInhosp);
+ log.debug("銆恜rocessPatientInhospInfo銆戞洿鏂颁綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}", patArchive.getPatientno(), patMedInhosp.getSerialnum());
+ } else {
+ inhospVisitFacade.insertPatMedInhosp(patMedInhosp);
+ log.debug("銆恜rocessPatientInhospInfo銆戞柊澧炰綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}", patArchive.getPatientno(), patMedInhosp.getSerialnum());
+ }
+ }
+
+
+ /**
+ * 鏋勫缓鎮h�呬綇闄俊鎭�
+ */
+ private PatMedInhosp buildPatientInhospInfo(ThiedInhospInfo thiedInhospInfo, PatArchive patArchive, String cry) {
+ PatMedInhosp patMedInhosp = new PatMedInhosp();
+
+ // 鎮h�呭熀鏈俊鎭�
+ patMedInhosp.setPatid(patArchive.getId());
+ patMedInhosp.setPatno(patArchive.getPatientno());
+ patMedInhosp.setPatname(patArchive.getName());
+
+ // 鎶ょ悊淇℃伅
+ patMedInhosp.setNurseId(thiedInhospInfo.getNurseId());
+ patMedInhosp.setNurseName(thiedInhospInfo.getNurseName());
+
+ // 浣忛櫌淇℃伅
+ patMedInhosp.setSerialnum(thiedInhospInfo.getInpatientId());
+ patMedInhosp.setFuflag("1");
+ if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1"))
+ patMedInhosp.setFuflag("0");
+ patMedInhosp.setInhospstate("0".equals(cry) ? "0" : "1");
+
+ // 鍖婚櫌鍜屽簥浣嶄俊鎭�
+ patMedInhosp.setHospitalcode(thiedInhospInfo.getAreaId());
+ patMedInhosp.setBedNo(thiedInhospInfo.getAdmissBedNo());
+ patMedInhosp.setCry(Integer.valueOf(cry));
+
+
+ // 鏃堕棿淇℃伅
+ if (StringUtils.isNotEmpty(thiedInhospInfo.getAdmissDate())) {
+ try {
+ patMedInhosp.setStarttime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getAdmissDate()));
+ } catch (ParseException e) {
+ log.warn("銆恇uildPatientInhospInfo銆戣В鏋愬叆闄㈡椂闂村け璐ワ細{}", thiedInhospInfo.getAdmissDate(), e);
+ }
+ }
+
+ if (StringUtils.isNotEmpty(thiedInhospInfo.getOutDate())) {
+ try {
+ patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getOutDate()));
+ } catch (ParseException e) {
+ log.warn("銆恇uildPatientInhospInfo銆戣В鏋愬嚭闄㈡椂闂村け璐ワ細{}", thiedInhospInfo.getOutDate(), e);
+ }
+ }
+
+ // 鍑洪櫌淇℃伅
+ if (cry.equals("1")) {
+ patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptId());
+ patMedInhosp.setLeaveldeptname(thiedInhospInfo.getCurrDeptName());
+ patMedInhosp.setLeavediagname(thiedInhospInfo.getDiagName());
+ patMedInhosp.setLeaveicd10code(thiedInhospInfo.getDiagIcd10());
+ patMedInhosp.setOutWayId(thiedInhospInfo.getOutWayId());
+ patMedInhosp.setOutWayName(thiedInhospInfo.getOutWayName());
+ // 鐥呭尯淇℃伅
+ patMedInhosp.setLeavehospitaldistrictid(thiedInhospInfo.getCurrWardCode());
+ patMedInhosp.setLeavehospitaldistrictcode(thiedInhospInfo.getCurrWardId());
+ patMedInhosp.setLeavehospitaldistrictname(thiedInhospInfo.getCurrWardName());
+ patMedInhosp.setLeaveldeptid(thiedInhospInfo.getCurrDeptCode());
+ } else {
+ //鍏ラ櫌
+ patMedInhosp.setDeptcode(thiedInhospInfo.getCurrDeptId());
+ patMedInhosp.setDeptname(thiedInhospInfo.getCurrDeptName());
+ patMedInhosp.setDiagname(thiedInhospInfo.getDiagName());
+ patMedInhosp.setIcd10code(thiedInhospInfo.getDiagIcd10());
+ patMedInhosp.setHospitaldistrictid(thiedInhospInfo.getAdmissWardCode());
+ patMedInhosp.setHospitaldistrictcode(thiedInhospInfo.getAdmissWardId());
+ patMedInhosp.setHospitaldistrictname(thiedInhospInfo.getAdmissWardName());
+ }
+
+ // 鍖荤敓淇℃伅
+ patMedInhosp.setDrname(thiedInhospInfo.getDoctName());
+ patMedInhosp.setDrcode(thiedInhospInfo.getDoctId());
+
+
+ // 鐘舵�佷俊鎭�
+ patMedInhosp.setSchemestatus("0".equals(cry) ? 1L : 2L);
+
+ // 绯荤粺瀛楁
+ patMedInhosp.setDelFlag("0");
+ patMedInhosp.setOrgid("1");
+
+ return patMedInhosp;
+ }
+
+
+ /**
+ * 鏋勫缓鎮h�呮。妗堜俊鎭�
+ */
+ private PatArchive buildPatientArchive(ThiedInhospInfo thiedInhospInfo, String cry) {
+ PatArchive patArchive = new PatArchive();
+
+ // 鍩烘湰淇℃伅
+ patArchive.setPatientno(thiedInhospInfo.getPatiMediaNo());
+ patArchive.setIdcardno(thiedInhospInfo.getPatiIdCardNo().trim());
+ patArchive.setName(thiedInhospInfo.getPatiRecordName());
+ patArchive.setSourcefrom(2L);
+ patArchive.setPattype("2");
+
+ // 鎬у埆
+ patArchive.setSex("鐢�".equals(thiedInhospInfo.getPatiRecordGender()) ? 1L : 2L);
+
+ // 姘戞棌鍜岀睄璐�
+ patArchive.setNation(thiedInhospInfo.getPatiNation());
+ patArchive.setNativePlace(thiedInhospInfo.getPatiNationality());
+
+ // 灞呬綇鍦板潃
+ String homeAddr = thiedInhospInfo.getPatiHomeAddr();
+ patArchive.setPlaceOfResidence(StringUtils.isNotEmpty(homeAddr) ? homeAddr.replace("null", "") : "");
+
+ // 鍑虹敓鏃ユ湡
+ if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiBirthday())) {
+ try {
+ patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd").parse(thiedInhospInfo.getPatiBirthday()));
+ } catch (ParseException e) {
+ log.warn("銆恇uildPatientArchive銆戣В鏋愬嚭鐢熸棩鏈熷け璐ワ細{}", thiedInhospInfo.getPatiBirthday(), e);
+ }
+ }
+
+ // 骞撮緞
+ if (thiedInhospInfo.getTreateAge() != null) {
+ patArchive.setAge(Long.valueOf(thiedInhospInfo.getTreateAge()));
+ }
+ patArchive.setAgeUnit(thiedInhospInfo.getTreatAgeunit());
+
+ // 鑱旂郴鏂瑰紡
+ patArchive.setTelcode(thiedInhospInfo.getCompanyTelNum());
+ patArchive.setRelativetelcode(thiedInhospInfo.getContactPersonPhone());
+
+ // 鍑洪櫌鏂瑰紡澶勭悊锛堟浜$瓑鐗规畩鎯呭喌锛�
+ if (StringUtils.isNotEmpty(thiedInhospInfo.getOutWayId()) && "4".equals(thiedInhospInfo.getOutWayId())) {
+ patArchive.setNotrequiredFlag("1");
+ patArchive.setNotrequiredreason(thiedInhospInfo.getOutWayName());
+ }
+ if ("1".equals(cry) && StringUtils.isEmpty(thiedInhospInfo.getOutWayId())) {
+ patArchive.setNotrequiredFlag("1");
+ patArchive.setNotrequiredreason("鍑洪櫌鏂瑰紡涓虹┖");
+ }
+
+ // 绯荤粺瀛楁
+ patArchive.setDelFlag("0");
+ patArchive.setCreateTime(new Date());
+ patArchive.setUpdateTime(new Date());
+
+ return patArchive;
+ }
+}
+
+
diff --git a/ruoyi-datacollection/src/main/resources/mapper/datacollection/HNGatherPatArchiveMapper.xml b/ruoyi-datacollection/src/main/resources/mapper/datacollection/HNGatherPatArchiveMapper.xml
new file mode 100644
index 0000000..59d63fb
--- /dev/null
+++ b/ruoyi-datacollection/src/main/resources/mapper/datacollection/HNGatherPatArchiveMapper.xml
@@ -0,0 +1,644 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.datacollection.mapper.HNGatherPatArchiveMapper">
+
+
+ <resultMap type="com.ruoyi.common.core.domain.entity.SysUserDept" id="SysUserDeptResult">
+ <result property="id" column="id"/>
+ <result property="orgid" column="orgid"/>
+ <result property="userId" column="user_id"/>
+ <result property="deptId" column="dept_id"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="deptCode" column="dept_code"/>
+ <result property="deptName" column="dept_name"/>
+ <result property="deptType" column="dept_type"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateTime" column="update_time"/>
+ </resultMap>
+
+
+ <resultMap type="com.ruoyi.common.core.domain.entity.SysUserRole" id="SysUserRoleResult">
+ <result property="userId" column="user_id"/>
+ <result property="roleId" column="role_id"/>
+ <result property="orgid" column="orgid"/>
+ </resultMap>
+
+
+ <resultMap type="com.ruoyi.common.core.domain.entity.PatArchive" id="PatArchiveResult">
+ <result property="id" column="id"/>
+ <result property="patientno" column="patientno"/>
+ <result property="sourcefrom" column="sourcefrom"/>
+ <result property="notrequiredFlag" column="notrequired_flag"/>
+ <result property="notrequiredreason" column="notrequiredreason"/>
+ <result property="patidHis" column="patid_his"/>
+ <result property="sdFlag" column="sd_flag"/>
+ <result property="pattype" column="pattype"/>
+ <result property="viptype" column="viptype"/>
+ <result property="name" column="name"/>
+ <result property="sex" column="sex"/>
+ <result property="nation" column="nation"/>
+ <result property="nativePlace" column="native_place"/>
+ <result property="placeOfResidence" column="place_of_residence"/>
+ <result property="birthplace" column="birthplace"/>
+ <result property="idcardno" column="idcardno"/>
+ <result property="birthdate" column="birthdate"/>
+ <result property="age" column="age"/>
+ <result property="age2" column="age2"/>
+ <result property="sourcefrom" column="sourcefrom"/>
+ <result property="archivetime" column="archivetime"/>
+ <result property="archiveby" column="archiveby"/>
+ <result property="telcode" column="telcode"/>
+ <result property="relativetelcode" column="relativetelcode"/>
+ <result property="idcardtype" column="idcardtype"/>
+ <result property="orgid" column="orgid"/>
+ <result property="openid" column="openid"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="dept" column="deptname"/>
+ <result property="deptcode" column="deptcode"/>
+ <result property="drcode" column="drcode"/>
+ <result property="drname" column="drname"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="isupload" column="isupload"/>
+ <result property="uploadTime" column="upload_time"/>
+ <result property="tag" column="tag"/>
+ <result property="pattype" column="pattype"/>
+ <result property="bedNo" column="bedno"/>
+ <result property="inhosptime" column="inhosptime"/>
+ <result property="ageUnit" column="age_unit"/>
+ <result property="ageUnit2" column="age_unit2"/>
+ <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
+ <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
+ <result property="careFacilities" column="care_facilities"/>
+ <result property="casePath" column="case_path"/>
+ <result property="degreeOfEducation" column="degree_of_education"/>
+ <result property="maritalStatus" column="marital_status"/>
+ <result property="income" column="income"/>
+ <result property="medicareType" column="medicare_type"/>
+ <result property="carePerson" column="care_person"/>
+ <result property="casePersonAge" column="case_person_age"/>
+ <result property="guid" column="guid"/>
+ <result property="filterDrname" column="filter_drname"/>
+ <result property="filterDrcode" column="filter_drcode"/>
+ </resultMap>
+
+
+ <resultMap type="com.ruoyi.patarchive.domain.PatArchiveOthreInfo" id="PatArchiveOthreInfoResult">
+ <result property="id" column="id"/>
+ <result property="notrequiredFlag" column="notrequired_flag"/>
+ <result property="notrequiredreason" column="notrequiredreason"/>
+ <result property="patientno" column="patientno"/>
+ <result property="sourcefrom" column="sourcefrom"/>
+ <result property="patidHis" column="patid_his"/>
+ <result property="sdFlag" column="sd_flag"/>
+ <result property="pattype" column="pattype"/>
+ <result property="viptype" column="viptype"/>
+ <result property="name" column="name"/>
+ <result property="sex" column="sex"/>
+ <result property="nation" column="nation"/>
+ <result property="nativePlace" column="native_place"/>
+ <result property="placeOfResidence" column="place_of_residence"/>
+ <result property="birthplace" column="birthplace"/>
+ <result property="idcardno" column="idcardno"/>
+ <result property="birthdate" column="birthdate"/>
+ <result property="age" column="age"/>
+ <result property="age2" column="age2"/>
+ <result property="sourcefrom" column="sourcefrom"/>
+ <result property="archivetime" column="archivetime"/>
+ <result property="archiveby" column="archiveby"/>
+ <result property="telcode" column="telcode"/>
+ <result property="relativetelcode" column="relativetelcode"/>
+ <result property="idcardtype" column="idcardtype"/>
+ <result property="orgid" column="orgid"/>
+ <result property="openid" column="openid"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="dept" column="deptname"/>
+ <result property="deptcode" column="deptcode"/>
+ <result property="drcode" column="drcode"/>
+ <result property="drname" column="drname"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="isupload" column="isupload"/>
+ <result property="uploadTime" column="upload_time"/>
+ <result property="tag" column="tag"/>
+ <result property="pattype" column="pattype"/>
+ <result property="bedNo" column="bedno"/>
+ <result property="starttime" column="starttime"/>
+ <result property="endtime" column="endtime"/>
+ <result property="ageUnit" column="age_unit"/>
+ <result property="ageUnit2" column="age_unit2"/>
+ <result property="inhospno" column="inhospno"/>
+ <result property="nurseId" column="nurse_id"/>
+ <result property="nurseName" column="nurse_name"/>
+ <result property="outWayName" column="out_way_name"/>
+ <result property="outWayId" column="out_way_id"/>
+ <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
+ <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
+ <result property="guid" column="guid"/>
+ <result property="leavediagname" column="leavediagname"/>
+ <result property="leaveicd10code" column="leaveicd10code"/>
+ <result property="filterDrname" column="filter_drname"/>
+ <result property="filterDrcode" column="filter_drcode"/>
+ </resultMap>
+
+ <resultMap type="com.ruoyi.inhospvisit.domain.PatMedInhosp" id="PatMedInhospResult">
+ <result property="inhospid" column="inhospid"/>
+ <result property="inhospno" column="inhospno"/>
+ <result property="serialnum" column="serialnum"/>
+ <result property="hospitalname" column="hospitalname"/>
+ <result property="hospitalcode" column="hospitalcode"/>
+ <result property="hospitaldistrictcode" column="hospitaldistrictcode"/>
+ <result property="hospitaldistrictname" column="hospitaldistrictname"/>
+ <result property="icd10code" column="icd10code"/>
+ <result property="diagname" column="diagname"/>
+ <result property="starttime" column="starttime"/>
+ <result property="endtime" column="endtime"/>
+ <result property="deptcode" column="deptcode"/>
+ <result property="deptname" column="deptname"/>
+ <result property="roomno" column="roomno"/>
+ <result property="bedNo" column="bed_no"/>
+ <result property="orgid" column="orgid"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="isupload" column="isupload"/>
+ <result property="uploadTime" column="upload_time"/>
+ <result property="patid" column="patid"/>
+ <result property="leavediagname" column="leavediagname"/>
+ <result property="leaveicd10code" column="leaveicd10code"/>
+ <result property="drcode" column="drcode"/>
+ <result property="drname" column="drname"/>
+ <result property="schemestatus" column="schemestatus"/>
+ <result property="generalschemestatus" column="generalschemestatus"/>
+ <result property="leaveldeptcode" column="leaveldeptcode"/>
+ <result property="leaveldeptname" column="leaveldeptname"/>
+ <result property="hospitaldistrictid" column="hospitaldistrictid"/>
+ <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
+ <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
+ <result property="leavehospitaldistrictid" column="leavehospitaldistrictid"/>
+ <result property="deptid" column="deptid"/>
+ <result property="leaveldeptid" column="leaveldeptid"/>
+ <result property="schemetime" column="schemetime"/>
+ <result property="patname" column="patname"/>
+ <result property="patno" column="patno"/>
+ <result property="inhospstate" column="inhospstate"/>
+ <result property="deptcheckFlag" column="deptcheck_flag"/>
+ <result property="wardcheckFlag" column="wardcheck_flag"/>
+ <result property="diagcheckFlag" column="diagcheck_flag"/>
+ <result property="age" column="age"/>
+ <result property="sex" column="sex"/>
+ <result property="telcode" column="telcode"/>
+ <result property="longTaskReason" column="long_task_reason"/>
+ <result property="nurseId" column="nurse_id"/>
+ <result property="nurseName" column="nurse_name"/>
+ <result property="outWayId" column="out_way_id"/>
+ <result property="outWayName" column="out_way_name"/>
+ <result property="guid" column="guid"/>
+ <result property="operator" column="operator"/>
+ <result property="operatorId" column="operator_id"/>
+ <result property="remark" column="remark"/>
+ <result property="tagname" column="tagname"/>
+ <result property="fuflag" column="fuflag"/>
+ <result property="fudate" column="fudate"/>
+ <result property="fuperiod" column="fuperiod"/>
+ <result property="futypecode" column="futypecode"/>
+ <result property="futypedesc" column="futypedesc"/>
+ <result property="fuadvice" column="fuadvice"/>
+ <result property="fuspecialadvice" column="fuspecialadvice"/>
+ </resultMap>
+
+ <resultMap type="com.ruoyi.outpatientvisit.domain.PatMedOuthosp" id="PatMedOuthospResult">
+ <result property="id" column="id"/>
+ <result property="serialnum" column="serialnum"/>
+ <result property="patid" column="patid"/>
+ <result property="hospitalname" column="hospitalname"/>
+ <result property="hospitalcode" column="hospitalcode"/>
+ <result property="icd10code" column="icd10code"/>
+ <result property="diagname" column="diagname"/>
+ <result property="deptcode" column="deptcode"/>
+ <result property="deptname" column="deptname"/>
+ <result property="drcode" column="drcode"/>
+ <result property="drname" column="drname"/>
+ <result property="admitdate" column="admitdate"/>
+ <result property="orgid" column="orgid"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="isupload" column="isupload"/>
+ <result property="uploadTime" column="upload_time"/>
+ <result property="schemestatus" column="schemestatus"/>
+ <result property="deptid" column="deptid"/>
+ <result property="schemetime" column="schemetime"/>
+ <result property="hpi" column="hpi"/>
+ <result property="mainsuit" column="mainsuit"/>
+ <result property="outhospno" column="outhospno"/>
+ <result property="patname" column="patname"/>
+ <result property="guid" column="guid"/>
+ <result property="patno" column="patno"/>
+ <result property="diagcheckFlag" column="diagcheck_flag"/>
+ <result property="idcardno" column="idcardno"/>
+ <result property="remark" column="remark"/>
+ </resultMap>
+
+
+ <resultMap type="com.ruoyi.common.core.domain.entity.Icd10" id="Icd10Result">
+ <result property="icdid" column="icdid"/>
+ <result property="icdcode" column="icdcode"/>
+ <result property="icdname" column="icdname"/>
+ <result property="icdpym" column="icdpym"/>
+ <result property="icdwbm" column="icdwbm"/>
+ <result property="orgid" column="orgid"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="pid" column="pid"/>
+ <result property="guid" column="guid"/>
+ <result property="lastflag" column="lastflag"/>
+ <result property="chimedflag" column="chimedflag"/>
+ <result property="hisIcdid" column="his_icdid"/>
+ </resultMap>
+
+
+ <resultMap type="com.ruoyi.common.core.domain.entity.SysDept" id="SysDeptResult">
+ <id property="deptId" column="dept_id"/>
+ <id property="hisDeptId" column="his_dept_id"/>
+ <result property="parentId" column="parent_id"/>
+ <result property="hisParentId" column="his_parent_id"/>
+ <result property="ancestors" column="ancestors"/>
+ <result property="deptName" column="dept_name"/>
+ <result property="orderNum" column="order_num"/>
+ <result property="leader" column="leader"/>
+ <result property="phone" column="phone"/>
+ <result property="email" column="email"/>
+ <result property="status" column="status"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="parentName" column="parent_name"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="deptCode" column="dept_code"/>
+ <result property="deptType" column="dept_type"/>
+ <result property="guid" column="guid"/>
+ <result property="orgid" column="orgid"/>
+ <result property="type" column="type"/>
+ </resultMap>
+
+ <resultMap type="com.ruoyi.common.core.domain.entity.SysUser" id="SysUserResult">
+ <id property="userId" column="user_id"/>
+ <id property="orgid" column="orgid"/>
+ <id property="hisUserId" column="his_user_id"/>
+ <result property="deptId" column="dept_id"/>
+ <result property="hospInfo" column="hosp_info"/>
+ <result property="deptInfo" column="dept_info"/>
+ <result property="userName" column="user_name"/>
+ <result property="nickName" column="nick_name"/>
+ <result property="email" column="email"/>
+ <result property="phonenumber" column="phonenumber"/>
+ <result property="sex" column="sex"/>
+ <result property="avatar" column="avatar"/>
+ <result property="password" column="password"/>
+ <result property="status" column="status"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="loginIp" column="login_ip"/>
+ <result property="loginDate" column="login_date"/>
+ <result property="createBy" column="create_by"/>
+ <result property="idCard" column="id_card"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="title" column="title"/>
+ <result property="birthday" column="birthday"/>
+ <result property="jobPhone" column="job_phone"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="remark" column="remark"/>
+ <result property="userType" column="user_type"/>
+ <result property="searchscope" column="searchscope"/>
+ <result property="guid" column="guid"/>
+ </resultMap>
+
+ <sql id="selectPatArchiveVo">
+ select notrequired_flag,
+ notrequiredreason,
+ patientno,
+ patid_his,
+ sd_flag,
+ name,
+ sex,
+ idcardno,
+ birthdate,
+ age,
+ nation,
+ native_place,
+ place_of_residence,
+ birthplace,
+ sourcefrom,
+ archivetime,
+ archiveby,
+ telcode,
+ relativetelcode,
+ idcardtype,
+ orgid,
+ openid,
+ viptype,
+ care_facilities,
+ case_path,
+ degree_of_education,
+ marital_status,
+ income,
+ medicare_type,
+ care_person,
+ case_person_age
+ from hzjbxx
+ </sql>
+
+
+ <select id="yhyjsxx" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserRoleResult">
+ select user_id, role_id, orgid
+ FROM yhyjsxx
+ where 1=1
+ <if test="hisUserId != null ">
+ and user_id = #{hisUserId}
+ </if>
+ </select>
+
+ <select id="yhyksxx" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserDeptResult">
+ select user_id, user_code, dept_type,department_id as
+ dept_id,dept_name,deptparent,del_flag,orgid,create_time,create_by,update_time,update_by
+ FROM yhyksxx
+ where 1=1
+ and user_id != 'admin'
+ <if test="hisUserId != null ">and user_id = #{hisUserId}</if>
+ </select>
+
+
+ <select id="selectPatArchiveList" parameterType="com.ruoyi.common.core.domain.entity.PatArchive" resultMap="PatArchiveResult">
+ <include refid="selectPatArchiveVo"/>
+ where 1=1
+ <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
+ <if test="idcardno != null and idcardno != ''">and idcardno = #{idcardno}</if>
+ <if test="sourcefrom != null ">and sourcefrom = #{sourcefrom}</if>
+ <if test="telcode != null and telcode != ''">and telcode = #{telcode}</if>
+ <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
+ <if test="id != null and id != ''">and id = #{id}</if>
+ <if test="isupload != null ">and isupload = #{isupload}</if>
+ <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+ <if test="viptype != null ">and viptype = #{viptype}</if>
+ <if test="pattype != null ">and pattype = #{pattype}</if>
+ <if test="patientno != null ">and patientno = CAST(#{patientno} AS INTEGER)</if>
+ <if test="patidHis != null ">and patid_his = #{patidHis}</if>
+ <if test="sdFlag != null ">and sd_flag = #{sdFlag}</if>
+ <if test="ageUnit != null ">and age_unit = #{ageUnit}</if>
+ <if test="age != null ">and age = #{age}</if>
+ <if test="age2 != null ">and age2 = #{age2}</if>
+ <if test="ageUnit2 != null ">and age_unit2 = #{ageUnit2}</if>
+ <if test="notrequiredFlag != null ">and notrequired_flag = #{notrequiredFlag}</if>
+ <if test="notrequiredreason != null ">and notrequiredreason = #{notrequiredreason}</if>
+ <if test="careFacilities != null ">and care_facilities = #{careFacilities}</if>
+ <if test="casePath != null ">and case_path = #{casePath}</if>
+ <if test="degreeOfEducation != null ">and degree_of_education = #{degreeOfEducation}</if>
+ <if test="maritalStatus != null ">and marital_status = #{maritalStatus}</if>
+ <if test="income != null ">and income = #{income}</if>
+ <if test="medicareType != null ">and medicare_type = #{medicareType}</if>
+ <if test="carePerson != null ">and care_person = #{carePerson}</if>
+ <if test="casePersonAge != null ">and case_person_age = #{casePersonAge}</if>
+ <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if>
+ <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if>
+ </select>
+
+
+ <select id="selectPatMedInhospListCount" parameterType="com.ruoyi.inhospvisit.domain.PatMedInhosp" resultType="Long">
+ select count(*)
+ FROM cryxx
+ </select>
+
+ <select id="selectPatArchiveListByLastId" resultMap="PatArchiveResult">
+ SELECT *
+ FROM (
+ SELECT *,
+ ROW_NUMBER() OVER (ORDER BY patid_his) as row_num
+ FROM hzjbxx
+ ) a
+ WHERE row_num > #{lastRowNumber} LIMIT #{ps}
+ </select>
+
+ <select id="selectPatMedInhospListByLastId" resultMap="PatMedInhospResult">
+ SELECT *
+ FROM (SELECT *,
+ ROW_NUMBER() OVER (ORDER BY patno) as row_num
+ FROM cryxx
+ ) a
+ WHERE row_num > #{lastRowNumber} LIMIT #{ps}
+ </select>
+
+ <select id="selectPatArchiveCount" parameterType="com.ruoyi.inhospvisit.domain.PatMedInhosp" resultType="Long">
+ select count(*)
+ FROM hzjbxx
+ </select>
+
+
+ <select id="selectPatMedInhospList" parameterType="com.ruoyi.inhospvisit.domain.PatMedInhosp" resultMap="PatMedInhospResult">
+ select
+ b.nurse_id,
+ b.nurse_name,
+ b.patname,
+ b.out_way_id,
+ b.out_way_name,
+ b.inhospstate,
+ b.patno,
+ b.inhospno,
+ b.serialnum,
+ b.hospitalname,
+ b.hospitalcode,
+ b.hospitaldistrictcode,
+ b.hospitaldistrictname,
+ b.icd10code,
+ b.diagname,
+ b.starttime,
+ b.endtime,
+ b.deptcode,
+ b.deptname,
+ b.roomno,
+ b.bed_no,
+ b.orgid,
+ b.leavediagname,
+ b.leaveicd10code,
+ b.drcode,
+ b.drname,
+ b.leaveldeptcode,
+ b.leaveldeptname,
+ b.hospitaldistrictid,
+ b.leavehospitaldistrictcode,
+ b.leavehospitaldistrictname,
+ b.leavehospitaldistrictid,
+ b.deptid,
+ b.leaveldeptid,
+ b.schemetime,
+ b.fuflag,
+ b.fudate,
+ b.fuperiod,
+ b.futypecode,
+ b.futypedesc,
+ b.fuadvice
+ FROM
+ cryxx b
+ where 1=1
+ <if test="startOutHospTime != null ">and to_char(b.endtime,'YYMMDD') >=
+ to_char(#{startOutHospTime}::date,'YYMMDD')
+ </if>
+ <if test="endOutHospTime != null ">and to_char(b.endtime,'YYMMDD') <=
+ to_char(#{endOutHospTime}::date,'YYMMDD')
+ </if>
+ <if test="startInHospTime != null ">and to_char(b.starttime,'YYMMDD') >=
+ to_char(#{startInHospTime}::date,'%y%m%d')
+ </if>
+ <if test="endInHospTime != null ">and to_char(b.starttime,'YYMMDD') <=
+ to_char(#{endInHospTime}::date,'YYMMDD')
+ </if>
+ <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
+ <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
+ <if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
+ <if test="patno != null ">and b.patno = #{patno}</if>
+ <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
+ <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if>
+ <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
+ <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
+ <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
+ <if test="orgid != null ">and b.orgid = #{orgid}</if>
+ </select>
+
+
+ <select id="selectPatMedOuthospList" parameterType="com.ruoyi.outpatientvisit.domain.PatMedOuthosp"
+ resultMap="PatMedOuthospResult">
+ select
+ outhospno,
+ patno,
+ remark,
+ serialnum,
+ hospitalname,
+ hospitalcode,
+ icd10code,
+ diagname,
+ deptcode,
+ deptname,
+ drcode,
+ drname,
+ admitdate,
+ orgid,
+ update_by,
+ update_time,
+ create_by,
+ create_time,
+ isupload,
+ upload_time,
+ schemestatus,
+ deptid,
+ schemetime,
+ hpi,
+ patname,
+ mainsuit
+ from mzxx
+ where 1=1
+ <if test="beginTime != null ">and to_char( admitdate,'YYMMDD') >=
+ to_char(#{beginTime}::date,'YYMMDD')
+ </if>
+ <if test="endTime != null ">and to_char( admitdate,'YYMMDD') <=
+ to_char(#{endTime}::date,'YYMMDD')
+ </if>
+
+ </select>
+
+
+ <select id="selectIcd10List" parameterType="com.ruoyi.common.core.domain.entity.Icd10" resultMap="Icd10Result">
+ select
+ icdcode,
+ his_icdid,
+ lastflag,
+ chimedflag,
+ icdname,
+ icdpym
+ from jbxx
+ where 1=1
+ <if test="icdcode != null and icdcode != ''">and icdcode = #{icdcode}</if>
+ <if test="lastflag != null and lastflag != ''">and lastflag = #{lastflag}</if>
+ <if test="chimedflag != null and chimedflag != ''">and chimedflag = #{chimedflag}</if>
+ <if test="icdname != null and icdname != ''">and icdname like concat('%', #{icdname}, '%')</if>
+ <if test="icdpym != null and icdpym != ''">and icdpym = #{icdpym}</if>
+ <if test="icdwbm != null and icdwbm != ''">and icdwbm = #{icdwbm}</if>
+ <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
+ <if test="pid != null ">and pid = #{pid}</if>
+ <if test="guid != null and guid != ''">and guid = #{guid}</if>
+ <if test="hisIcdid != null and hisIcdid != ''">and his_icdid = #{hisIcdid}</if>
+ </select>
+
+
+ <select id="selectUserList" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult">
+ select
+ u.title,u.his_user_id, u.searchscope, u.dept_id, u.user_type,
+ u.nick_name, u.user_name, u.email,u.id_card, u.avatar,
+ u.birthday,u.orgid,u.job_phone,u.phonenumber, u.sex, u.status,
+ u.login_ip, u.login_date, u.create_by, u.create_time, u.remark
+ from ryxx u
+ where 1=1
+ <if test="userId != null and userId != 0">
+ AND u.user_id = #{userId}
+ </if>
+ <if test="userName != null and userName != ''">
+ AND u.user_name like concat('%', #{userName}, '%')
+ </if>
+ <if test="nickName != null and nickName != ''">
+ AND u.nick_name like concat('%', #{nickName}, '%')
+ </if>
+ <if test="status != null and status != ''">
+ AND u.status = #{status}
+ </if>
+ <if test="idCard != null and idCard != ''">
+ AND u.id_card = #{idCard}
+ </if>
+ <if test="title != null and title != ''">
+ AND u.title = #{title}
+ </if>
+ <if test="jobPhone != null and jobPhone != ''">
+ AND u.job_phone = #{jobPhone}
+ </if>
+ <if test="birthday != null and birthday != ''">
+ AND u.birthday = #{birthday}
+ </if>
+ <if test="hisUserId != null and hisUserId != ''">
+ AND u.his_user_id = #{hisUserId}
+ </if>
+ <if test="phonenumber != null and phonenumber != ''">
+ AND u.phonenumber like concat('%', #{phonenumber}, '%')
+ </if>
+ </select>
+
+ <select id="selectDeptList" parameterType="com.ruoyi.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
+ SELECT d.dept_code,
+ d.TYPE,
+ d.ancestors,
+ d.dept_name,
+ d.order_num,
+ d.leader,
+ d.phone,
+ d.dept_type,
+ d.email,
+ d.status,
+ d.create_by,
+ d.create_time,
+ d.his_dept_id,
+ d.his_parent_id
+ FROM HEALTHY_DEPT d
+
+ </select>
+</mapper>
diff --git a/ruoyi-datacollection/src/main/resources/mapper/datacollection/ServiceAppointRecordMapper.xml b/ruoyi-datacollection/src/main/resources/mapper/datacollection/ServiceAppointRecordMapper.xml
new file mode 100644
index 0000000..5c90bc2
--- /dev/null
+++ b/ruoyi-datacollection/src/main/resources/mapper/datacollection/ServiceAppointRecordMapper.xml
@@ -0,0 +1,806 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.datacollection.mapper.ServiceAppointRecordMapper">
+
+ <resultMap type="com.ruoyi.datacollection.domain.ServiceAppointRecord" id="ServiceAppointRecordResult">
+ <result property="id" column="id"/>
+ <result property="appointRecSn" column="appoint_rec_sn"/>
+ <result property="changeAppointRecSn" column="change_appoint_rec_sn"/>
+ <result property="orgCode" column="org_code"/>
+ <result property="patFileSn" column="pat_file_sn"/>
+ <result property="patMediaSn" column="pat_media_sn"/>
+ <result property="patMediaNum" column="pat_media_num"/>
+ <result property="patCateSn" column="pat_cate_sn"/>
+ <result property="patNatureSn" column="pat_nature_sn"/>
+ <result property="patFileName" column="pat_file_name"/>
+ <result property="patFileGender" column="pat_file_gender"/>
+ <result property="patAge" column="pat_age"/>
+ <result property="patBirthday" column="pat_birthday"/>
+ <result property="patCardTypeCode" column="pat_card_type_code"/>
+ <result property="patCardType" column="pat_card_type"/>
+ <result property="patIdCardNum" column="pat_id_card_num"/>
+ <result property="patAddr" column="pat_addr"/>
+ <result property="patTel" column="pat_tel"/>
+ <result property="patWayCode" column="pat_way_code"/>
+ <result property="patWay" column="pat_way"/>
+ <result property="appointTypeSn" column="appoint_type_sn"/>
+ <result property="appointDate" column="appoint_date"/>
+ <result property="appointOperatorId" column="appoint_operator_id"/>
+ <result property="appointOperatorName" column="appoint_operator_name"/>
+ <result property="appointRegistDate" column="appoint_regist_date"/>
+ <result property="registerScheduleSn" column="register_schedule_sn"/>
+ <result property="outpatCateSn" column="outpat_cate_sn"/>
+ <result property="outpatCateName" column="outpat_cate_name"/>
+ <result property="registDeptCode" column="regist_dept_code"/>
+ <result property="registDeptName" column="regist_dept_name"/>
+ <result property="deptPinyinCode" column="dept_pinyin_code"/>
+ <result property="registDoctCode" column="regist_doct_code"/>
+ <result property="registDoctName" column="regist_doct_name"/>
+ <result property="staffPinyinCode" column="staff_pinyin_code"/>
+ <result property="registTimeCate" column="regist_time_cate"/>
+ <result property="patiRegistSn" column="pati_regist_sn"/>
+ <result property="scheduleRegistCharge" column="schedule_regist_charge"/>
+ <result property="registRecSn" column="regist_rec_sn"/>
+ <result property="regUserSn" column="reg_user_sn"/>
+ <result property="regUserName" column="reg_user_name"/>
+ <result property="regOptTime" column="reg_opt_time"/>
+ <result property="revokeUserSn" column="revoke_user_sn"/>
+ <result property="revokeUserName" column="revoke_user_name"/>
+ <result property="revokeOptTime" column="revoke_opt_time"/>
+ <result property="withdrawalTime" column="withdrawal_time"/>
+ <result property="scheduleStatusFlag" column="schedule_status_flag"/>
+ <result property="scheduleMemoDesc" column="schedule_memo_desc"/>
+ <result property="scheduleCredenceNum" column="schedule_credence_num"/>
+ <result property="registTimeRange" column="regist_time_range"/>
+ <result property="scheduleDetailSn" column="schedule_detail_sn"/>
+ <result property="treatDate" column="treat_date"/>
+ <result property="treatDoctCode" column="treat_doct_code"/>
+ <result property="treatDoctName" column="treat_doct_name"/>
+ <result property="regWayCode" column="reg_way_code"/>
+ <result property="regWay" column="reg_way"/>
+ <result property="regSystemWayCode" column="reg_system_way_code"/>
+ <result property="regSystemWay" column="reg_system_way"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="visitFlag" column="visit_flag"/>
+ <result property="senderId" column="sender_id"/>
+ <result property="senderName" column="sender_name"/>
+ <result property="sendTime" column="send_time"/>
+ </resultMap>
+
+ <sql id="selectServiceAppointRecordVo">
+ select id,
+ appoint_rec_sn,
+ change_appoint_rec_sn,
+ org_code,
+ pat_file_sn,
+ pat_media_sn,
+ pat_media_num,
+ pat_cate_sn,
+ pat_nature_sn,
+ pat_file_name,
+ pat_file_gender,
+ pat_age,
+ pat_birthday,
+ pat_card_type_code,
+ pat_card_type,
+ pat_id_card_num,
+ pat_addr,
+ pat_tel,
+ pat_way_code,
+ pat_way,
+ appoint_type_sn,
+ appoint_date,
+ appoint_operator_id,
+ appoint_operator_name,
+ appoint_regist_date,
+ register_schedule_sn,
+ outpat_cate_sn,
+ outpat_cate_name,
+ regist_dept_code,
+ regist_dept_name,
+ dept_pinyin_code,
+ regist_doct_code,
+ regist_doct_name,
+ staff_pinyin_code,
+ regist_time_cate,
+ pati_regist_sn,
+ schedule_regist_charge,
+ regist_rec_sn,
+ reg_user_sn,
+ reg_user_name,
+ reg_opt_time,
+ revoke_user_sn,
+ revoke_user_name,
+ revoke_opt_time,
+ withdrawal_time,
+ schedule_status_flag,
+ schedule_memo_desc,
+ schedule_credence_num,
+ regist_time_range,
+ schedule_detail_sn,
+ treat_date,
+ treat_doct_code,
+ treat_doct_name,
+ reg_way_code,
+ reg_way,
+ reg_system_way_code,
+ reg_system_way,
+ create_time,
+ update_time,
+ visit_flag,
+ sender_id,
+ sender_name,
+ send_time
+ from service_appoint_record
+ </sql>
+
+ <select id="selectServiceAppointRecordList" parameterType="com.ruoyi.datacollection.domain.ServiceAppointRecord"
+ resultMap="ServiceAppointRecordResult">
+ <include refid="selectServiceAppointRecordVo"/>
+ where 1=1
+ and del_flag=0
+ <if test="appointRecSn != null and appointRecSn != ''">
+ and appoint_rec_sn = #{appointRecSn}
+ </if>
+ <if test="changeAppointRecSn != null and changeAppointRecSn != ''">
+ and change_appoint_rec_sn = #{changeAppointRecSn}
+ </if>
+ <if test="orgCode != null and orgCode != ''">
+ and org_code = #{orgCode}
+ </if>
+ <if test="patFileSn != null and patFileSn != ''">
+ and pat_file_sn = #{patFileSn}
+ </if>
+ <if test="patMediaSn != null and patMediaSn != ''">
+ and pat_media_sn = #{patMediaSn}
+ </if>
+ <if test="patMediaNum != null and patMediaNum != ''">
+ and pat_media_num = #{patMediaNum}
+ </if>
+ <if test="patCateSn != null and patCateSn != ''">
+ and pat_cate_sn = #{patCateSn}
+ </if>
+ <if test="patNatureSn != null and patNatureSn != ''">
+ and pat_nature_sn = #{patNatureSn}
+ </if>
+ <if test="patFileName != null and patFileName != ''">
+ and pat_file_name like concat('%', #{patFileName}, '%')
+ </if>
+ <if test="patFileGender != null and patFileGender != ''">
+ and pat_file_gender = #{patFileGender}
+ </if>
+ <if test="patAge != null and patAge != ''">
+ and pat_age = #{patAge}
+ </if>
+ <if test="patBirthday != null and patBirthday != ''">
+ and pat_birthday = #{patBirthday}
+ </if>
+ <if test="patCardTypeCode != null and patCardTypeCode != ''">
+ and pat_card_type_code = #{patCardTypeCode}
+ </if>
+ <if test="patCardType != null and patCardType != ''">
+ and pat_card_type = #{patCardType}
+ </if>
+ <if test="patIdCardNum != null and patIdCardNum != ''">
+ and pat_id_card_num = #{patIdCardNum}
+ </if>
+ <if test="patAddr != null and patAddr != ''">
+ and pat_addr = #{patAddr}
+ </if>
+ <if test="patTel != null and patTel != ''">
+ and pat_tel = #{patTel}
+ </if>
+ <if test="patWayCode != null and patWayCode != ''">
+ and pat_way_code = #{patWayCode}
+ </if>
+ <if test="patWay != null and patWay != ''">
+ and pat_way = #{patWay}
+ </if>
+ <if test="appointTypeSn != null and appointTypeSn != ''">
+ and appoint_type_sn = #{appointTypeSn}
+ </if>
+ <if test="appointDate != null and appointDate != ''">
+ and appoint_date = #{appointDate}
+ </if>
+ <if test="appointOperatorId != null and appointOperatorId != ''">
+ and appoint_operator_id = #{appointOperatorId}
+ </if>
+ <if test="appointOperatorName != null and appointOperatorName != ''">
+ and appoint_operator_name like concat('%', #{appointOperatorName}, '%')
+ </if>
+ <if test="appointRegistDate != null and appointRegistDate != ''">
+ and appoint_regist_date = #{appointRegistDate}
+ </if>
+ <if test="registerScheduleSn != null and registerScheduleSn != ''">
+ and register_schedule_sn = #{registerScheduleSn}
+ </if>
+ <if test="outpatCateSn != null and outpatCateSn != ''">
+ and outpat_cate_sn = #{outpatCateSn}
+ </if>
+ <if test="outpatCateName != null and outpatCateName != ''">
+ and outpat_cate_name like concat('%', #{outpatCateName}, '%')
+ </if>
+ <if test="registDeptCode != null and registDeptCode != ''">
+ and regist_dept_code = #{registDeptCode}
+ </if>
+ <if test="registDeptName != null and registDeptName != ''">
+ and regist_dept_name like concat('%', #{registDeptName}, '%')
+ </if>
+ <if test="deptPinyinCode != null and deptPinyinCode != ''">
+ and dept_pinyin_code = #{deptPinyinCode}
+ </if>
+ <if test="registDoctCode != null and registDoctCode != ''">
+ and regist_doct_code = #{registDoctCode}
+ </if>
+ <if test="registDoctName != null and registDoctName != ''">
+ and regist_doct_name like concat('%', #{registDoctName}, '%')
+ </if>
+ <if test="staffPinyinCode != null and staffPinyinCode != ''">
+ and staff_pinyin_code = #{staffPinyinCode}
+ </if>
+ <if test="registTimeCate != null ">
+ and regist_time_cate = #{registTimeCate}
+ </if>
+ <if test="patiRegistSn != null ">
+ and pati_regist_sn = #{patiRegistSn}
+ </if>
+ <if test="scheduleRegistCharge != null ">
+ and schedule_regist_charge = #{scheduleRegistCharge}
+ </if>
+ <if test="registRecSn != null and registRecSn != ''">
+ and regist_rec_sn = #{registRecSn}
+ </if>
+ <if test="regUserSn != null and regUserSn != ''">
+ and reg_user_sn = #{regUserSn}
+ </if>
+ <if test="regUserName != null and regUserName != ''">
+ and reg_user_name like concat('%', #{regUserName}, '%')
+ </if>
+ <if test="regOptTime != null and regOptTime != ''">
+ and reg_opt_time = #{regOptTime}
+ </if>
+ <if test="revokeUserSn != null and revokeUserSn != ''">
+ and revoke_user_sn = #{revokeUserSn}
+ </if>
+ <if test="revokeUserName != null and revokeUserName != ''">
+ and revoke_user_name like concat('%', #{revokeUserName}, '%')
+ </if>
+ <if test="revokeOptTime != null and revokeOptTime != ''">
+ and revoke_opt_time = #{revokeOptTime}
+ </if>
+ <if test="withdrawalTime != null and withdrawalTime != ''">
+ and withdrawal_time = #{withdrawalTime}
+ </if>
+ <if test="scheduleStatusFlag != null ">
+ and schedule_status_flag = #{scheduleStatusFlag}
+ </if>
+ <if test="scheduleMemoDesc != null and scheduleMemoDesc != ''">
+ and schedule_memo_desc = #{scheduleMemoDesc}
+ </if>
+ <if test="scheduleCredenceNum != null and scheduleCredenceNum != ''">
+ and schedule_credence_num = #{scheduleCredenceNum}
+ </if>
+ <if test="registTimeRange != null and registTimeRange != ''">
+ and regist_time_range = #{registTimeRange}
+ </if>
+ <if test="scheduleDetailSn != null and scheduleDetailSn != ''">
+ and schedule_detail_sn = #{scheduleDetailSn}
+ </if>
+ <if test="treatDate != null and treatDate != ''">
+ and treat_date = #{treatDate}
+ </if>
+ <if test="treatDoctCode != null and treatDoctCode != ''">
+ and treat_doct_code = #{treatDoctCode}
+ </if>
+ <if test="treatDoctName != null and treatDoctName != ''">
+ and treat_doct_name like concat('%', #{treatDoctName}, '%')
+ </if>
+ <if test="regWayCode != null and regWayCode != ''">
+ and reg_way_code = #{regWayCode}
+ </if>
+ <if test="regWay != null and regWay != ''">
+ and reg_way = #{regWay}
+ </if>
+ <if test="regSystemWayCode != null and regSystemWayCode != ''">
+ and reg_system_way_code = #{regSystemWayCode}
+ </if>
+ <if test="regSystemWay != null and regSystemWay != ''">
+ and reg_system_way = #{regSystemWay}
+ </if>
+ <if test="visitFlag != null ">
+ and visit_flag = #{visitFlag}
+ </if>
+ <if test="senderId != null and senderId != ''">
+ and sender_id = #{senderId}
+ </if>
+ <if test="senderName != null and senderName != ''">
+ and sender_name like concat('%', #{senderName}, '%')
+ </if>
+ <if test="sendTime != null and sendTime != ''">
+ and send_time = #{sendTime}
+ </if>
+ </select>
+
+ <select id="selectServiceAppointRecordById" parameterType="Long"
+ resultMap="ServiceAppointRecordResult">
+ <include refid="selectServiceAppointRecordVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertServiceAppointRecord" parameterType="com.ruoyi.datacollection.domain.ServiceAppointRecord"
+ useGeneratedKeys="true" keyProperty="id">
+ insert into service_appoint_record
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="appointRecSn != null">appoint_rec_sn,
+ </if>
+ <if test="changeAppointRecSn != null">change_appoint_rec_sn,
+ </if>
+ <if test="orgCode != null">org_code,
+ </if>
+ <if test="patFileSn != null">pat_file_sn,
+ </if>
+ <if test="patMediaSn != null">pat_media_sn,
+ </if>
+ <if test="patMediaNum != null">pat_media_num,
+ </if>
+ <if test="patCateSn != null">pat_cate_sn,
+ </if>
+ <if test="patNatureSn != null">pat_nature_sn,
+ </if>
+ <if test="patFileName != null">pat_file_name,
+ </if>
+ <if test="patFileGender != null">pat_file_gender,
+ </if>
+ <if test="patAge != null">pat_age,
+ </if>
+ <if test="patBirthday != null">pat_birthday,
+ </if>
+ <if test="patCardTypeCode != null">pat_card_type_code,
+ </if>
+ <if test="patCardType != null">pat_card_type,
+ </if>
+ <if test="patIdCardNum != null">pat_id_card_num,
+ </if>
+ <if test="patAddr != null">pat_addr,
+ </if>
+ <if test="patTel != null">pat_tel,
+ </if>
+ <if test="patWayCode != null">pat_way_code,
+ </if>
+ <if test="patWay != null">pat_way,
+ </if>
+ <if test="appointTypeSn != null">appoint_type_sn,
+ </if>
+ <if test="appointDate != null">appoint_date,
+ </if>
+ <if test="appointOperatorId != null">appoint_operator_id,
+ </if>
+ <if test="appointOperatorName != null">appoint_operator_name,
+ </if>
+ <if test="appointRegistDate != null">appoint_regist_date,
+ </if>
+ <if test="registerScheduleSn != null">register_schedule_sn,
+ </if>
+ <if test="outpatCateSn != null">outpat_cate_sn,
+ </if>
+ <if test="outpatCateName != null">outpat_cate_name,
+ </if>
+ <if test="registDeptCode != null">regist_dept_code,
+ </if>
+ <if test="registDeptName != null">regist_dept_name,
+ </if>
+ <if test="deptPinyinCode != null">dept_pinyin_code,
+ </if>
+ <if test="registDoctCode != null">regist_doct_code,
+ </if>
+ <if test="registDoctName != null">regist_doct_name,
+ </if>
+ <if test="staffPinyinCode != null">staff_pinyin_code,
+ </if>
+ <if test="registTimeCate != null">regist_time_cate,
+ </if>
+ <if test="patiRegistSn != null">pati_regist_sn,
+ </if>
+ <if test="scheduleRegistCharge != null">schedule_regist_charge,
+ </if>
+ <if test="registRecSn != null">regist_rec_sn,
+ </if>
+ <if test="regUserSn != null">reg_user_sn,
+ </if>
+ <if test="regUserName != null">reg_user_name,
+ </if>
+ <if test="regOptTime != null">reg_opt_time,
+ </if>
+ <if test="revokeUserSn != null">revoke_user_sn,
+ </if>
+ <if test="revokeUserName != null">revoke_user_name,
+ </if>
+ <if test="revokeOptTime != null">revoke_opt_time,
+ </if>
+ <if test="withdrawalTime != null">withdrawal_time,
+ </if>
+ <if test="scheduleStatusFlag != null">schedule_status_flag,
+ </if>
+ <if test="scheduleMemoDesc != null">schedule_memo_desc,
+ </if>
+ <if test="scheduleCredenceNum != null">schedule_credence_num,
+ </if>
+ <if test="registTimeRange != null">regist_time_range,
+ </if>
+ <if test="scheduleDetailSn != null">schedule_detail_sn,
+ </if>
+ <if test="treatDate != null">treat_date,
+ </if>
+ <if test="treatDoctCode != null">treat_doct_code,
+ </if>
+ <if test="treatDoctName != null">treat_doct_name,
+ </if>
+ <if test="regWayCode != null">reg_way_code,
+ </if>
+ <if test="regWay != null">reg_way,
+ </if>
+ <if test="regSystemWayCode != null">reg_system_way_code,
+ </if>
+ <if test="regSystemWay != null">reg_system_way,
+ </if>
+ <if test="createTime != null">create_time,
+ </if>
+ <if test="updateTime != null">update_time,
+ </if>
+ <if test="visitFlag != null">visit_flag,
+ </if>
+ <if test="senderId != null">sender_id,
+ </if>
+ <if test="senderName != null">sender_name,
+ </if>
+ <if test="sendTime != null">send_time,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="appointRecSn != null">#{appointRecSn},
+ </if>
+ <if test="changeAppointRecSn != null">#{changeAppointRecSn},
+ </if>
+ <if test="orgCode != null">#{orgCode},
+ </if>
+ <if test="patFileSn != null">#{patFileSn},
+ </if>
+ <if test="patMediaSn != null">#{patMediaSn},
+ </if>
+ <if test="patMediaNum != null">#{patMediaNum},
+ </if>
+ <if test="patCateSn != null">#{patCateSn},
+ </if>
+ <if test="patNatureSn != null">#{patNatureSn},
+ </if>
+ <if test="patFileName != null">#{patFileName},
+ </if>
+ <if test="patFileGender != null">#{patFileGender},
+ </if>
+ <if test="patAge != null">#{patAge},
+ </if>
+ <if test="patBirthday != null">#{patBirthday},
+ </if>
+ <if test="patCardTypeCode != null">#{patCardTypeCode},
+ </if>
+ <if test="patCardType != null">#{patCardType},
+ </if>
+ <if test="patIdCardNum != null">#{patIdCardNum},
+ </if>
+ <if test="patAddr != null">#{patAddr},
+ </if>
+ <if test="patTel != null">#{patTel},
+ </if>
+ <if test="patWayCode != null">#{patWayCode},
+ </if>
+ <if test="patWay != null">#{patWay},
+ </if>
+ <if test="appointTypeSn != null">#{appointTypeSn},
+ </if>
+ <if test="appointDate != null">#{appointDate},
+ </if>
+ <if test="appointOperatorId != null">#{appointOperatorId},
+ </if>
+ <if test="appointOperatorName != null">#{appointOperatorName},
+ </if>
+ <if test="appointRegistDate != null">#{appointRegistDate},
+ </if>
+ <if test="registerScheduleSn != null">#{registerScheduleSn},
+ </if>
+ <if test="outpatCateSn != null">#{outpatCateSn},
+ </if>
+ <if test="outpatCateName != null">#{outpatCateName},
+ </if>
+ <if test="registDeptCode != null">#{registDeptCode},
+ </if>
+ <if test="registDeptName != null">#{registDeptName},
+ </if>
+ <if test="deptPinyinCode != null">#{deptPinyinCode},
+ </if>
+ <if test="registDoctCode != null">#{registDoctCode},
+ </if>
+ <if test="registDoctName != null">#{registDoctName},
+ </if>
+ <if test="staffPinyinCode != null">#{staffPinyinCode},
+ </if>
+ <if test="registTimeCate != null">#{registTimeCate},
+ </if>
+ <if test="patiRegistSn != null">#{patiRegistSn},
+ </if>
+ <if test="scheduleRegistCharge != null">#{scheduleRegistCharge},
+ </if>
+ <if test="registRecSn != null">#{registRecSn},
+ </if>
+ <if test="regUserSn != null">#{regUserSn},
+ </if>
+ <if test="regUserName != null">#{regUserName},
+ </if>
+ <if test="regOptTime != null">#{regOptTime},
+ </if>
+ <if test="revokeUserSn != null">#{revokeUserSn},
+ </if>
+ <if test="revokeUserName != null">#{revokeUserName},
+ </if>
+ <if test="revokeOptTime != null">#{revokeOptTime},
+ </if>
+ <if test="withdrawalTime != null">#{withdrawalTime},
+ </if>
+ <if test="scheduleStatusFlag != null">#{scheduleStatusFlag},
+ </if>
+ <if test="scheduleMemoDesc != null">#{scheduleMemoDesc},
+ </if>
+ <if test="scheduleCredenceNum != null">#{scheduleCredenceNum},
+ </if>
+ <if test="registTimeRange != null">#{registTimeRange},
+ </if>
+ <if test="scheduleDetailSn != null">#{scheduleDetailSn},
+ </if>
+ <if test="treatDate != null">#{treatDate},
+ </if>
+ <if test="treatDoctCode != null">#{treatDoctCode},
+ </if>
+ <if test="treatDoctName != null">#{treatDoctName},
+ </if>
+ <if test="regWayCode != null">#{regWayCode},
+ </if>
+ <if test="regWay != null">#{regWay},
+ </if>
+ <if test="regSystemWayCode != null">#{regSystemWayCode},
+ </if>
+ <if test="regSystemWay != null">#{regSystemWay},
+ </if>
+ <if test="createTime != null">#{createTime},
+ </if>
+ <if test="updateTime != null">#{updateTime},
+ </if>
+ <if test="visitFlag != null">#{visitFlag},
+ </if>
+ <if test="senderId != null">#{senderId},
+ </if>
+ <if test="senderName != null">#{senderName},
+ </if>
+ <if test="sendTime != null">#{sendTime},
+ </if>
+ </trim>
+ </insert>
+
+ <update id="updateServiceAppointRecord" parameterType="com.ruoyi.datacollection.domain.ServiceAppointRecord">
+ update service_appoint_record
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="appointRecSn != null">appoint_rec_sn =
+ #{appointRecSn},
+ </if>
+ <if test="changeAppointRecSn != null">change_appoint_rec_sn =
+ #{changeAppointRecSn},
+ </if>
+ <if test="orgCode != null">org_code =
+ #{orgCode},
+ </if>
+ <if test="patFileSn != null">pat_file_sn =
+ #{patFileSn},
+ </if>
+ <if test="patMediaSn != null">pat_media_sn =
+ #{patMediaSn},
+ </if>
+ <if test="patMediaNum != null">pat_media_num =
+ #{patMediaNum},
+ </if>
+ <if test="patCateSn != null">pat_cate_sn =
+ #{patCateSn},
+ </if>
+ <if test="patNatureSn != null">pat_nature_sn =
+ #{patNatureSn},
+ </if>
+ <if test="patFileName != null">pat_file_name =
+ #{patFileName},
+ </if>
+ <if test="patFileGender != null">pat_file_gender =
+ #{patFileGender},
+ </if>
+ <if test="patAge != null">pat_age =
+ #{patAge},
+ </if>
+ <if test="patBirthday != null">pat_birthday =
+ #{patBirthday},
+ </if>
+ <if test="patCardTypeCode != null">pat_card_type_code =
+ #{patCardTypeCode},
+ </if>
+ <if test="patCardType != null">pat_card_type =
+ #{patCardType},
+ </if>
+ <if test="patIdCardNum != null">pat_id_card_num =
+ #{patIdCardNum},
+ </if>
+ <if test="patAddr != null">pat_addr =
+ #{patAddr},
+ </if>
+ <if test="patTel != null">pat_tel =
+ #{patTel},
+ </if>
+ <if test="patWayCode != null">pat_way_code =
+ #{patWayCode},
+ </if>
+ <if test="patWay != null">pat_way =
+ #{patWay},
+ </if>
+ <if test="appointTypeSn != null">appoint_type_sn =
+ #{appointTypeSn},
+ </if>
+ <if test="appointDate != null">appoint_date =
+ #{appointDate},
+ </if>
+ <if test="appointOperatorId != null">appoint_operator_id =
+ #{appointOperatorId},
+ </if>
+ <if test="appointOperatorName != null">appoint_operator_name =
+ #{appointOperatorName},
+ </if>
+ <if test="appointRegistDate != null">appoint_regist_date =
+ #{appointRegistDate},
+ </if>
+ <if test="registerScheduleSn != null">register_schedule_sn =
+ #{registerScheduleSn},
+ </if>
+ <if test="outpatCateSn != null">outpat_cate_sn =
+ #{outpatCateSn},
+ </if>
+ <if test="outpatCateName != null">outpat_cate_name =
+ #{outpatCateName},
+ </if>
+ <if test="registDeptCode != null">regist_dept_code =
+ #{registDeptCode},
+ </if>
+ <if test="registDeptName != null">regist_dept_name =
+ #{registDeptName},
+ </if>
+ <if test="deptPinyinCode != null">dept_pinyin_code =
+ #{deptPinyinCode},
+ </if>
+ <if test="registDoctCode != null">regist_doct_code =
+ #{registDoctCode},
+ </if>
+ <if test="registDoctName != null">regist_doct_name =
+ #{registDoctName},
+ </if>
+ <if test="staffPinyinCode != null">staff_pinyin_code =
+ #{staffPinyinCode},
+ </if>
+ <if test="registTimeCate != null">regist_time_cate =
+ #{registTimeCate},
+ </if>
+ <if test="patiRegistSn != null">pati_regist_sn =
+ #{patiRegistSn},
+ </if>
+ <if test="scheduleRegistCharge != null">schedule_regist_charge =
+ #{scheduleRegistCharge},
+ </if>
+ <if test="registRecSn != null">regist_rec_sn =
+ #{registRecSn},
+ </if>
+ <if test="regUserSn != null">reg_user_sn =
+ #{regUserSn},
+ </if>
+ <if test="regUserName != null">reg_user_name =
+ #{regUserName},
+ </if>
+ <if test="regOptTime != null">reg_opt_time =
+ #{regOptTime},
+ </if>
+ <if test="revokeUserSn != null">revoke_user_sn =
+ #{revokeUserSn},
+ </if>
+ <if test="revokeUserName != null">revoke_user_name =
+ #{revokeUserName},
+ </if>
+ <if test="revokeOptTime != null">revoke_opt_time =
+ #{revokeOptTime},
+ </if>
+ <if test="withdrawalTime != null">withdrawal_time =
+ #{withdrawalTime},
+ </if>
+ <if test="scheduleStatusFlag != null">schedule_status_flag =
+ #{scheduleStatusFlag},
+ </if>
+ <if test="scheduleMemoDesc != null">schedule_memo_desc =
+ #{scheduleMemoDesc},
+ </if>
+ <if test="scheduleCredenceNum != null">schedule_credence_num =
+ #{scheduleCredenceNum},
+ </if>
+ <if test="registTimeRange != null">regist_time_range =
+ #{registTimeRange},
+ </if>
+ <!-- 鍘熶负 `#{schedDetailSn}`锛氬疄浣撳睘鎬у彨 scheduleDetailSn锛坱est 閲岀敤鐨勪篃鏄畠锛夛紝
+ schedDetailSn 涓嶅瓨鍦� 鈥斺�� 涓�鏃﹁蛋鍒拌繖鏉″垎鏀氨鎶�
+ ReflectionException: no getter for 'schedDetailSn'銆� -->
+ <if test="scheduleDetailSn != null">schedule_detail_sn =
+ #{scheduleDetailSn},
+ </if>
+ <if test="treatDate != null">treat_date =
+ #{treatDate},
+ </if>
+ <if test="treatDoctCode != null">treat_doct_code =
+ #{treatDoctCode},
+ </if>
+ <if test="treatDoctName != null">treat_doct_name =
+ #{treatDoctName},
+ </if>
+ <if test="regWayCode != null">reg_way_code =
+ #{regWayCode},
+ </if>
+ <if test="regWay != null">reg_way =
+ #{regWay},
+ </if>
+ <if test="regSystemWayCode != null">reg_system_way_code =
+ #{regSystemWayCode},
+ </if>
+ <if test="regSystemWay != null">reg_system_way =
+ #{regSystemWay},
+ </if>
+ <if test="createTime != null">create_time =
+ #{createTime},
+ </if>
+ <if test="updateTime != null">update_time =
+ #{updateTime},
+ </if>
+ <if test="visitFlag != null">visit_flag =
+ #{visitFlag},
+ </if>
+ <if test="senderId != null">sender_id =
+ #{senderId},
+ </if>
+ <if test="senderName != null">sender_name =
+ #{senderName},
+ </if>
+ <if test="sendTime != null">send_time =
+ #{sendTime},
+ </if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <update id="deleteServiceAppointRecordById" parameterType="Long">
+ update service_appoint_record
+ <trim prefix="SET" suffixOverrides=",">
+ del_flag =1
+ </trim>
+ where id = #{id}
+ </update>
+
+ <update id="deleteServiceAppointRecordByIds" parameterType="String">
+ update service_appoint_record
+ <trim prefix="SET" suffixOverrides=",">
+ del_flag =1
+ </trim>
+ where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </update>
+
+
+</mapper>
--
Gitblit v1.9.3