From 7ca6d7d7da579f9a32c7d253eccb0f4e1ba6b6ef Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 20 一月 2026 14:01:55 +0800
Subject: [PATCH] 【丽水】/smartor/patarchive/patInfoByContion、/smartor/patarchive/exportPatInfo、/smartor/patarchive/getPatientInfoQC 调整sql,不关联pat_archivetag
---
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml | 150 +++++++++++++++++++++++++----
smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml | 17 +++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java | 8
smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java | 4
smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java | 12 ++
smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java | 56 +++++++++++
smartor/src/main/java/com/smartor/service/IPatArchiveService.java | 2
7 files changed, 223 insertions(+), 26 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
index 9107aa3..725363a 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
@@ -273,14 +273,14 @@
if (CollectionUtils.isEmpty(patArchiveReq.getLeaveldeptcodes()) || patArchiveReq.getLeaveldeptcodes().size() == 0) {
patArchiveReq.setLeaveldeptcodes(null);
}
- System.out.println("--------11111111:" + patArchiveReq);
+ System.out.println("鑾峰彇鎮h�呬俊鎭�-鍏ュ弬patArchiveReq:" + patArchiveReq);
List<PatArchiveOthreInfo> patientInfo = patArchiveService.getPatientInfoQC(patArchiveReq);
- System.out.println("--------222222:" + patientInfo.size());
+ System.out.println("鑾峰彇鎮h�呬俊鎭�-杩斿洖patientInfo:" + patientInfo.size());
patArchiveReq.setPageSize(null);
patArchiveReq.setPageNum(null);
- List<PatArchiveOthreInfo> patientInfoQC = patArchiveService.getPatientInfoQC(patArchiveReq);
- return getDataTable3(patientInfoQC.size(), patientInfo);
+ Long count = patArchiveService.getPatientInfoQCCount(patArchiveReq);
+ return getDataTable3(count, patientInfo);
}
}
diff --git a/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java b/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java
index 294b5a3..efae19c 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java
@@ -86,6 +86,10 @@
public List<PatArchiveOthreInfo> selectPatArchiveInfoByPhysicalQC(PatArchiveReq patArchive);
+ public Long countPatArchiveInfoByInhospQC(PatArchiveReq patArchive);
+ public Long countPatArchiveInfoByOuthospQC(PatArchiveReq patArchive);
+
+ public Long countPatArchiveInfoByPhysicalQC(PatArchiveReq patArchive);
}
diff --git a/smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java b/smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java
index 92eddc6..bff2066 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java
@@ -1,9 +1,12 @@
package com.smartor.mapper;
import java.util.List;
+import java.util.Map;
import com.smartor.domain.PatArchivetag;
+import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
/**
* 鎮h�呮。妗堟爣绛綧apper鎺ュ彛
@@ -62,4 +65,13 @@
* @return 缁撴灉
*/
public int deletePatArchivetagByIds(Long[] ids);
+
+ /**
+ * 鑾峰彇鎮h�呮爣绛惧瓧绗︿覆
+ *
+ * @param patIds 鎮h�呮。妗堟爣绛句富閿泦鍚�
+ * @return 缁撴灉
+ */
+ @MapKey("patid")
+ public Map<Long,String> getTagsByPatIds(@Param("orgid") String orgid, @Param("patIds") List<Long> patIds);
}
diff --git a/smartor/src/main/java/com/smartor/service/IPatArchiveService.java b/smartor/src/main/java/com/smartor/service/IPatArchiveService.java
index 0620bbc..036fcc9 100644
--- a/smartor/src/main/java/com/smartor/service/IPatArchiveService.java
+++ b/smartor/src/main/java/com/smartor/service/IPatArchiveService.java
@@ -97,4 +97,6 @@
public List<PatArchiveOthreInfo> getPatientInfo(PatArchiveReq patArchiveReq);
public List<PatArchiveOthreInfo> getPatientInfoQC(PatArchiveReq patArchiveReq);
+
+ public Long getPatientInfoQCCount(PatArchiveReq patArchiveReq);
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
index 52072b3..f9a5cb8 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -66,6 +66,8 @@
@Autowired
private RedisCache redisCache;
+ @Autowired
+ private PatArchivetagServiceImpl patArchivetagServiceImpl;
/**
@@ -799,8 +801,62 @@
patArchiveList.addAll(patArchives1);
}
}
+// //鏌ヨtagName
+// List<Long> patIds = patArchiveList.stream().map(PatArchiveOthreInfo::getId).distinct().collect(Collectors.toList());
+// Map<Long, String> patTagMap= patArchivetagMapper.getTagsByPatIds(patArchiveReq.getOrgid(),patIds);
+// //瑁呴厤tagName
+// if(ObjectUtils.isNotEmpty(patTagMap)){
+// patArchiveList.forEach(patArchiveOthreInfo -> {
+// String tagName = patTagMap.get(patArchiveOthreInfo.getId());
+// if(StringUtils.isNotEmpty(tagName)){
+// patArchiveOthreInfo.setTag(tagName);
+// }
+// });
+// }
return patArchiveList;
}
+
+ /**
+ * 鑾峰彇鎮h�呬俊鎭�(鍘婚噸)
+ *
+ * @param patArchiveReq
+ * @return
+ */
+// @Override
+ /**
+ * 鑾峰彇鎮h�呬俊鎭�绘暟锛堝幓閲嶏級
+ *
+ * @param patArchiveReq
+ * @return
+ */
+ @Override
+ public Long getPatientInfoQCCount(PatArchiveReq patArchiveReq) {
+ if (CollectionUtils.isEmpty(patArchiveReq.getLeavehospitaldistrictcodes()) || patArchiveReq.getLeavehospitaldistrictcodes().size() == 0) {
+ patArchiveReq.setLeavehospitaldistrictcodes(null);
+ }
+ if (CollectionUtils.isEmpty(patArchiveReq.getLeaveldeptcodes()) || patArchiveReq.getLeaveldeptcodes().size() == 0) {
+ patArchiveReq.setLeaveldeptcodes(null);
+ }
+
+ Long count = 0L;
+ if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 1) {
+ // 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
+ patArchiveReq.setCry(0);
+ count = patArchiveMapper.countPatArchiveInfoByInhospQC(patArchiveReq);
+ } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) {
+ // 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
+ count = patArchiveMapper.countPatArchiveInfoByOuthospQC(patArchiveReq);
+ } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) {
+ // 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
+ count = patArchiveMapper.countPatArchiveInfoByPhysicalQC(patArchiveReq);
+ } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 4) {
+ // 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
+ patArchiveReq.setCry(1);
+ count = patArchiveMapper.countPatArchiveInfoByInhospQC(patArchiveReq);
+ }
+
+ return count;
+ }
}
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index cbfe8a3..0fb3300 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -586,14 +586,10 @@
d.nurse_id,
d.out_way_id,
d.leavehospitaldistrictname AS leavehospitaldistrictname,
- d.leavehospitaldistrictcode AS leavehospitaldistrictcode,
- t.tagname
+ d.leavehospitaldistrictcode AS leavehospitaldistrictcode
FROM
pat_med_inhosp d
JOIN pat_archive a ON a.id = d.patid
- LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid
- ) t ON t.patid =
- d.patid
where 1=1
and d.del_flag != 1
AND a.del_flag != 1
@@ -812,12 +808,8 @@
a.upload_time,
a.filter_drname,
a.filter_drcode,
- t.tagname,
a.pattype
from pat_med_physical d JOIN pat_archive a ON a.id = d.patid
- LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid
- ) t ON t.patid =
- d.patid
where 1=1
and d.del_flag != 1
AND a.del_flag != 1
@@ -917,14 +909,10 @@
d.nurse_id,
d.out_way_id,
d.leavehospitaldistrictname AS leavehospitaldistrictname,
- d.leavehospitaldistrictcode AS leavehospitaldistrictcode,
- t.tagname
+ d.leavehospitaldistrictcode AS leavehospitaldistrictcode
FROM
pat_med_inhosp d
JOIN pat_archive a ON a.id = d.patid
- LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid
- ) t ON t.patid =
- d.patid
where 1=1
and d.del_flag != 1
AND a.del_flag != 1
@@ -1054,12 +1042,8 @@
a.upload_time,
a.filter_drname,
a.filter_drcode,
- t.tagname,
a.pattype
from pat_med_outhosp d JOIN pat_archive a ON a.id = d.patid
- LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid
- ) t ON t.patid =
- d.patid
where 1=1
and d.del_flag != 1
AND a.del_flag != 1
@@ -1149,12 +1133,8 @@
a.create_time,
a.isupload,
a.upload_time,
- t.tagname,
a.pattype
from pat_med_physical d JOIN pat_archive a ON a.id = d.patid
- LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid
- ) t ON t.patid =
- d.patid
where 1=1
and d.del_flag != 1
AND a.del_flag != 1
@@ -1197,4 +1177,130 @@
-- order by a.update_time desc
<if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
</select>
+
+ <!-- 浣忛櫌鎮h�呮�绘暟缁熻锛堝幓閲嶏級 -->
+ <select id="countPatArchiveInfoByInhospQC" parameterType="com.smartor.domain.PatArchiveReq" resultType="long">
+ SELECT COUNT(DISTINCT a.id)
+ FROM pat_med_inhosp d
+ JOIN pat_archive a ON a.id = d.patid
+ WHERE 1=1
+ AND d.del_flag != 1
+ AND a.del_flag != 1
+ AND d.orgid = #{orgid}
+ <if test="name != null and name != ''">AND a.name like concat('%', #{name}, '%')</if>
+ <if test="idcardno != null and idcardno != ''">AND a.idcardno = #{idcardno}</if>
+ <if test="pid != null and pid != ''">AND a.id = #{id}</if>
+ <if test="telcode != null and telcode != ''">AND a.telcode = #{telcode}</if>
+ <if test="notrequiredFlag != null and notrequiredFlag != ''">AND a.notrequired_flag = #{notrequiredFlag}</if>
+ <if test="hospitalname != null and hospitalname != ''">AND d.hospitalname = #{hospitalname}</if>
+ <if test="hospitaldistrictname != null and hospitaldistrictname != ''">AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')</if>
+ <if test="leaveicd10code != null and leaveicd10code != ''">AND d.leaveicd10code LIKE concat('%',#{leaveicd10code}, '%')</if>
+ <if test="endtime != null">AND d.endtime = #{endtime}</if>
+ <if test="drname != null and drname != ''">AND d.drname LIKE concat('%',#{drname}, '%')</if>
+ <if test="drcode != null">AND d.drcode = #{drcode}</if>
+ <if test="campusid != null">AND d.campusid = #{campusid}</if>
+ <if test="allhosp != null and allhosp == 1 ">AND d.endtime is null</if>
+ <if test="allhosp != null and allhosp == 4 ">AND d.endtime is not null</if>
+ <if test="visitno != null and visitno != ''">AND d.inhospno = #{visitno}</if>
+ <if test="deptname != null and deptname != ''">AND d.deptname LIKE concat('%', #{deptname}, '%')</if>
+ <if test="leavediagname != null and leavediagname != ''">AND d.leavediagname LIKE concat('%',#{leavediagname}, '%')</if>
+ <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
+ AND d.leavehospitaldistrictcode IN
+ <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator="," close=")">
+ #{leavehospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0">
+ AND d.leaveldeptcode IN
+ <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")">
+ #{leaveldeptcode}
+ </foreach>
+ </if>
+ <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size()>0">
+ AND d.hospitaldistrictcode IN
+ <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator="," close=")">
+ #{hospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="deptcodes != null and deptcodes.size() > 0">
+ AND d.deptcode IN
+ <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ <if test="pids != null">
+ AND a.id NOT IN
+ <foreach collection="pids" item="pid" open="(" separator="," close=")">
+ #{pid}
+ </foreach>
+ </if>
+ <if test="isFilter == true">
+ AND NOT exists ( SELECT 1 FROM pat_filterlist f where d.patid=f.patid)
+ </if>
+ </select>
+
+ <!-- 闂ㄨ瘖鎮h�呮�绘暟缁熻锛堝幓閲嶏級 -->
+ <select id="countPatArchiveInfoByOuthospQC" parameterType="com.smartor.domain.PatArchiveReq" resultType="long">
+ SELECT COUNT(DISTINCT a.id)
+ FROM pat_med_outhosp d
+ JOIN pat_archive a ON a.id = d.patid
+ WHERE 1=1
+ AND d.del_flag != 1
+ AND a.del_flag != 1
+ AND d.orgid = #{orgid}
+ <if test="pid != null and pid != ''">AND a.id = #{pid}</if>
+ <if test="campusid != null and campusid != ''">AND a.campusid = #{campusid}</if>
+ <if test="name != null and name != ''">AND a.name like concat('%', #{name}, '%')</if>
+ <if test="idcardno != null and idcardno != ''">AND a.idcardno = #{idcardno}</if>
+ <if test="telcode != null and telcode != ''">AND a.telcode = #{telcode}</if>
+ <if test="hospitaldistrictname != null and hospitaldistrictname != ''">AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')</if>
+ <if test="notrequiredFlag != null and notrequiredFlag != ''">AND a.notrequired_flag = #{notrequiredFlag}</if>
+ <if test="leavediagname != null and leavediagname != ''">AND d.diagname LIKE concat('%',#{leavediagname}, '%')</if>
+ <if test="hospitalname != null and hospitalname != ''">AND d.hospitalname = #{hospitalname}</if>
+ <if test="visitno != null and visitno != ''">AND d.outhospno = #{visitno}</if>
+ <if test="deptname != null and deptname != ''">AND d.deptname LIKE concat('%', #{deptname}, '%')</if>
+ <if test="drname != null and drname != ''">AND d.drname LIKE concat('%',#{drname}, '%')</if>
+ <if test="drcode != null">AND d.drcode = #{drcode}</if>
+ <if test="pids != null">
+ AND a.id NOT IN
+ <foreach collection="pids" item="pid" open="(" separator="," close=")">
+ #{pid}
+ </foreach>
+ </if>
+ <if test="isFilter == true">
+ AND NOT exists ( SELECT 1 FROM pat_filterlist f where d.patid=f.patid)
+ </if>
+ </select>
+
+ <!-- 浣撴鎮h�呮�绘暟缁熻锛堝幓閲嶏級 -->
+ <select id="countPatArchiveInfoByPhysicalQC" parameterType="com.smartor.domain.PatArchiveReq" resultType="long">
+ SELECT COUNT(DISTINCT a.id)
+ FROM pat_med_physical d
+ JOIN pat_archive a ON a.id = d.patid
+ WHERE 1=1
+ AND d.del_flag != 1
+ AND a.del_flag != 1
+ AND d.orgid = #{orgid}
+ <if test="pid != null and pid != ''">AND a.id = #{pid}</if>
+ <if test="campusid != null and campusid != ''">AND a.campusid = #{campusid}</if>
+ <if test="name != null and name != ''">AND a.name like concat('%', #{name}, '%')</if>
+ <if test="idcardno != null and idcardno != ''">AND a.idcardno = #{idcardno}</if>
+ <if test="telcode != null and telcode != ''">AND a.telcode = #{telcode}</if>
+ <if test="hospitaldistrictname != null and hospitaldistrictname != ''">AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')</if>
+ <if test="diagname != null and diagname != ''">AND d.diagname LIKE concat('%',#{diagname}, '%')</if>
+ <if test="notrequiredFlag != null and notrequiredFlag != ''">AND a.notrequired_flag = #{notrequiredFlag}</if>
+ <if test="hospitalname != null and hospitalname != ''">AND d.hospitalname = #{hospitalname}</if>
+ <if test="visitno != null and visitno != ''">AND d.physno = #{visitno}</if>
+ <if test="deptname != null and deptname != ''">AND d.deptname LIKE concat('%', #{deptname}, '%')</if>
+ <if test="drname != null and drname != ''">AND d.drname LIKE concat('%',#{drname}, '%')</if>
+ <if test="pids != null">
+ AND a.id NOT IN
+ <foreach collection="pids" item="pid" open="(" separator="," close=")">
+ #{pid}
+ </foreach>
+ </if>
+ <if test="isFilter == true">
+ AND NOT exists ( SELECT 1 FROM pat_filterlist f where d.patid=f.patid)
+ </if>
+ </select>
</mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml
index a74e5ac..f00cbe6 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml
@@ -142,4 +142,21 @@
#{id}
</foreach>
</delete>
+
+ <select id="getTagsByPatIds" parameterType="Long" resultType="Map">
+ select patid, GROUP_CONCAT(tagname) AS tagnames
+ where 1=1
+ and del_flag = 0
+ <if test="orgid != null and orgid != ''">
+ AND orgid = #{orgid}
+ </if>
+ <if test="patIds != null and patIds.size()>0">
+ AND patid IN
+ <foreach collection="patIds" item="patId" open="(" separator=","
+ close=")">
+ #{patId}
+ </foreach>
+ </if>
+ group by patid
+ </select>
</mapper>
--
Gitblit v1.9.3