From 4bb2588c5579d43ae5d343c7343a425a80b02d6c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 27 六月 2025 12:12:42 +0800
Subject: [PATCH] 代码提交
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | 104 ++++++------
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 306 ++++++++++++++++++++++++++++----------
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java | 1
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 38 ++--
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 4
5 files changed, 298 insertions(+), 155 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java
index efd0e22..63c17b2 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java
@@ -17,7 +17,6 @@
@ApiModel(value = "SysDept", description = "閮ㄩ棬琛�")
public class SysDept extends BaseEntity {
private static final long serialVersionUID = 1L;
-
/**
* 閮ㄩ棬ID
*/
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
index 74436c8..8989707 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -750,9 +750,9 @@
*/
private List<ThiedInhospInfo> parseResponseData(String result) {
try {
- Gson gson = new Gson();
- JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
- JsonArray resultArray = jsonObject.getAsJsonObject("data").getAsJsonArray("result");
+ Gson gson = new Gson();
+ JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
+ JsonArray resultArray = jsonObject.getAsJsonObject("data").getAsJsonArray("result");
Type resultType = new TypeToken<List<ThiedInhospInfo>>() {}.getType();
return gson.fromJson(resultArray, resultType);
} catch (Exception e) {
@@ -776,7 +776,7 @@
parentDir.mkdirs();
}
- if (!file.exists()) {
+ if (!file.exists()) {
file.createNewFile();
}
@@ -855,7 +855,7 @@
if (CollectionUtils.isEmpty(existingArchives)) {
patArchiveService.insertPatArchive(patArchive);
log.debug("銆恜rocessPatientArchive銆戞柊澧炴偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno());
- } else {
+ } else {
patArchive.setId(existingArchives.get(0).getId());
patArchiveService.updateArchive(patArchive);
log.debug("銆恜rocessPatientArchive銆戞洿鏂版偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno());
@@ -871,18 +871,18 @@
PatArchive patArchive = new PatArchive();
// 鍩烘湰淇℃伅
- patArchive.setPatientno(thiedInhospInfo.getPatiMediaNo());
+ patArchive.setPatientno(thiedInhospInfo.getPatiMediaNo());
patArchive.setIdcardno(thiedInhospInfo.getPatiIdCardNo().trim());
patArchive.setName(thiedInhospInfo.getPatiRecordName());
- patArchive.setSourcefrom(2);
- patArchive.setPattype("2");
+ patArchive.setSourcefrom(2);
+ patArchive.setPattype("2");
// 鎬у埆
patArchive.setSex("鐢�".equals(thiedInhospInfo.getPatiRecordGender()) ? 1L : 2L);
// 姘戞棌鍜岀睄璐�
- patArchive.setNation(thiedInhospInfo.getPatiNation());
- patArchive.setNativePlace(thiedInhospInfo.getPatiNationality());
+ patArchive.setNation(thiedInhospInfo.getPatiNation());
+ patArchive.setNativePlace(thiedInhospInfo.getPatiNationality());
// 灞呬綇鍦板潃
String homeAddr = thiedInhospInfo.getPatiHomeAddr();
@@ -891,21 +891,21 @@
// 鍑虹敓鏃ユ湡
if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiBirthday())) {
try {
- patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd").parse(thiedInhospInfo.getPatiBirthday()));
- } catch (ParseException e) {
+ patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd").parse(thiedInhospInfo.getPatiBirthday()));
+ } catch (ParseException e) {
log.warn("銆恇uildPatientArchive銆戣В鏋愬嚭鐢熸棩鏈熷け璐ワ細{}", thiedInhospInfo.getPatiBirthday(), e);
- }
+ }
}
// 骞撮緞
- if (thiedInhospInfo.getTreateAge() != null) {
- patArchive.setAge(Long.valueOf(thiedInhospInfo.getTreateAge()));
- }
- patArchive.setAgeUnit(thiedInhospInfo.getTreatAgeunit());
+ if (thiedInhospInfo.getTreateAge() != null) {
+ patArchive.setAge(Long.valueOf(thiedInhospInfo.getTreateAge()));
+ }
+ patArchive.setAgeUnit(thiedInhospInfo.getTreatAgeunit());
// 鑱旂郴鏂瑰紡
- patArchive.setTelcode(thiedInhospInfo.getCompanyTelNum());
- patArchive.setRelativetelcode(thiedInhospInfo.getContactPersonPhone());
+ patArchive.setTelcode(thiedInhospInfo.getCompanyTelNum());
+ patArchive.setRelativetelcode(thiedInhospInfo.getContactPersonPhone());
// 鍑洪櫌鏂瑰紡澶勭悊锛堟浜$瓑鐗规畩鎯呭喌锛�
if (StringUtils.isNotEmpty(thiedInhospInfo.getOutWayId()) && "4".equals(thiedInhospInfo.getOutWayId())) {
@@ -918,9 +918,9 @@
}
// 绯荤粺瀛楁
- patArchive.setDelFlag("0");
- patArchive.setCreateTime(new Date());
- patArchive.setUpdateTime(new Date());
+ patArchive.setDelFlag("0");
+ patArchive.setCreateTime(new Date());
+ patArchive.setUpdateTime(new Date());
return patArchive;
}
@@ -944,7 +944,7 @@
patMedInhospService.updatePatMedInhosp(patMedInhosp);
log.debug("銆恜rocessPatientInhospInfo銆戞洿鏂颁綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}",
patArchive.getPatientno(), patMedInhosp.getSerialnum());
- } else {
+ } else {
patMedInhospService.insertPatMedInhosp(patMedInhosp);
log.debug("銆恜rocessPatientInhospInfo銆戞柊澧炰綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}",
patArchive.getPatientno(), patMedInhosp.getSerialnum());
@@ -955,74 +955,74 @@
* 鏋勫缓鎮h�呬綇闄俊鎭�
*/
private PatMedInhosp buildPatientInhospInfo(ThiedInhospInfo thiedInhospInfo, PatArchive patArchive, String cry) {
- PatMedInhosp patMedInhosp = new PatMedInhosp();
+ PatMedInhosp patMedInhosp = new PatMedInhosp();
// 鎮h�呭熀鏈俊鎭�
- patMedInhosp.setPatid(patArchive.getId());
- patMedInhosp.setPatno(patArchive.getPatientno());
- patMedInhosp.setPatname(patArchive.getName());
+ patMedInhosp.setPatid(patArchive.getId());
+ patMedInhosp.setPatno(patArchive.getPatientno());
+ patMedInhosp.setPatname(patArchive.getName());
// 鎶ょ悊淇℃伅
- patMedInhosp.setNurseId(thiedInhospInfo.getNurseId());
- patMedInhosp.setNurseName(thiedInhospInfo.getNurseName());
+ patMedInhosp.setNurseId(thiedInhospInfo.getNurseId());
+ patMedInhosp.setNurseName(thiedInhospInfo.getNurseName());
// 浣忛櫌淇℃伅
- patMedInhosp.setSerialnum(thiedInhospInfo.getInpatientId());
- patMedInhosp.setFuflag("1");
+ patMedInhosp.setSerialnum(thiedInhospInfo.getInpatientId());
+ patMedInhosp.setFuflag("1");
patMedInhosp.setInhospstate("0".equals(cry) ? "0" : "1");
// 鍖婚櫌鍜岀瀹や俊鎭�
- patMedInhosp.setHospitalcode(thiedInhospInfo.getAreaId());
+ patMedInhosp.setHospitalcode(thiedInhospInfo.getAreaId());
patMedInhosp.setDeptcode(thiedInhospInfo.getAdmissDeptId());
patMedInhosp.setDeptid(thiedInhospInfo.getAdmissDeptId());
patMedInhosp.setDeptname(thiedInhospInfo.getAdmissDeptName());
patMedInhosp.setBedNo(thiedInhospInfo.getAdmissBedNo());
// 璇婃柇淇℃伅
- patMedInhosp.setIcd10code(thiedInhospInfo.getDiagIcd10());
- patMedInhosp.setDiagname(thiedInhospInfo.getDiagName());
+ patMedInhosp.setIcd10code(thiedInhospInfo.getDiagIcd10());
+ patMedInhosp.setDiagname(thiedInhospInfo.getDiagName());
// 鏃堕棿淇℃伅
if (StringUtils.isNotEmpty(thiedInhospInfo.getAdmissDate())) {
- try {
- patMedInhosp.setStarttime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getAdmissDate()));
- } catch (ParseException e) {
+ try {
+ patMedInhosp.setStarttime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getAdmissDate()));
+ } catch (ParseException e) {
log.warn("銆恇uildPatientInhospInfo銆戣В鏋愬叆闄㈡椂闂村け璐ワ細{}", thiedInhospInfo.getAdmissDate(), e);
- }
+ }
}
if (StringUtils.isNotEmpty(thiedInhospInfo.getOutDate())) {
- try {
- patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getOutDate()));
- } catch (ParseException e) {
+ try {
+ patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getOutDate()));
+ } catch (ParseException e) {
log.warn("銆恇uildPatientInhospInfo銆戣В鏋愬嚭闄㈡椂闂村け璐ワ細{}", thiedInhospInfo.getOutDate(), e);
}
}
// 鍑洪櫌淇℃伅
- patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptId());
- patMedInhosp.setLeaveldeptname(thiedInhospInfo.getCurrDeptName());
- patMedInhosp.setLeavediagname(thiedInhospInfo.getDiagName());
- patMedInhosp.setLeaveicd10code(thiedInhospInfo.getDiagIcd10());
- patMedInhosp.setOutWayId(thiedInhospInfo.getOutWayId());
- patMedInhosp.setOutWayName(thiedInhospInfo.getOutWayName());
+ patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptId());
+ patMedInhosp.setLeaveldeptname(thiedInhospInfo.getCurrDeptName());
+ patMedInhosp.setLeavediagname(thiedInhospInfo.getDiagName());
+ patMedInhosp.setLeaveicd10code(thiedInhospInfo.getDiagIcd10());
+ patMedInhosp.setOutWayId(thiedInhospInfo.getOutWayId());
+ patMedInhosp.setOutWayName(thiedInhospInfo.getOutWayName());
// 鍖荤敓淇℃伅
patMedInhosp.setDrname(thiedInhospInfo.getDoctName());
patMedInhosp.setDrcode(thiedInhospInfo.getDoctId());
// 鐥呭尯淇℃伅
- patMedInhosp.setLeavehospitaldistrictid(thiedInhospInfo.getCurrWardCode());
- patMedInhosp.setLeavehospitaldistrictcode(thiedInhospInfo.getCurrWardId());
- patMedInhosp.setLeavehospitaldistrictname(thiedInhospInfo.getCurrWardName());
- patMedInhosp.setLeaveldeptid(thiedInhospInfo.getCurrDeptCode());
+ patMedInhosp.setLeavehospitaldistrictid(thiedInhospInfo.getCurrWardCode());
+ patMedInhosp.setLeavehospitaldistrictcode(thiedInhospInfo.getCurrWardId());
+ patMedInhosp.setLeavehospitaldistrictname(thiedInhospInfo.getCurrWardName());
+ patMedInhosp.setLeaveldeptid(thiedInhospInfo.getCurrDeptCode());
// 鐘舵�佷俊鎭�
patMedInhosp.setSchemestatus("0".equals(cry) ? 1L : 2L);
// 绯荤粺瀛楁
patMedInhosp.setDelFlag("0");
- patMedInhosp.setOrgid("1");
+ patMedInhosp.setOrgid("1");
return patMedInhosp;
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 2525558..1d555ae 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.*;
import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
@@ -13,6 +14,7 @@
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
+import com.smartor.domain.SvyTaskVO;
import com.smartor.mapper.SysUserDeptMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -164,96 +166,238 @@
@Override
public SysUser selectUserByUserName2(String userName) {
- String[] split = userName.split("&");
- SysUser sysUser = userMapper.selectUserByUserNameByCondition(split[0], split[1]);
- if (Objects.isNull(sysUser)) return sysUser;
- List<SysDept> sysDepts = null;
- if (StringUtils.isNotEmpty(split[0]) && split[0].equals("admin")) {
+ log.debug("寮�濮嬫煡璇㈢敤鎴蜂俊鎭紝鐢ㄦ埛鍚�: {}", userName);
+
+ try {
+ // 鍙傛暟鏍¢獙
+ if (StringUtils.isEmpty(userName)) {
+ log.warn("鐢ㄦ埛鍚嶅弬鏁颁负绌�");
+ return null;
+ }
+
+ // 瑙f瀽鐢ㄦ埛鍚嶅拰鏈烘瀯ID
+ String[] userInfo = parseUserName(userName);
+ if (userInfo == null) {
+ log.warn("鐢ㄦ埛鍚嶆牸寮忎笉姝g‘: {}", userName);
+ return null;
+ }
+
+ String username = userInfo[0];
+ String orgId = userInfo[1];
+
+ // 鏌ヨ鐢ㄦ埛鍩烘湰淇℃伅
+ SysUser sysUser = userMapper.selectUserByUserNameByCondition(username, orgId);
+ if (Objects.isNull(sysUser)) {
+ log.warn("鏈壘鍒扮敤鎴蜂俊鎭�: username={}, orgId={}", username, orgId);
+ return null;
+ }
+
+ // 鏌ヨ鐢ㄦ埛閮ㄩ棬淇℃伅
+ List<SysDept> sysDepts = getUserDepts(sysUser, username, orgId);
+ List<Long> deptIds = extractDeptIds(sysDepts);
+ sysUser.setDepts(deptIds);
+
+ // 鏍规嵁鎼滅储鑼冨洿澶勭悊绉戝鍜岀梾鍖轰俊鎭�
+ processUserDeptInfo(sysUser, username, orgId);
+
+ log.debug("鐢ㄦ埛淇℃伅鏌ヨ瀹屾垚: userId={}", sysUser.getUserId());
+ return sysUser;
+
+ } catch (Exception e) {
+ log.error("鏌ヨ鐢ㄦ埛淇℃伅鏃跺彂鐢熷紓甯�: userName={}", userName, e);
+ return null;
+ }
+ }
+
+ /**
+ * 瑙f瀽鐢ㄦ埛鍚嶏紝鎻愬彇鐢ㄦ埛鍚嶅拰鏈烘瀯ID
+ */
+ private String[] parseUserName(String userName) {
+ if (StringUtils.isEmpty(userName) || !userName.contains("&")) {
+ return null;
+ }
+ return userName.split("&");
+ }
+
+ /**
+ * 鑾峰彇鐢ㄦ埛閮ㄩ棬淇℃伅
+ */
+ private List<SysDept> getUserDepts(SysUser sysUser, String username, String orgId) {
+ if ("admin".equals(username)) {
SysDept dept = new SysDept();
- dept.setOrgid(split[1]);
- sysDepts = sysDeptMapper.selectDeptList(dept);
+ dept.setOrgid(orgId);
+ return sysDeptMapper.selectDeptList(dept);
} else {
- sysDepts = sysUserDeptMapper.selectDeptListByUserId(sysUser.getUserId());
+ return sysUserDeptMapper.selectDeptListByUserId(sysUser.getUserId());
}
- List<Long> deptIds = new ArrayList<>();
- for (SysDept sysDept : sysDepts) {
- deptIds.add(sysDept.getDeptId());
+ }
+
+ /**
+ * 鎻愬彇閮ㄩ棬ID鍒楄〃
+ */
+ private List<Long> extractDeptIds(List<SysDept> sysDepts) {
+ if (CollectionUtils.isEmpty(sysDepts)) {
+ return new ArrayList<>();
}
+ return sysDepts.stream()
+ .map(SysDept::getDeptId)
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * 澶勭悊鐢ㄦ埛绉戝鍜岀梾鍖轰俊鎭�
+ */
+ private void processUserDeptInfo(SysUser sysUser, String username, String orgId) {
+ String searchScope = sysUser.getSearchscope();
+ if (StringUtils.isEmpty(searchScope)) {
+ return;
+ }
+
+ switch (searchScope) {
+ case "0": // 鍏ㄩ儴鑼冨洿
+ processFullScopeDeptInfo(sysUser, username, orgId);
+ break;
+ case "1": // 绉戝鑼冨洿
+ processDeptScopeInfo(sysUser, orgId, "1");
+ break;
+ case "2": // 鐥呭尯鑼冨洿
+ processDeptScopeInfo(sysUser, orgId, "2");
+ break;
+ default:
+ log.warn("鏈煡鐨勬悳绱㈣寖鍥�: {}", searchScope);
+ }
+ }
+
+ /**
+ * 澶勭悊鍏ㄩ儴鑼冨洿鐨勯儴闂ㄤ俊鎭�
+ */
+ private void processFullScopeDeptInfo(SysUser sysUser, String username, String orgId) {
+ SysUserDept sysUserDept = createSysUserDept(sysUser, orgId);
+
+ List<SysUserDept> sysUserDeptKSs = null;
+ List<SysUserDept> sysUserDeptBQs = null;
+
+ if ("admin".equals(username)) {
+ // admin鐢ㄦ埛鐗规畩澶勭悊
+ sysUserDept.setUserId(null);
+ sysUserDeptKSs = getAdminDeptList(orgId, "1");
+ sysUserDeptBQs = getAdminDeptList(orgId, "2");
+
+ // 鍘婚噸澶勭悊
+ sysUserDeptKSs = removeDuplicateDepts(sysUserDeptKSs);
+ sysUserDeptBQs = removeDuplicateDepts(sysUserDeptBQs);
+ } else {
+ // 鏅�氱敤鎴峰鐞�
+ sysUserDept.setDeptType("1");
+ sysUserDeptKSs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
+ sysUserDept.setDeptType("2");
+ sysUserDeptBQs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
+ }
+
+ // 璁剧疆绉戝鍜岀梾鍖轰俊鎭�
+ setBelongWards(sysUser, sysUserDeptBQs);
+ setBelongDepts(sysUser, sysUserDeptKSs);
+ }
+
+ /**
+ * 澶勭悊鎸囧畾鑼冨洿鐨勯儴闂ㄤ俊鎭�
+ */
+ private void processDeptScopeInfo(SysUser sysUser, String orgId, String deptType) {
+ SysUserDept sysUserDept = createSysUserDept(sysUser, orgId);
+ sysUserDept.setDeptType(deptType);
+ List<SysUserDept> deptList = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
+
+ if ("1".equals(deptType)) {
+ setBelongDepts(sysUser, deptList);
+ } else if ("2".equals(deptType)) {
+ setBelongWards(sysUser, deptList);
+ }
+ }
+
+ /**
+ * 鍒涘缓SysUserDept瀵硅薄
+ */
+ private SysUserDept createSysUserDept(SysUser sysUser, String orgId) {
SysUserDept sysUserDept = new SysUserDept();
sysUserDept.setUserId(sysUser.getUserId());
sysUserDept.setDeptType(sysUser.getSearchscope());
- sysUserDept.setOrgid(split[1]);
- List<SysUserDept> sysUserDeptKSs = null;
- List<SysUserDept> sysUserDeptBQs = null;
- if (StringUtils.isNotEmpty(sysUser.getSearchscope()) && sysUser.getSearchscope().equals("0")) {
- if (StringUtils.isNotEmpty(split[0]) && split[0].equals("admin")) {
- sysUserDept.setUserId(null);
- }
- sysUserDept.setDeptType("1");
- sysUserDeptKSs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
- sysUserDept.setDeptType("2");
- sysUserDeptBQs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
- //濡傛灉鏄痑dmin锛岄渶瑕佸sysUserDeptBQs锛宻ysUserDeptBQs鍘婚噸
- if (StringUtils.isNotEmpty(split[0]) && split[0].equals("admin")) {
- List<SysUserDept> distinctUserDepts = new ArrayList<>();
- Set<String> uniqueDeptCodes = new HashSet<>();
- for (SysUserDept userDept : sysUserDeptKSs) {
- String deptCode = userDept.getDeptCode();
- if (StringUtils.isNotEmpty(deptCode) && !uniqueDeptCodes.contains(deptCode)) {
- distinctUserDepts.add(userDept);
- uniqueDeptCodes.add(deptCode);
- }
- }
-
- List<SysUserDept> distinctUserBQs = new ArrayList<>();
- Set<String> uniqueBQCodes = new HashSet<>();
- for (SysUserDept userDept : sysUserDeptBQs) {
- String deptCode = userDept.getDeptCode();
- if (StringUtils.isNotEmpty(deptCode) && !uniqueBQCodes.contains(deptCode)) {
- distinctUserBQs.add(userDept);
- uniqueBQCodes.add(deptCode);
- }
- }
- sysUserDeptKSs = distinctUserDepts;
- sysUserDeptBQs = distinctUserBQs;
- }
-
- } else if (StringUtils.isNotEmpty(sysUser.getSearchscope()) && sysUser.getSearchscope().equals("1")) {
- sysUserDept.setDeptType("1");
- sysUserDeptKSs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
- } else if (StringUtils.isNotEmpty(sysUser.getSearchscope()) && sysUser.getSearchscope().equals("2")) {
- sysUserDept.setDeptType("2");
- sysUserDeptBQs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
+ sysUserDept.setOrgid(orgId);
+ return sysUserDept;
+ }
+
+ /**
+ * 鑾峰彇admin鐢ㄦ埛鐨勯儴闂ㄥ垪琛�
+ */
+ private List<SysUserDept> getAdminDeptList(String orgId, String deptType) {
+ SysDept dept = new SysDept();
+ dept.setOrgid(orgId);
+ dept.setDeptType(deptType);
+ List<SysDept> sysDepts = sysDeptMapper.selectDeptList(dept);
+ return DtoConversionUtils.sourceToTarget(sysDepts, SysUserDept.class);
+ }
+
+ /**
+ * 鍘婚櫎閲嶅鐨勯儴闂ㄤ俊鎭�
+ */
+ private List<SysUserDept> removeDuplicateDepts(List<SysUserDept> deptList) {
+ if (CollectionUtils.isEmpty(deptList)) {
+ return new ArrayList<>();
}
-
- sysUser.setDepts(deptIds);
- if (!CollectionUtils.isEmpty(sysUserDeptBQs)) {
- List<Map<String, Object>> list = new ArrayList<>();
- for (SysUserDept sud : sysUserDeptBQs) {
- Map<String, Object> map = new HashMap<>();
- map.put("districtCode", "");
- if (StringUtils.isNotEmpty(sud.getDeptCode())) map.put("districtCode", sud.getDeptCode());
- else continue;
- map.put("districtName", "");
- if (StringUtils.isNotEmpty(sud.getDeptName())) map.put("districtName", sud.getDeptName());
- list.add(map);
+
+ List<SysUserDept> distinctDepts = new ArrayList<>();
+ Set<String> uniqueCodes = new HashSet<>();
+
+ for (SysUserDept dept : deptList) {
+ String deptCode = dept.getDeptCode();
+ if (StringUtils.isNotEmpty(deptCode) && !uniqueCodes.contains(deptCode)) {
+ distinctDepts.add(dept);
+ uniqueCodes.add(deptCode);
}
- sysUser.setBelongWards(list);
}
- if (!CollectionUtils.isEmpty(sysUserDeptKSs)) {
- List<Map<String, Object>> list = new ArrayList<>();
- for (SysUserDept sud : sysUserDeptKSs) {
- Map<String, Object> map = new HashMap<>();
- map.put("deptCode", "");
- if (StringUtils.isNotEmpty(sud.getDeptCode())) map.put("deptCode", sud.getDeptCode());
- else continue;
- map.put("deptName", "");
- if (StringUtils.isNotEmpty(sud.getDeptName())) map.put("deptName", sud.getDeptName());
- list.add(map);
- }
- sysUser.setBelongDepts(list);
+
+ return distinctDepts;
+ }
+
+ /**
+ * 璁剧疆鐥呭尯淇℃伅
+ */
+ private void setBelongWards(SysUser sysUser, List<SysUserDept> sysUserDeptBQs) {
+ if (CollectionUtils.isEmpty(sysUserDeptBQs)) {
+ return;
}
- return sysUser;
+
+ List<Map<String, Object>> wardList = sysUserDeptBQs.stream()
+ .filter(sud -> StringUtils.isNotEmpty(sud.getDeptCode()))
+ .map(sud -> {
+ Map<String, Object> map = new HashMap<>();
+ map.put("districtCode", StringUtils.defaultString(sud.getDeptCode(), ""));
+ map.put("districtName", StringUtils.defaultString(sud.getDeptName(), ""));
+ return map;
+ })
+ .collect(Collectors.toList());
+
+ sysUser.setBelongWards(wardList);
+ }
+
+ /**
+ * 璁剧疆绉戝淇℃伅
+ */
+ private void setBelongDepts(SysUser sysUser, List<SysUserDept> sysUserDeptKSs) {
+ if (CollectionUtils.isEmpty(sysUserDeptKSs)) {
+ return;
+ }
+
+ List<Map<String, Object>> deptList = sysUserDeptKSs.stream()
+ .filter(sud -> StringUtils.isNotEmpty(sud.getDeptCode()))
+ .map(sud -> {
+ Map<String, Object> map = new HashMap<>();
+ map.put("deptCode", StringUtils.defaultString(sud.getDeptCode(), ""));
+ map.put("deptName", StringUtils.defaultString(sud.getDeptName(), ""));
+ return map;
+ })
+ .collect(Collectors.toList());
+
+ sysUser.setBelongDepts(deptList);
}
/**
@@ -465,7 +609,7 @@
if (!CollectionUtils.isEmpty(user.getDeptCodes())) {
for (String deptCode : user.getDeptCodes()) {
SysDept sysDept = sysDeptMapper.selectDeptByCode(deptCode);
- if(ObjectUtils.isEmpty(sysDept)){
+ if (ObjectUtils.isEmpty(sysDept)) {
continue;
}
@@ -491,7 +635,7 @@
if (!CollectionUtils.isEmpty(user.getWardCodes())) {
for (String wardCode : user.getWardCodes()) {
SysDept sysDept = sysDeptMapper.selectDeptByCode(wardCode);
- if(ObjectUtils.isEmpty(sysDept)){
+ if (ObjectUtils.isEmpty(sysDept)) {
continue;
}
SysUserDept sysUserDept = new SysUserDept();
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 3bc8980..52b7116 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -2183,10 +2183,10 @@
List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
//Map<String, List<ServiceSubtask>> collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
Map<String, List<ServiceSubtask>> collect = new HashMap<>();
- if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 1) {
+ if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && serviceSubtaskCountReq.getLeavehospitaldistrictcodes().size() > 0) {
collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
- }else if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 2){
+ } else if (serviceSubtaskCountReq.getDeptcodes() != null && serviceSubtaskCountReq.getDeptcodes().size() > 0) {
collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptname()).orElse("Unknown")));
}
for (List<ServiceSubtask> serviceSubtaskList : collect.values()) {
@@ -2211,7 +2211,7 @@
serviceSubtaskStatistic.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
//鍑洪櫌浜烘
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
- for (ServiceSubtask serviceSubtask : serviceSubtaskList){
+ for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
@@ -2221,67 +2221,67 @@
serviceSubtaskStatistic.setFollowUpNeeded(serviceSubtaskStatistic.getFollowUpNeeded() + 1L);
}
//棣栨鍑洪櫌闅忚
- if(serviceSubtask.getVisitCount() == 1){
+ if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) {
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUp(serviceSubtaskStatistic.getNeedFollowUp() + 1L);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L);
}
- if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)){
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) {
serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L);
}
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
- double rate = (double)(serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
+ double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
serviceSubtaskStatistic.setFollowUpRate(percentFormat.format(rate));
} else {
serviceSubtaskStatistic.setFollowUpRate("0.00%");
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")) {
serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")) {
serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) {
serviceSubtaskStatistic.setAbnormal(serviceSubtaskStatistic.getAbnormal() + 1L);
}
}//浜屾鍑洪櫌闅忚
- else if (serviceSubtask.getVisitCount() > 1){
+ else if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() > 1) {
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUpAgain(serviceSubtaskStatistic.getNeedFollowUpAgain() + 1L);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUpAgain(serviceSubtaskStatistic.getPendingFollowUpAgain() + 1L);
}
- if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)){
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) {
serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
serviceSubtaskStatistic.setFollowUpFailAgain(serviceSubtaskStatistic.getFollowUpFailAgain() + 1L);
}
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
- double rate = (double)(serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
+ double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
serviceSubtaskStatistic.setFollowUpRateAgain(percentFormat.format(rate));
} else {
serviceSubtaskStatistic.setFollowUpRateAgain("0.00%");
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")) {
serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")) {
serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
}
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")){
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) {
serviceSubtaskStatistic.setAbnormalAgain(serviceSubtaskStatistic.getAbnormalAgain() + 1L);
}
}
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 6b379f6..5cba952 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -963,10 +963,10 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND leavehospitaldistrictcode IN
+ AND deptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
- #{leavehospitaldistrictcode}
+ #{deptcode}
</foreach>
</if>
<if test="serviceType != null and serviceType.size() > 0">
--
Gitblit v1.9.3