From 6a53d35b5d56e2f6bc64bbfe41579f6f32039c90 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 24 三月 2026 15:24:33 +0800
Subject: [PATCH] 【丽水】随访增加 人工随访超时状态
---
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java | 108 ++++++++++++-----------------------------------------
1 files changed, 25 insertions(+), 83 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
index ef267bf..66c5a2e 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -8,10 +8,12 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.*;
import com.smartor.domain.entity.ServiceSubtaskEntity;
import com.smartor.mapper.*;
+import com.smartor.service.IPatMedOuthospService;
import com.smartor.service.IServiceExternalService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -64,6 +66,8 @@
private PatMedInspectionItemMapper patMedInspectionItemMapper;
@Autowired
private Icd10Mapper icd10Mapper;
+ @Autowired
+ private IPatMedOuthospService patMedOuthospService;
@Autowired
private PatMedOuthospMapper patMedOuthospMapper;
@Autowired
@@ -223,13 +227,13 @@
if (CollectionUtils.isNotEmpty(sysDepts)) {
sysDept = sysDepts.get(0);
}
- if(ObjectUtils.isEmpty(sysUser)){
+ if (ObjectUtils.isEmpty(sysUser)) {
log.error("ServiceExternalServiceImpl---addUserDeptInfo 鎵句笉鍒板搴旂殑鐢ㄦ埛 username: {}", externalUserDeptInfo.getYongHuDLM());
return false;
- }else if(ObjectUtils.isEmpty(sysDept)){
+ } else if (ObjectUtils.isEmpty(sysDept)) {
log.error("ServiceExternalServiceImpl---addUserDeptInfo 鎵句笉鍒板搴旂殑绉戝 hisDeptId: {}", externalUserDeptInfo.getKeShiID());
return false;
- }else {
+ } else {
SysUserDept sysUserDept = new SysUserDept();
sysUserDept.setDelFlag(0L);
sysUserDept.setUserId(sysUser.getUserId());
@@ -271,19 +275,18 @@
log.info("ServiceExternalServiceImpl---addUserDeptInfo鏄惁淇敼鎴愬姛03锛歿}", i);
}
//鏇存柊sys-user deptId
- if(StringUtils.isNotEmpty(externalUserDeptInfo.getKeShiID())){
+ if (StringUtils.isNotEmpty(externalUserDeptInfo.getKeShiID())) {
sysUser.setDeptId(Long.valueOf(externalUserDeptInfo.getKeShiID()));
//鏌ヨ鐢ㄦ埛绉戝鍏崇郴
SysUserDept sysUserDeptTemp = new SysUserDept();
sysUserDeptTemp.setUserId(sysUser.getUserId());
sysUserDeptTemp.setOrgid(externalUserDeptInfo.getZuZhiJGID());
List<SysUserDept> sysUserDepts = sysUserDeptMapper.selectSysUserDeptList(sysUserDeptTemp);
- List<String> userDepts = sysUserDepts.stream().map(SysUserDept::getDeptCode).
- distinct().collect(Collectors.toList());
+ List<String> userDepts = sysUserDepts.stream().map(SysUserDept::getDeptCode).distinct().collect(Collectors.toList());
//鍜宷ueryHospUserInfoList閲囬泦鐨勬暟鎹牸寮忎繚鎸佷竴鑷�
List<List<String>> userDeptsList = new ArrayList<>();
- if(!userDepts.isEmpty()){
- for(String userDept: userDepts){
+ if (!userDepts.isEmpty()) {
+ for (String userDept : userDepts) {
List<String> uDept = new ArrayList<>();
uDept.add(userDept);
userDeptsList.add(uDept);
@@ -579,7 +582,7 @@
// 4-闈炲尰鍢辩闄� 5-姝讳骸 9-鍏朵粬 10-浠嬪叆瀹� 20-鎵嬫湳瀹�
String liYuanQxdm = ObjectUtils.isNotEmpty(JiuZhenXX.get("LiYuanQXDM")) ? JiuZhenXX.get("LiYuanQXDM").toString() : null;
//鍒ゆ柇鐥呬汉鏄惁姝讳骸
- if(ObjectUtils.isNotEmpty(liYuanQxdm) &&("5").equals(liYuanQxdm)){
+ if (ObjectUtils.isNotEmpty(liYuanQxdm) && ("5").equals(liYuanQxdm)) {
deathFlag = true;
}
}
@@ -625,7 +628,7 @@
}
patMedInhosp1.setInhospstate("1");
- if(deathFlag){
+ if (deathFlag) {
//鐥呬汉姝讳骸鏃犻』闅忚
patMedInhosp1.setFuflag("1");
//鏇存柊鐥呬汉 notrequiredFlag
@@ -1032,6 +1035,7 @@
* 绗竴鏉★紙鎬ヨ瘖绉戝鐨勶級璁板綍缂哄皯鈥滃嚭闄㈡椂闂粹�濓紝瀵艰嚧璇ヨ褰曞湪缁熻涓缁堟樉绀轰负鈥滃湪闄⑩�濓紝
* 鑰岀浜屾潯锛堣浆鍏ョ瀹ょ殑锛夎褰曟槸瀹屾暣鐨勩�傛垜浠渶瑕侀噰闆� JZ_ZY_LiQiang鎺ュ彛鐨勬暟鎹紝
* 閲岄潰鐨勭鎶㈡椂闂存潵鍙嶅~绗竴鏉¤褰曠殑鈥滃嚭闄㈡椂闂粹�濓紝浠庤�屼慨姝g涓�鏉¤褰曠殑鐘舵�併��
+ *
* @param dataMap
* @return
*/
@@ -1051,7 +1055,7 @@
List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
PatMedInhosp patMedInhosp1 = null;
if (CollectionUtils.isNotEmpty(patMedInhospList)) patMedInhosp1 = patMedInhospList.get(0);
- if(ObjectUtils.isNotEmpty(patMedInhosp1)){
+ if (ObjectUtils.isNotEmpty(patMedInhosp1)) {
if (ObjectUtils.isNotEmpty(JiuZhenXX.get("LiQiangSJ"))) {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -1066,16 +1070,15 @@
}
}
return true;
- }else {
+ } else {
log.error("ServiceExternalServiceImpl---editRescueFinishedOutHospInfo鐨勬病鏈夋壘鍒板搴旂殑鍑洪櫌璁板綍锛歿}", dataMap);
return false;
}
}
+
@Override
public Boolean addFinshJZInfo(Map dataMap) {
log.info("ServiceExternalServiceImpl---addFinshJZInfo鐨勬柊澧炵殑鍊间负锛歿}", dataMap);
- //鍏堝琛ㄨ繘琛岀淮鎶�
- tableMaintenance();
Map yeWuXX = (Map) dataMap.get("YeWuXX");
Map XiaoXiTou = (Map) dataMap.get("XiaoXiTou");
@@ -1114,10 +1117,10 @@
PatArchive patArchive = addPatArchive(externalInHospPatientInfo, null, null);
- PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
- patMedOuthosp.setOuthospno(externalInHospPatientInfo.getBingAnHao());
- patMedOuthosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
- List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp);
+ PatMedOuthospQueryReq patMedOuthospreq = new PatMedOuthospQueryReq();
+ patMedOuthospreq.setOuthospno(externalInHospPatientInfo.getBingAnHao());
+ patMedOuthospreq.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
+ List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.callSpQueryOuthosp(patMedOuthospreq);
for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) {
PatArchive pa = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid());
if (patArchive.getBirthdate() != null) {
@@ -1133,6 +1136,7 @@
}
}
+ PatMedOuthosp patMedOuthosp = DtoConversionUtils.sourceToTarget(patMedOuthospreq, PatMedOuthosp.class);
patMedOuthosp.setPatid(patArchive.getId());
patMedOuthosp.setPatno(externalInHospPatientInfo.getBingAnHao());
patMedOuthosp.setPatname(externalInHospPatientInfo.getXingMing());
@@ -1175,7 +1179,7 @@
//涓嶉渶瑕侀暱鏈熶换鍔¢殢璁匡紝鐢卞尰鐢熻嚜宸卞幓闅忚锛堜附姘翠腑鍖婚櫌棣栨鎻愬嚭锛�
patMedOuthosp.setFuflag("1");
}
- i = patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp);
+ i = patMedOuthospService.updatePatMedOuthosp(patMedOuthosp);
} else {
patMedOuthosp.setCreateTime(new Date());
patMedOuthosp.setUpdateTime(new Date());
@@ -1183,76 +1187,14 @@
//涓嶉渶瑕侀暱鏈熶换鍔¢殢璁�
patMedOuthosp.setFuflag("1");
}
- i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
- }
+ i = patMedOuthospService.insertPatMedOuthosp(patMedOuthosp);
-// //鍏堥�氳繃韬唤璇佸拰绉戝鏌ヨ璇ユ偅鑰呮槸鍚︽湁闇�瑕侀殢璁跨殑(鏅畞鎻愬嚭鏉ョ殑)
-// if (patMedOuthosp.getOrgid().equals("47255004333112711A1001") && StringUtils.isNotEmpty(patMedOuthosp.getIdcardno()) && StringUtils.isNotEmpty(patMedOuthosp.getDeptcode())) {
-// ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
-// serviceSubtaskVO.setSfzh(patMedOuthosp.getIdcardno());
-// serviceSubtaskVO.setDeptcode(patMedOuthosp.getDeptcode());
-// serviceSubtaskVO.setSendstate(2L);
-// List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
-// if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
-// for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
-// serviceSubtask.setSendstate(6L);
-// serviceSubtask.setRemark("鎮h�呭凡缁忓洖鏉ュ璇�");
-// serviceSubtask.setUpdateTime(new Date());
-// serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
-// }
-// }
-// }
+ }
if (i > 0) {
return true;
}
return false;
- }
-
-
- public void tableMaintenance() {
- // 1. 鍒ゆ柇琛ㄦ暟鎹噺
- int count = patMedOuthospMapper.countPatMedOuthosp();
- if (count > 3000000) {
- // 2. 鍐疯棌琛ㄥ苟鏂板缓
- String timeSuffix = new SimpleDateFormat("yyyyMM").format(new Date());
- String oldName = "pat_med_outhosp";
- String newName = oldName + "_" + timeSuffix;
-
- // 鍐疯棌
- patMedOuthospMapper.renameTable(oldName, newName);
-
- // 3. 璁$畻鎵�鏈夎〃鐨勬渶澶d
- List<String> tableNames = patMedOuthospMapper.getAllOuthospTableNames();
- long maxId = 0;
- for (String tableName : tableNames) {
- Long tableMaxId = patMedOuthospMapper.getMaxIdFromTable(tableName);
- if (tableMaxId != null && tableMaxId > maxId) {
- maxId = tableMaxId;
- }
- }
-
- // 4. 鏂板缓(姝ゆ椂鍙墿鍐疯〃锛孭atMedOuthosp娌′簡锛岄渶瑕佹柊寤轰竴涓�)
- patMedOuthospMapper.createPatMedOuthosp(newName, oldName);
-
- //5.璁剧疆鏂拌〃鑷涓婚敭
- patMedOuthospMapper.createPatMedOuthospAutoAdd(oldName);
- //6. 璁剧疆鏂拌〃鑷璧峰鍊�
- patMedOuthospMapper.setAutoIncrement(oldName, maxId + 1);
-
- // 7. 鏇存柊/鏂板缓瑙嗗浘
- // 閲嶆柊鑾峰彇鎵�鏈夎〃鍚嶏紙鍖呭惈鍒氭柊寤虹殑涓昏〃锛�
- List<String> allTables = patMedOuthospMapper.getAllOuthospTableNames();
- StringBuilder sb = new StringBuilder();
- sb.append("CREATE OR REPLACE VIEW v_pat_med_outhosp AS ");
- for (int i = 0; i < allTables.size(); i++) {
- sb.append("SELECT * FROM ").append(allTables.get(i));
- if (i < allTables.size() - 1) {
- sb.append(" UNION ALL ");
- }
- }
- patMedOuthospMapper.createOrReplaceView(sb.toString());
- }
}
@Override
--
Gitblit v1.9.3