From 9b1e3b14a3241ce277570329796a808876bc5fc1 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 29 九月 2026 14:34:20 +0800
Subject: [PATCH] 【丽水】拿患者最高等级手术进行生成(有三级、四级记录只生成4级的)
---
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java | 7 +
smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml | 129 +++++++++++++++++++++++++++++++++++++++++++
smartor/src/main/java/com/smartor/mapper/PatMedOperationItemMapper.java | 8 ++
3 files changed, 142 insertions(+), 2 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/mapper/PatMedOperationItemMapper.java b/smartor/src/main/java/com/smartor/mapper/PatMedOperationItemMapper.java
index 440bf66..f4a26b0 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatMedOperationItemMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatMedOperationItemMapper.java
@@ -108,4 +108,12 @@
*/
public List<PatMedOperationItem> selectOperationItemList(PatMedOperationItem patMedOperationItem);
+ /**
+ * 鏌ヨ鎮h�呮鏌ユ楠岃褰曞瓙鍒楄〃锛堝悓涓�opid涓嬪彧鍙杘plevelcode鏈�澶х殑璁板綍锛�
+ *
+ * @param patMedOperationItem 鎮h�呮鏌ユ楠岃褰曞瓙
+ * @return 鎮h�呮鏌ユ楠岃褰曞瓙闆嗗悎
+ */
+ public List<PatMedOperationItem> selectOperationItemListMaxLevel(PatMedOperationItem patMedOperationItem);
+
}
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 5d469aa..bfeba63 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -520,7 +520,9 @@
pmoi.setDeptCodes(deptCodeList);
pmoi.setWardCodes(wardCodeList);
pmoi.setOpLevelCodes(opLevelCodeList);
- List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectOperationItemList(pmoi);
+
+ //姣忔鏌ヨ鍙煡鏈�澶х殑鎵嬫湳绛夌骇璁板綍
+ List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectOperationItemListMaxLevel(pmoi);
for (PatMedOperationItem patMedOperationItem : patMedOperationItems) {
PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOperationItem.getPatid());
if (Objects.isNull(patArchive)) {
@@ -1321,7 +1323,8 @@
pmoi.setOpercheckFlag("0");
pmoi.setMainFlag("1");
- List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectOperationItemList(pmoi);
+ //姣忔鏌ヨ鍙煡鏈�澶х殑鎵嬫湳绛夌骇璁板綍
+ List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectOperationItemListMaxLevel(pmoi);
log.info("dealOutHospInfo闇�瑕佸鐞嗙殑鍑洪櫌鎵嬫湳鎮h�呬俊鎭細{}", CollectionUtils.isNotEmpty(patMedOperationItems) ? patMedOperationItems.size() : null);
for (PatMedOperationItem opItem : patMedOperationItems) {
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
index f654970..5f213b6 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
@@ -660,4 +660,133 @@
</if>
</select>
+ <select id="selectOperationItemListMaxLevel" parameterType="com.smartor.domain.PatMedOperationItem"
+ resultMap="PatMedOperationItemResult">
+ select pmoi.id, pmoi.operationid, pmoi.opid, pmoi.opcode, pmoi.opdesc, pmoi.main_flag, pmoi.incitypecode,
+ pmoi.incitypedesc, pmoi.oplevelcode, pmoi.opleveldesc, pmoi.opposition, pmoi.del_flag, pmoi.update_by,
+ pmoi.update_time, pmoi.create_by, pmoi.create_time, pmoi.isupload, pmoi.upload_time, pmoi.orgid,
+ pmoi.pguid, pmoi.guid, pmoi.pid, pmoi.opercheck_flag, pmoi.long_task_reason,
+ pmo.deptcode, pmo.deptname, pmo.hospitaldistrictcode, pmo.hospitaldistrictname,
+ pmo.leaveldeptcode, pmo.leaveldeptname, pmo.leavehospitaldistrictcode, pmo.leavehospitaldistrictname, pmo.patid,
+ pmo.drcode, pmo.drname, pmo.nurse_id, pmo.nurse_name,
+ pmo.serialnum, pmi.inhospstate
+ from pat_med_operation pmo
+ join pat_med_operation_item pmoi
+ on pmoi.opid = pmo.opid
+ join (
+ select opid, max(oplevelcode) as max_oplevelcode
+ from pat_med_operation_item
+ where del_flag = '0'
+ and opid is not null
+ and oplevelcode is not null
+ group by opid
+ ) pmoi_max
+ on pmoi_max.opid = pmoi.opid
+ and (pmoi.oplevelcode = pmoi_max.max_oplevelcode
+ or (pmoi.oplevelcode is null and pmoi_max.max_oplevelcode is null))
+ join pat_med_inhosp pmi
+ on pmo.serialnum = pmi.serialnum
+ where
+ pmo.del_flag = '0'
+ and pmoi.del_flag = '0'
+ and pmo.opid is not null
+ and pmoi.opid is not null
+ <if test="operationid != null ">
+ and pmoi.operationid = #{operationid}
+ </if>
+ <if test="opid != null ">
+ and pmoi.opid = #{opid}
+ </if>
+ <if test="opcode != null and opcode != ''">
+ and pmoi.opcode = #{opcode}
+ </if>
+ <if test="opdesc != null and opdesc != ''">
+ and pmoi.opdesc = #{opdesc}
+ </if>
+ <if test="mainFlag != null and mainFlag != ''">
+ and pmoi.main_flag = #{mainFlag}
+ </if>
+ <if test="incitypecode != null and incitypecode != ''">
+ and pmoi.incitypecode = #{incitypecode}
+ </if>
+ <if test="incitypedesc != null and incitypedesc != ''">
+ and pmoi.incitypedesc = #{incitypedesc}
+ </if>
+ <if test="oplevelcode != null and oplevelcode != ''">
+ and pmoi.oplevelcode = #{oplevelcode}
+ </if>
+ <if test="opleveldesc != null and opleveldesc != ''">
+ and pmoi.opleveldesc = #{opleveldesc}
+ </if>
+ <if test="opposition != null and opposition != ''">
+ and pmoi.opposition = #{opposition}
+ </if>
+ <if test="isupload != null ">
+ and pmoi.isupload = #{isupload}
+ </if>
+ <if test="uploadTime != null ">
+ and pmoi.upload_time = #{uploadTime}
+ </if>
+ <if test="orgid != null and orgid != ''">
+ and pmoi.orgid = #{orgid}
+ </if>
+ <if test="pguid != null and pguid != ''">
+ and pmoi.pguid = #{pguid}
+ </if>
+ <if test="guid != null and guid != ''">
+ and pmoi.guid = #{guid}
+ </if>
+ <if test="pid != null ">
+ and pmoi.pid = #{pid}
+ </if>
+ <if test="inhospstate != null and inhospstate != ''">
+ and pmi.inhospstate = #{inhospstate}
+ <if test="inhospstate == '1'">
+ and pmi.endtime is not null
+ </if>
+ </if>
+ <if test="serialnum != null and serialnum != ''">
+ and pmo.serialnum = #{serialnum}
+ </if>
+ <if test="deptcode != null and deptcode != ''">
+ and pmo.deptcode = #{deptcode}
+ </if>
+ <if test="deptname != null and deptname != ''">
+ and pmo.deptname = #{deptname}
+ </if>
+ <if test="hospitaldistrictcode != null and hospitaldistrictcode != ''">
+ and pmo.hospitaldistrictcode = #{hospitaldistrictcode}
+ </if>
+ <if test="hospitaldistrictname != null and hospitaldistrictname != ''">
+ and pmo.hospitaldistrictname = #{hospitaldistrictname}
+ </if>
+ <if test="patid != null">
+ and pmo.patid = #{patid}
+ </if>
+ <if test="deptCodes != null and deptCodes.size()>0">
+ AND pmo.deptcode IN
+ <foreach collection="deptCodes" item="deptcode" open="(" separator=","
+ close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ <if test="wardCodes != null and wardCodes.size()>0">
+ AND pmo.hospitaldistrictcode IN
+ <foreach collection="wardCodes" item="wardCode" open="(" separator=","
+ close=")">
+ #{wardCode}
+ </foreach>
+ </if>
+ <if test="opLevelCodes != null and opLevelCodes.size()>0">
+ AND pmoi.oplevelcode IN
+ <foreach collection="opLevelCodes" item="levelCode" open="(" separator=","
+ close=")">
+ #{levelCode}
+ </foreach>
+ </if>
+ <if test="opercheckFlag != null">
+ and pmoi.opercheck_flag = #{opercheckFlag}
+ </if>
+ </select>
+
</mapper>
--
Gitblit v1.9.3