From afb3216a7809c452e0f50555eb52aa9bc985f66b Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 06 十一月 2025 17:49:10 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/service/IPatMedInhospService.java                        |    5 +
 smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java                |    5 +
 smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java |   16 +++-
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml                           |   73 +++++++++++++++++++++++
 smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java                 |   12 ++-
 smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java                         |    2 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java        |   10 +++
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml                         |    8 +-
 smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java                           |    2 
 9 files changed, 115 insertions(+), 18 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java b/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
index 1116ce8..55ea74e 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
@@ -25,6 +25,8 @@
      */
     public PatMedInhosp selectPatMedInhospByInhospid(Long inhospid);
 
+    public  List<PatMedInhosp> selectPatMedInhosp(PatMedInhosp patMedInhosp);
+
     public String getTagnameBypatid(Long patid);
 
     /**
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
index cba167c..7fbdf87 100644
--- a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
@@ -39,7 +39,7 @@
 
     public List<ServiceSubtask> selectServiceSubtaskListAgain(ServiceSubtaskVO serviceSubtaskVO);
 
-    public Integer selectSendstateByCondition(ServiceSubtask serviceSubtask);
+    public List<Integer> selectSendstateByCondition(ServiceSubtask serviceSubtask);
 
     /**
      * 鏂板鍗曚竴浠诲姟锛堥殢璁匡級
diff --git a/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java b/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
index 486b098..6f94251 100644
--- a/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
+++ b/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
@@ -23,6 +23,8 @@
      */
     public PatMedInhosp selectPatMedInhospByInhospid(Long inhospid);
 
+    public List<PatMedInhosp> selectPatMedInhosp(PatMedInhosp patMedInhosp);
+
     /**
      * 鏌ヨ鎮h�呬綇闄㈣褰曞垪琛�
      *
@@ -34,7 +36,7 @@
     /**
      * 鍑洪櫌銆侀棬璇婁汉鏁板拰闅忚閲忕粺璁★紙鍛紝鏈堬紝骞达級
      */
-    public Map<String,Integer> queryPersonCount(PatServiceCount patServiceCount);
+    public Map<String, Integer> queryPersonCount(PatServiceCount patServiceCount);
 
     /**
      * 鏌ヨ褰撳墠鐧婚檰浜鸿嚜宸憋紙鐥呭尯銆侀儴闂級鐨勬偅鑰呬綇闄㈣褰曞垪琛�
@@ -100,6 +102,7 @@
 
     /**
      * 鍖绘姢涓庢偅鑰呭叧鑱斿叧绯�
+     *
      * @param patMedInhosp
      * @return
      */
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
index 964e0b8..ec64254 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -66,6 +66,11 @@
         return patMedInhospMapper.selectPatMedInhospByInhospid(inhospid);
     }
 
+    @Override
+    public  List<PatMedInhosp> selectPatMedInhosp(PatMedInhosp patMedInhosp) {
+        return patMedInhospMapper.selectPatMedInhosp(patMedInhosp);
+    }
+
     /**
      * 鏌ヨ鎮h�呬綇闄㈣褰曞垪琛�
      *
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
index 2c40db6..ced4367 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -441,11 +441,14 @@
             if (Objects.isNull(dto)) continue;
             PatArchive patArchive = processPatientArchive(dto, orgid);
             PatMedOuthosp patMedOuthosp = buildPatMedOuthosp(dto, patArchive, orgid);
-            //鏌ヨ褰撳墠鏂板鐨勯棬鎬ヨ瘖鏁版嵁锛屾槸鍚﹀湪杩囨浮琛ㄤ腑鏄惁瀛樺湪锛屽鏋滃瓨鍦紝灏变笉寰�闂ㄦ�ヨ瘖琛ㄩ噷鏂板浜�
-            PatMedOuthospProvisional pmop = DtoConversionUtils.sourceToTarget(patMedOuthosp, PatMedOuthospProvisional.class);
+//            //鏌ヨ褰撳墠鏂板鐨勯棬鎬ヨ瘖鏁版嵁锛屾槸鍚﹀湪杩囨浮琛ㄤ腑鏄惁瀛樺湪锛屽鏋滃瓨鍦紝灏变笉寰�闂ㄦ�ヨ瘖琛ㄩ噷鏂板浜�(杩欎釜鍏堜笉鍐欎簡锛屾娊绌轰簡鍐嶅啓)
+//            PatMedOuthospProvisional pmop = DtoConversionUtils.sourceToTarget(patMedOuthosp, PatMedOuthospProvisional.class);
 
-
-            patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
+            //鍏堟煡璇竴涓嬶紝鏄笉鏄凡缁忓瓨鍦ㄨ娴佹按鍙蜂簡锛屽鏋滃瓨鍦紝灏变笉鏂板浜�
+            PatMedOuthosp pmo2 = new PatMedOuthosp();
+            pmo2.setSerialnum(patMedOuthosp.getSerialnum());
+            List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(pmo2);
+            if (CollectionUtils.isEmpty(patMedOuthosps)) patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
         }
         return true;
     }
@@ -503,11 +506,14 @@
         queryInhosp.setCampusid(dto.getCampusId());
         queryInhosp.setInhospstate(cry);
         log.info("----------------杩欓噷鐨勫叆鍙備负锛歿}", queryInhosp);
-        List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhospList(queryInhosp);
+        List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhosp(queryInhosp);
 
         if (cry.equals("0") && CollectionUtils.isNotEmpty(existingInhosps)) {
             //鏂板杩囩殑鍏ラ櫌鏁版嵁锛屼笉鍐嶅鐞�
             return;
+        } else if (cry.equals("1") && CollectionUtils.isNotEmpty(existingInhosps)) {
+            //鏂板杩囩殑鍑洪櫌鏁版嵁锛屼篃涓嶅啀澶勭悊
+            return;
         }
 
         log.info("----------------杩欓噷鐨勮繑鍙備负锛歿}", existingInhosps);
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
index 651aa39..b418568 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -717,6 +717,13 @@
         for (Integer taskId : sendTaskids) {
             ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(Long.valueOf(taskId));
             String content = sendMQContent(serviceTask, null);
+            //鍏堟煡璇竴涓嬶紝璇ユ偅鑰呭湪璇ervice_task涓紝鏄惁宸茬粡瀛樺湪,濡傛灉宸茬粡瀛樺湪锛屽垯涓嶇敤鍐嶄繚瀛樹簡
+            ServiceSubtask ss = new ServiceSubtask();
+            ss.setTaskid(Long.valueOf(taskId));
+            ss.setPatid(serviceSubtask.getPatid());
+            List<Integer> list = serviceSubtaskMapper.selectSendstateByCondition(ss);
+            if (CollectionUtils.isNotEmpty(list)) return true;
+
             //鍏堜慨鏀圭姸鎬�
             insertServiceSubtask(serviceTask, new Date(), serviceSubtask);
             //绔嬪嵆鍙戦��
@@ -724,7 +731,7 @@
             serviceTask.setStopState(null);
             log.info("娑堟伅鍙戦�佹垚鍔�");
         }
-        return null;
+        return true;
     }
 
 
@@ -736,6 +743,7 @@
         serviceSubtask.setTemplatename(serviceTask.getTemplatename());
         serviceSubtask.setTemplateid(serviceTask.getTemplateid());
         serviceSubtask.setSendstate(2L);
+        serviceSubtask.setCurrentPreachform(null);
         serviceSubtask.setVisitTime(date);
         serviceSubtask.setId(null);
         serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
index e986244..6bbc751 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -263,9 +263,10 @@
                 ServiceSubtask ss = new ServiceSubtask();
                 ss.setTaskid(taskid);
                 ss.setPatid(patid);
-                Integer integer = serviceSubtaskMapper.selectSendstateByCondition(ss);
-                if (integer != null && integer != 6) {
-                    ss.setSendstate(1L);
+                ss.setSendstate(3L);
+                List<Integer> integer = serviceSubtaskMapper.selectSendstateByCondition(ss);
+                if (integer != null) {
+                    ss.setSendstate(6L);
                     serviceSubtaskMapper.updateServiceSubtaskByCondition(ss);
                 }
             }
@@ -603,8 +604,9 @@
             ServiceSubtask serviceSubtask = new ServiceSubtask();
             serviceSubtask.setTaskid(taskid);
             serviceSubtask.setPatid(patid);
-            Integer integer = serviceSubtaskMapper.selectSendstateByCondition(serviceSubtask);
-            if (integer == 3) {
+            serviceSubtask.setSendstate(3L);
+            List<Integer> integer = serviceSubtaskMapper.selectSendstateByCondition(serviceSubtask);
+            if (integer != null) {
                 serviceSubtask.setResult("瀹屾垚");
                 serviceSubtask.setFinishtime(new Date());
                 serviceSubtask.setSendstate(6L);
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index 820d717..5682971 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -305,7 +305,8 @@
         </if>
     </select>
 
-    <select id="selectPatMedInhospListBySerialnum" parameterType="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult">
+    <select id="selectPatMedInhospListBySerialnum" parameterType="com.smartor.domain.PatMedInhosp"
+            resultMap="PatMedInhospResult">
         select
         b.inhospid,
         b.nurse_id,
@@ -507,6 +508,74 @@
     <select id="selectPatMedInhospByInhospid" parameterType="Long" resultMap="PatMedInhospResult">
         <include refid="selectPatMedInhospVo"/>
         where inhospid = #{inhospid}
+    </select>
+
+    <select id="selectPatMedInhosp" parameterType="Long" resultMap="PatMedInhospResult">
+        <include refid="selectPatMedInhospVo"/>
+        where del_flag=0
+        <if test="cry != null and cry == 0 ">and endtime is null</if>
+        <if test="cry != null and cry == 1 ">and inhospstate=1</if>
+        <if test="serialnum != null">and serialnum = #{serialnum}</if>
+        <if test="hospitalname != null">and hospitalname = #{hospitalname}</if>
+        <if test="hospitalcode != null">and hospitalcode = #{hospitalcode}</if>
+        <if test="hospitaldistrictcode != null">and hospitaldistrictcode = #{hospitaldistrictcode}</if>
+        <if test="hospitaldistrictname != null">and hospitaldistrictname = #{hospitaldistrictname}</if>
+        <if test="icd10code != null">and icd10code = #{icd10code}</if>
+        <if test="diagname != null">and diagname = #{diagname}</if>
+        <if test="starttime != null">and starttime = #{starttime}</if>
+        <if test="endtime != null">and endtime = #{endtime}</if>
+        <if test="deptcode != null">and deptcode = #{deptcode}</if>
+        <if test="deptname != null">and deptname = #{deptname}</if>
+        <if test="roomno != null">and roomno = #{roomno}</if>
+        <if test="bedNo != null">and bed_no = #{bedNo}</if>
+        <if test="orgid != null">and orgid = #{orgid}</if>
+        <if test="updateBy != null">and update_by = #{updateBy}</if>
+        <if test="updateTime != null">and update_time = #{updateTime}</if>
+        <if test="createBy != null">and create_by = #{createBy}</if>
+        <if test="createTime != null">and create_time = #{createTime}</if>
+        <if test="isupload != null">and isupload = #{isupload}</if>
+        <if test="uploadTime != null">and upload_time = #{uploadTime}</if>
+        <if test="patid != null">and patid = #{patid}</if>
+        <if test="leavediagname != null">and leavediagname = #{leavediagname}</if>
+        <if test="leaveicd10code != null">and leaveicd10code = #{leaveicd10code}</if>
+        <if test="drcode != null">and drcode = #{drcode}</if>
+        <if test="drname != null">and drname = #{drname}</if>
+        <if test="schemestatus != null">and schemestatus = #{schemestatus}</if>
+        <if test="generalschemestatus != null">and generalschemestatus = #{generalschemestatus}</if>
+        <if test="leaveldeptcode != null">and leaveldeptcode = #{leaveldeptcode}</if>
+        <if test="leaveldeptname != null">and leaveldeptname = #{leaveldeptname}</if>
+        <if test="hospitaldistrictid != null">and hospitaldistrictid = #{hospitaldistrictid}</if>
+        <if test="leavehospitaldistrictcode != null">and leavehospitaldistrictcode = #{leavehospitaldistrictcode}</if>
+        <if test="leavehospitaldistrictname != null">and leavehospitaldistrictname = #{leavehospitaldistrictname}</if>
+        <if test="leavehospitaldistrictid != null">and leavehospitaldistrictid = #{leavehospitaldistrictid}</if>
+        <if test="deptid != null">and deptid = #{deptid}</if>
+        <if test="leaveldeptid != null">and leaveldeptid = #{leaveldeptid}</if>
+        <if test="schemetime != null">and schemetime = #{schemetime}</if>
+        <if test="patname!= null">and patname = #{patname}</if>
+        <if test="patno != null">and patno = #{patno}</if>
+        <if test="inhospstate != null">and inhospstate = #{inhospstate}</if>
+        <if test="deptcheckFlag != null">and deptcheck_flag = #{deptcheckFlag}</if>
+        <if test="wardcheckFlag != null">and wardcheck_flag = #{wardcheckFlag}</if>
+        <if test="diagcheckFlag != null">and diagcheck_flag = #{diagcheckFlag}</if>
+        <if test="longTaskReason != null">and long_task_reason = #{longTaskReason}</if>
+        <if test="nurseId != null ">and nurse_id = #{nurseId}</if>
+        <if test="nurseName != null ">and nurse_name = #{nurseName}</if>
+        <if test="outWayId != null ">and out_way_id = #{outWayId}</if>
+        <if test="outWayName != null ">and out_way_name = #{outWayName}</if>
+        <if test="guid != null ">and guid = #{guid}</if>
+        <if test="operator != null ">and operator = #{operator}</if>
+        <if test="operatorId != null ">and operator_id = #{operatorId}</if>
+        <if test="remark != null ">and remark = #{remark}</if>
+        <if test="fuflag != null ">and fuflag = #{fuflag}</if>
+        <if test="fudate != null ">and fudate = #{fudate}</if>
+        <if test="fuperiod != null ">and fuperiod = #{fuperiod}</if>
+        <if test="futypecode != null ">and futypecode = #{futypecode}</if>
+        <if test="futypedesc != null ">and futypedesc = #{futypedesc}</if>
+        <if test="fuadvice != null ">and fuadvice = #{fuadvice}</if>
+        <if test="fuspecialadvice != null ">and fuspecialadvice = #{fuspecialadvice}</if>
+        <if test="managementDoctor != null ">and management_doctor = #{managementDoctor}</if>
+        <if test="managementDoctorCode != null ">and management_doctor_code = #{managementDoctorCode}</if>
+        <if test="campusid != null ">and campusid = #{campusid}</if>
     </select>
 
 
@@ -751,7 +820,7 @@
             <if test="fuadvice != null ">fuadvice = #{fuadvice},</if>
             <if test="fuspecialadvice != null ">fuspecialadvice = #{fuspecialadvice},</if>
             <if test="managementDoctor != null ">management_doctor = #{managementDoctor},</if>
-            <if test="managementDoctorCode != null ">management_doctor_code = #{managementDoctorCode}</if>
+            <if test="managementDoctorCode != null ">management_doctor_code = #{managementDoctorCode},</if>
             <if test="campusid != null ">campusid = #{campusid}</if>
 
         </trim>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index f7a491e..ef7deab 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -475,9 +475,11 @@
     <select id="selectSendstateByCondition" parameterType="com.smartor.domain.ServiceSubtask" resultType="Integer">
         SELECT b.sendstate
         from service_task a
-                 JOIN service_subtask b on a.taskid = b.taskid and a.pat_cycle = 0 and b.del_flag = 0
-        where b.taskid = #{taskid}
-          and b.patid = #{patid}
+        JOIN service_subtask b on a.taskid = b.taskid and a.pat_cycle = 0 and b.del_flag = 0
+        <where>b.taskid = #{taskid}
+            and b.patid = #{patid}
+            <if test="sendstate != null ">and b.sendstate = #{sendstate}</if>
+        </where>
     </select>
 
     <select id="selectTimelyRate" parameterType="com.smartor.domain.ServiceSubtask" resultType="double">

--
Gitblit v1.9.3