From 06feddd673c57d60be77ce8e64c63008605b8502 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 25 五月 2026 10:26:40 +0800
Subject: [PATCH] 【丽水】patItem 报错问题处理
---
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java | 148 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 123 insertions(+), 25 deletions(-)
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 1c4d159..0ec57d6 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -319,7 +319,6 @@
//鑾峰彇鏈鐞嗗湪闄㈢殑鏁版嵁(濡傛灉鍒氬垰鍑洪櫌鐨勬偅鑰呮暟鎹殑鍑洪櫌鏃堕棿,鍦ㄤ笅闈㈡煡璇㈠嚭鐨勫叆闄㈡椂闂翠箣鍓�,閭d箣鍓嶇殑鍑洪櫌鎮h�呯殑鏁版嵁,涔熷緱鍋滄帀,鍥犱负鍙堝叆闄簡)
PatMedInhosp patMedInhosp = new PatMedInhosp();
- //鑾峰彇闇�瑕佸嚭闄㈤儴闂ㄩ殢璁匡紝鏈鐞嗙殑鏁版嵁
patMedInhosp.setDeptcheckFlag("0");
patMedInhosp.setInhospstate("0");
List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
@@ -699,7 +698,7 @@
i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
addServiceSubtaskPreachform(serviceSubtask, null);
}
- } else if (serviceSubtask.getTaskSituation() == 6) {
+ } else if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
//璇存槑璇ユ偅鑰呮槸琚繃婊ょ殑锛屼笉鐢ㄥ啀鎵ц浜�
serviceSubtask.setCreateBy(serviceTask.getCreateBy());
serviceSubtask.setCreateTime(new Date());
@@ -1432,6 +1431,40 @@
}
/**
+ * 缁熶竴鏇存柊pat_med_inhosp鐨刢heck_flag
+ *
+ * @param patMedInhosp 鎮h�呬綇闄㈣褰�
+ * @param type 1=deptcheck_flag, 2=wardcheck_flag, 3=diagcheck_flag, 4=inDeptcheck_flag, 5=inWardcheck_flag
+ * @param flagValue 瑕佽缃殑鍊�
+ * @param remark 澶囨敞淇℃伅
+ */
+ private void updateCheckFlag(PatMedInhosp patMedInhosp, Integer type, String flagValue, String remark) {
+ PatMedInhosp updateObj = new PatMedInhosp();
+ updateObj.setInhospid(patMedInhosp.getInhospid());
+ switch (type) {
+ case 1:
+ updateObj.setDeptcheckFlag(flagValue);
+ break;
+ case 2:
+ updateObj.setWardcheckFlag(flagValue);
+ break;
+ case 3:
+ updateObj.setDiagcheckFlag(flagValue);
+ break;
+ case 4:
+ updateObj.setInDeptcheckFlag(flagValue);
+ break;
+ case 5:
+ updateObj.setInWardcheckFlag(flagValue);
+ break;
+ }
+ if (StringUtils.isNotEmpty(remark)) {
+ updateObj.setRemark(remark + " (type=" + type + ")");
+ }
+ patMedInhospMapper.updatePatMedInhosp(updateObj);
+ }
+
+ /**
* 鍩轰簬瑙勫垯鐨勪换鍔$敓鎴愭柟娉�
* 鏍规嵁鎮h�呯闄㈢瀹ゆ垨鐥呭尯鏌ヨservice_task_rule锛岃幏鍙杁eptRule銆亀radRule銆乨iagRule
* 鏍规嵁瑙勫垯鍊煎喅瀹氳皟鐢ㄥ摢涓柟娉曠敓鎴愰殢璁夸换鍔�
@@ -1474,47 +1507,108 @@
// 鏈夎鍒欙紝鎸夎鍒欐墽琛�
log.info("銆愬熀浜庤鍒欍�戞偅鑰厈}鏌ヨ鍒拌鍒欙細deptRule={}, wradRule={}, diagRule={}", patMedInhosp1.getInhospid(), rule.getDeptRule(), rule.getWradRule(), rule.getDiagRule());
- // 鍒ゆ柇鏄惁鏈夎鍒欎负"1"锛堥鍏堟墽琛岋級
- boolean hasPrimaryRule = "1".equals(rule.getDeptRule()) || "1".equals(rule.getWradRule()) || "1".equals(rule.getDiagRule());
+ boolean deptIsPrimary = "1".equals(rule.getDeptRule());
+ boolean wardIsPrimary = "1".equals(rule.getWradRule());
+ boolean diagIsPrimary = "1".equals(rule.getDiagRule());
+ boolean deptIsSecondary = "2".equals(rule.getDeptRule());
+ boolean wardIsSecondary = "2".equals(rule.getWradRule());
+ boolean diagIsSecondary = "2".equals(rule.getDiagRule());
+
+ boolean hasPrimaryRule = deptIsPrimary || wardIsPrimary || diagIsPrimary;
if (hasPrimaryRule) {
- // 鏈夐瑕佽鍒欙紝鍙墽琛岄瑕佽鍒欏搴旂殑鏂规硶
- int generatedCount = 0;
+ // 绗竴姝ワ細鎵ц鎵�鏈夎鍒�=1鐨勬柟娉曪紝姣忎釜鐙珛璁板綍鎴愬姛/澶辫触
+ int deptGenCount = 0;
+ int wardGenCount = 0;
+ int diagGenCount = 0;
- // 鎸夐『搴忥細绉戝 -> 鐥呭尯 -> 鐤剧梾
- if ("1".equals(rule.getDeptRule())) {
+ if (deptIsPrimary) {
log.info("銆愬熀浜庤鍒欍�戞墽琛岀瀹ら瑕佽鍒�");
- generatedCount += addDeptSubTaskForPatient(patMedInhosp1, patArchive, config);
+ deptGenCount = addDeptSubTaskForPatient(patMedInhosp1, patArchive, config);
}
if (!active.equals("xh")) {
- if ("1".equals(rule.getWradRule())) {
+ if (wardIsPrimary) {
log.info("銆愬熀浜庤鍒欍�戞墽琛岀梾鍖洪瑕佽鍒�");
- generatedCount += addWardSubTaskForPatient(patMedInhosp1, patArchive, config);
+ wardGenCount = addWardSubTaskForPatient(patMedInhosp1, patArchive, config);
}
- if ("1".equals(rule.getDiagRule())) {
+ if (diagIsPrimary) {
log.info("銆愬熀浜庤鍒欍�戞墽琛岀柧鐥呴瑕佽鍒�");
- generatedCount += addIcd10SubTaskForPatient(patMedInhosp1, patArchive, config);
+ diagGenCount = addIcd10SubTaskForPatient(patMedInhosp1, patArchive, config);
}
}
- // 濡傛灉棣栬瑙勫垯鐢熸垚鐨勫瓙浠诲姟涓虹┖锛屽垯璋冪敤鍏朵粬娆¤瑙勫垯鐨勬柟娉�
- if (generatedCount == 0) {
- log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欐湭鐢熸垚瀛愪换鍔★紝寮�濮嬫墽琛屾瑕佽鍒�");
+ int primaryGeneratedCount = deptGenCount + wardGenCount + diagGenCount;
+ log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欐墽琛岀粨鏋�: deptGen={}, wardGen={}, diagGen={}, total={}", deptGenCount, wardGenCount, diagGenCount, primaryGeneratedCount);
- if (!"1".equals(rule.getDeptRule()) && StringUtils.isNotEmpty(rule.getDeptRule())) {
+ // 绗簩姝ワ細鍒ゆ柇棣栬瑙勫垯鏄惁鏈変换鎰忎竴涓敓鎴愭垚鍔�
+ if (primaryGeneratedCount > 0) {
+ // 鑷冲皯鏈変竴涓瑕佽鍒欑敓鎴愭垚鍔�
+ // 鈥斺�� 灏�=2鐨勬瑕佽鍒欏搴攆lag璁句负"2"锛堣烦杩囷級
+ log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欐湁鎴愬姛(count={})锛屽皢娆¤瑙勫垯瀵瑰簲flag璁句负2", primaryGeneratedCount);
+ if (deptIsSecondary) {
+ updateCheckFlag(patMedInhosp1, 1, "2", "棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃");
+ }
+ if (!active.equals("xh")) {
+ if (wardIsSecondary) {
+ updateCheckFlag(patMedInhosp1, 2, "2", "棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃");
+ }
+ if (diagIsSecondary) {
+ updateCheckFlag(patMedInhosp1, 3, "2", "棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃");
+ }
+ }
+ // 鈥斺�� 瀵逛簬=1涓旂敓鎴愭垚鍔熺殑锛屽皢鍏跺搴攆lag璁句负"1"
+ if (deptIsPrimary && deptGenCount > 0) {
+ updateCheckFlag(patMedInhosp1, 1, "1", "绉戝棣栬瑙勫垯鐢熸垚鎴愬姛");
+ }
+ if (!active.equals("xh")) {
+ if (wardIsPrimary && wardGenCount > 0) {
+ updateCheckFlag(patMedInhosp1, 2, "1", "鐥呭尯棣栬瑙勫垯鐢熸垚鎴愬姛");
+ }
+ if (diagIsPrimary && diagGenCount > 0) {
+ updateCheckFlag(patMedInhosp1, 3, "1", "鐤剧梾棣栬瑙勫垯鐢熸垚鎴愬姛");
+ }
+ }
+ // 鈥斺�� 瀵逛簬=1浣嗙敓鎴愬け璐ョ殑锛屽皢鍏跺搴攆lag璁句负"2"
+ if (deptIsPrimary && deptGenCount == 0) {
+ updateCheckFlag(patMedInhosp1, 1, "2", "绉戝棣栬瑙勫垯鐢熸垚澶辫触");
+ }
+ if (!active.equals("xh")) {
+ if (wardIsPrimary && wardGenCount == 0) {
+ updateCheckFlag(patMedInhosp1, 2, "2", "鐥呭尯棣栬瑙勫垯鐢熸垚澶辫触");
+ }
+ if (diagIsPrimary && diagGenCount == 0) {
+ updateCheckFlag(patMedInhosp1, 3, "2", "鐤剧梾棣栬瑙勫垯鐢熸垚澶辫触");
+ }
+ }
+ } else {
+ // 鎵�鏈夐瑕佽鍒欏叏閮ㄥけ璐ワ紝灏�=1鐨刦lag璁句负"2"锛岀劧鍚庢墽琛�=2鐨勬柟娉�
+ log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欏叏閮ㄥけ璐ワ紝灏�=1鐨刦lag璁句负2锛屽紑濮嬫墽琛屾瑕佽鍒�");
+ if (deptIsPrimary) {
+ updateCheckFlag(patMedInhosp1, 1, "2", "绉戝棣栬瑙勫垯鍏ㄩ儴澶辫触");
+ }
+ if (!active.equals("xh")) {
+ if (wardIsPrimary) {
+ updateCheckFlag(patMedInhosp1, 2, "2", "鐥呭尯棣栬瑙勫垯鍏ㄩ儴澶辫触");
+ }
+ if (diagIsPrimary) {
+ updateCheckFlag(patMedInhosp1, 3, "2", "鐤剧梾棣栬瑙勫垯鍏ㄩ儴澶辫触");
+ }
+ }
+ // 鎵ц娆¤瑙勫垯(=2)鐨勬柟娉�
+ if (deptIsSecondary) {
log.info("銆愬熀浜庤鍒欍�戞墽琛岀瀹ゆ瑕佽鍒�");
addDeptSubTaskForPatient(patMedInhosp1, patArchive, config);
}
if (!active.equals("xh")) {
- if (!"1".equals(rule.getWradRule()) && StringUtils.isNotEmpty(rule.getWradRule())) {
+ if (wardIsSecondary) {
log.info("銆愬熀浜庤鍒欍�戞墽琛岀梾鍖烘瑕佽鍒�");
addWardSubTaskForPatient(patMedInhosp1, patArchive, config);
}
- if (!"1".equals(rule.getDiagRule()) && StringUtils.isNotEmpty(rule.getDiagRule())) {
+ if (diagIsSecondary) {
log.info("銆愬熀浜庤鍒欍�戞墽琛岀柧鐥呮瑕佽鍒�");
addIcd10SubTaskForPatient(patMedInhosp1, patArchive, config);
}
@@ -1560,6 +1654,8 @@
if (CollectionUtils.isEmpty(serviceTaskdepts)) {
PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
patMedInhosp1.setDeptcheckFlag("2");
+ patMedInhosp1.setWardcheckFlag(patMedInhosp.getWardcheckFlag());
+ patMedInhosp1.setDiagcheckFlag(patMedInhosp.getDiagcheckFlag());
patMedInhosp1.setLongTaskReason(patMedInhosp.getLongTaskReason() + "璇ユ偅鑰呮墍鍦ㄧ瀹ゆ湭閰嶇疆绂婚櫌闀挎湡浠诲姟;");
patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
} else {
@@ -1606,6 +1702,8 @@
if (StringUtils.isNotEmpty(errorreason)) {
PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
patMedInhosp1.setWardcheckFlag("2");
+ patMedInhosp1.setDeptcheckFlag(patMedInhosp.getDeptcheckFlag());
+ patMedInhosp1.setDiagcheckFlag(patMedInhosp.getDiagcheckFlag());
patMedInhosp1.setLongTaskReason(StringUtils.isNotEmpty(patMedInhosp.getLongTaskReason()) ? patMedInhosp.getLongTaskReason() + errorreason : errorreason);
patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
} else {
@@ -1656,9 +1754,9 @@
if (CollectionUtils.isEmpty(serviceTaskdiags)) {
PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
- patMedInhosp1.setDiagcheckFlag("2");
- patMedInhosp1.setLongTaskReason("璇ユ偅鑰呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟;");
- patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ patMedInhosp.setDiagcheckFlag("2");
+ patMedInhosp.setLongTaskReason("璇ユ偅鑰呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟;");
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
} else {
int flag = 0;
for (ServiceTaskdiag serviceTaskdiag1 : serviceTaskdiags) {
@@ -1675,9 +1773,9 @@
if (flag == 0) {
log.error("璇ョ瀹ゆ垨鐥呭尯瀵逛簬鎮h�呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟,鎮h�咃細{}", patMedInhosp1.getInhospid());
PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
- patMedInhosp1.setDiagcheckFlag("2");
- patMedInhosp1.setLongTaskReason("璇ョ瀹ゆ垨鐥呭尯瀵逛簬鎮h�呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟;");
- patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ patMedInhosp.setDiagcheckFlag("2");
+ patMedInhosp.setLongTaskReason("璇ョ瀹ゆ垨鐥呭尯瀵逛簬鎮h�呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟;");
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
}
}
} catch (Exception e) {
--
Gitblit v1.9.3