From 29069b790469cb7136cadba7ddcd63a83bc4ac70 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 23 三月 2026 15:20:20 +0800
Subject: [PATCH] 门急诊分表代码(增、改、查)提交
---
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java | 17
smartor/src/main/java/com/smartor/service/impl/PersonWorkbenchServiceImpl.java | 11
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java | 9
smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java | 129 +-
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java | 108 -
smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java | 68 +
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyTaskSingleController.java | 12
smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java | 177 ++
smartor/src/main/java/com/smartor/mapper/PatArchiveOutMapper.java | 2
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml | 225 +---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 55
smartor/src/main/resources/mapper/smartor/HeLibraryAssortMapper.xml | 23
smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java | 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PersonWorkbenchController.java | 16
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java | 12
smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java | 5
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java | 4
smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml | 113 +-
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CreateDataTable.java | 587 +++++++++++
smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml | 898 ++++++++---------
smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java | 2
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 162 +-
smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java | 5
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml | 240 ++--
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | 21
smartor/src/main/java/com/smartor/service/PersonWorkbenchService.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/component/DeptUtils.java | 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospController.java | 26
29 files changed, 1,761 insertions(+), 1,178 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/DeptUtils.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/DeptUtils.java
index 1bd5f52..7858c6c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/DeptUtils.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/DeptUtils.java
@@ -15,9 +15,9 @@
Map<String, String> map = new HashMap<>();
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
- String detpId = user.getDeptId().toString();
+ String deptcodes = user.getDeptCode().toString();
String userName = user.getUserName();
- map.put("deptId", detpId);
+ map.put("deptcodes", deptcodes);
map.put("userName", userName);
return map;
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospController.java
index eb58c9a..47f3278 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospController.java
@@ -11,6 +11,7 @@
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.PageUtils;
import com.smartor.domain.PatArchiveOthreInfo;
import com.smartor.domain.PatMedReq;
@@ -81,11 +82,6 @@
@ApiOperation("鏌ヨ闂ㄨ瘖鐪嬬梾浜烘鍜屼汉鏁�")
public AjaxResult selectPatMedOuthospCount(@RequestBody PatMedReq patMedReq) {
SysUser user = getLoginUser().getUser();
-// List<String> deptCode = new ArrayList<>();
-// for (Map<String, Object> map : user.getBelongDepts()) {
-// if (ObjectUtils.isNotEmpty(map.get("deptCode"))) deptCode.add(map.get("deptCode").toString());
-// }
-// patMedReq.setDeptcodeList(deptCode);
patMedReq.setOrgid(user.getOrgid());
PatMedRes patMedRes = patMedOuthospService.selectPatMedOuthospCount(patMedReq);
return success(patMedRes);
@@ -110,16 +106,16 @@
util.exportExcel(response, list, "鎮h�呴棬璇婅褰曟暟鎹�");
}
- /**
- * 鑾峰彇鎮h�呴棬璇婅褰曡缁嗕俊鎭�
- */
- @ApiOperation("鑾峰彇鎮h�呴棬璇婅褰曡缁嗕俊鎭�")
- @ApiImplicitParam(name = "getInfo", value = "涓婚敭ID", dataType = "long", dataTypeClass = Long.class)
- //@PreAuthorize("@ss.hasPermi('smartor:patouthosp:query')")
- @GetMapping(value = "getInfo/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(patMedOuthospService.selectPatMedOuthospById(id));
- }
+// /**
+// * 鑾峰彇鎮h�呴棬璇婅褰曡缁嗕俊鎭�
+// */
+// @ApiOperation("鑾峰彇鎮h�呴棬璇婅褰曡缁嗕俊鎭�")
+// @ApiImplicitParam(name = "getInfo", value = "涓婚敭ID", dataType = "long", dataTypeClass = Long.class)
+// //@PreAuthorize("@ss.hasPermi('smartor:patouthosp:query')")
+// @GetMapping(value = "getInfo/{id}")
+// public AjaxResult getInfo(@PathVariable("id") Long id) {
+// return success(patMedOuthospService.selectPatMedOuthospById(id));
+// }
/**
* 鏂板鎮h�呴棬璇婅褰�
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PersonWorkbenchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PersonWorkbenchController.java
index 61584b5..04595fb 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PersonWorkbenchController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PersonWorkbenchController.java
@@ -33,17 +33,17 @@
*/
@ApiOperation("褰撳墠鐧诲綍鐢ㄦ埛鐨勯棬璇娿�佸湪闄€�佸嚭闄㈢梾浜虹殑缁熻鎯呭喌")
@GetMapping("/getPatCount")
- public TableDataInfo getPatCount(@RequestParam("deptIds") String detpIds, @RequestParam("dcCodes") String dcCodes) {
+ public TableDataInfo getPatCount(@RequestParam("deptcodes") String deptcodes, @RequestParam("dcCodes") String dcCodes) {
//鑾峰彇褰撳墠鐧婚檰浜�
Map<String, String> deptAndDocID = DeptUtils.getDeptAndDocID();
- if (StringUtils.isEmpty(detpIds)) {
- detpIds = deptAndDocID.get("deptId");
+ if (StringUtils.isEmpty(deptcodes)) {
+ deptcodes = deptAndDocID.get("deptcodes");
}
if (StringUtils.isEmpty(dcCodes)) {
dcCodes = deptAndDocID.get("userName");
}
- List<PerSonWorkbenchDto> patCount = personWorkbenchService.getPatCount(detpIds, dcCodes);
+ List<PerSonWorkbenchDto> patCount = personWorkbenchService.getPatCount(deptcodes, dcCodes);
return getDataTable(patCount);
}
@@ -53,17 +53,17 @@
@ApiOperation("褰撳墠鐧诲綍鐢ㄦ埛鐨勯棬璇娿�佸湪闄€�佸嚭闄㈢梾浜虹殑缁熻鎯呭喌")
//@PreAuthorize("@ss.hasPermi('system:tag:list')")
@GetMapping("/getTaskInfo")
- public TableDataInfo getTaskInfo(@RequestParam("deptIds") String detpIds, @RequestParam("dcCodes") String dcCodes) {
+ public TableDataInfo getTaskInfo(@RequestParam("deptcode") String deptcode, @RequestParam("dcCodes") String dcCodes) {
//鑾峰彇褰撳墠鐧婚檰浜�
Map<String, String> deptAndDocID = DeptUtils.getDeptAndDocID();
- if (StringUtils.isEmpty(detpIds)) {
- detpIds = deptAndDocID.get("deptId");
+ if (StringUtils.isEmpty(deptcode)) {
+ deptcode = deptAndDocID.get("deptcode");
}
if (StringUtils.isEmpty(dcCodes)) {
dcCodes = deptAndDocID.get("userName");
}
- List<PerSonWorkbenchDto> patCount = personWorkbenchService.getPatCount(detpIds, dcCodes);
+ List<PerSonWorkbenchDto> patCount = personWorkbenchService.getPatCount(deptcode, dcCodes);
return getDataTable(patCount);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
index 4d2a0c8..4bce0af 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
@@ -65,7 +65,7 @@
@ApiOperation("鏌ヨ浠诲姟鍒楄〃")
//@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:list')")
@AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
- @PostMapping("list")
+ @PostMapping("/list")
public TableDataInfo list(@RequestBody ServiceTask serviceTask) {
PageUtils.startPageByPost(serviceTask.getPageNum(), serviceTask.getPageSize());
// List<ServiceTask> list = serviceTaskService.selectServiceTaskList(serviceTask);
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyTaskSingleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyTaskSingleController.java
index fd5a522..fcbc337 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyTaskSingleController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyTaskSingleController.java
@@ -1,24 +1,18 @@
package com.ruoyi.web.controller.smartor;
-import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DtoConversionUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.*;
import com.smartor.service.ISvyTaskSingleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
/**
* 鍗曚竴浠诲姟锛堥棶鍗凤級Controller
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
index 3901ff4..21262d1 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
@@ -9,6 +9,7 @@
import com.ruoyi.quartz.service.ICollectHISService;
import com.smartor.domain.*;
import com.smartor.mapper.*;
+import com.smartor.service.IPatMedOuthospService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
@@ -35,7 +36,7 @@
private SysUser2Mapper sysUser2Mapper;
@Autowired
- private SysUserRole2Mapper sysUserRoleMapper;
+ private IPatMedOuthospService patMedOuthospService;
@Autowired
private SysDept2Mapper sysDept2Mapper;
@@ -291,7 +292,7 @@
patMedOuthosp1.setCampusid(patMedOuthosp1.getOrgid());
patMedOuthosp1.setOrgid("1");
}
- count += patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
+ count += patMedOuthospService.updatePatMedOuthosp(patMedOuthosp1);
} else {
patMedOuthosp1.setCreateTime(new Date());
//甯備竴 闄㈠尯id瀵瑰簲orgid锛屾満鏋刬d涓洪粯璁ょ殑1
@@ -299,7 +300,7 @@
patMedOuthosp1.setCampusid(patMedOuthosp1.getOrgid());
patMedOuthosp1.setOrgid("1");
}
- count += patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp1);
+ count += patMedOuthospService.insertPatMedOuthosp(patMedOuthosp1);
}
} catch (Exception ex) {
log.info("鍚屾鍑哄叆闄�:" + ex.getMessage());
@@ -413,7 +414,7 @@
patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
patMedOuthosp1.setPatid(patArchives.get(0).getId());
}
- i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp1);
+ i = patMedOuthospService.insertPatMedOuthosp(patMedOuthosp1);
}
return i;
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 3a306b4..8577bb7 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
@@ -11,11 +11,11 @@
import com.ruoyi.common.enums.MsgLSEnum;
import com.ruoyi.common.enums.ServiceFromEnum;
import com.ruoyi.common.enums.WxGZHEnum;
-import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.sms.smsUtils;
import com.ruoyi.quartz.service.ICollectHISService;
+import com.ruoyi.quartz.util.CreateDataTable;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import com.smartor.common.LSHospTokenUtil;
@@ -151,6 +151,9 @@
@Autowired
ICollectHISService icollectHis;
+
+ @Autowired
+ CreateDataTable createDataTable;
@Value("${appid}")
@@ -471,6 +474,19 @@
}
/**
+ * 闂ㄨ瘖鍒嗚〃瀹氭椂浠诲姟锛氫粠 sys_config 璇诲彇鍒嗚〃妯″紡锛屾寜妯″紡寤鸿〃骞跺埛鏂拌鍥� v_pat_med_outhosp
+ * 閰嶇疆 key: outhosp.split.mode
+ * quarter -> 鎸夊搴︼紝琛ㄥ悕绀轰緥锛歱at_med_outhosp_20260103
+ * year -> 鎸夊勾锛岃〃鍚嶇ず渚嬶細pat_med_outhosp_2026
+ * month -> 鎸夋湀锛岃〃鍚嶇ず渚嬶細pat_med_outhosp_202601
+ * 鏌ヨ涓嶅埌閰嶇疆鍒欎笉鍒嗚〃
+ */
+ public void createOuthospQuarterTable() {
+ log.info("銆恈reateOuthospQuarterTable銆戝紑濮嬫墽琛岄棬璇婂垎琛ㄤ换鍔�");
+ createDataTable.createOuthospQuarterTable();
+ }
+
+ /**
* 澶勭悊鎮h�呬俊鎭紝杩涘叆瀛愪换鍔¤〃(寰俊灏忕▼搴�)
*/
public void dealOutHospInfoXHC() {
@@ -483,7 +499,7 @@
/**
- * 闀挎湡浠诲姟鍙戦��
+ * 闀挎湡浠诲姟鍙戦��
*/
public void longTaskSend() {
//鑾峰彇浠诲姟淇℃伅
@@ -582,6 +598,7 @@
/**
* 闅忚-琛ュ伩澶勭悊
+ *
* @param serviceSubtask
*/
public void sfHandlle(ServiceSubtask serviceSubtask) {
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CreateDataTable.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CreateDataTable.java
new file mode 100644
index 0000000..d8cab10
--- /dev/null
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CreateDataTable.java
@@ -0,0 +1,587 @@
+package com.ruoyi.quartz.util;
+
+import com.ruoyi.system.service.ISysConfigService;
+import com.smartor.mapper.PatMedOuthospMapper;
+import com.smartor.service.IPatMedOuthospService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.time.LocalDate;
+import java.util.*;
+
+/**
+ * 鍒涘缓鏁版嵁搴撹〃
+ */
+@Slf4j
+@Component
+public class CreateDataTable {
+ @Autowired
+ private ISysConfigService configService;
+
+ @Autowired
+ IPatMedOuthospService iPatMedOuthospService;
+
+ @Autowired
+ PatMedOuthospMapper patMedOuthospMapper;
+
+ @Autowired
+ private DataSource dataSource;
+
+
+ public void createOuthospQuarterTable() {
+ log.info("銆恈reateOuthospQuarterTable銆戝紑濮嬫墽琛岄棬璇婂垎琛ㄤ换鍔�");
+ try {
+ // 浠� sys_config 鏌ヨ鍒嗚〃妯″紡锛� key = outhosp.split.mode
+ String splitMode = configService.selectConfigByKey("outhosp.split.mode");
+ if (org.apache.commons.lang3.StringUtils.isBlank(splitMode)) {
+ log.info("銆恈reateOuthospQuarterTable銆戞湭閰嶇疆 outhosp.split.mode锛屼笉鎵ц鍒嗚〃");
+ return;
+ }
+ splitMode = splitMode.trim();
+ if (!"瀛e害".equals(splitMode) && !"骞�".equals(splitMode) && !"鏈�".equals(splitMode)) {
+ log.warn("銆恈reateOuthospQuarterTable銆戝垎琛ㄦā寮忛厤缃潪娉曪細{}锛屽簲涓� quarter/year/month锛屼笉鎵ц鍒嗚〃", splitMode);
+ return;
+ }
+ String newTable = createPartitionTableAndRefreshView(splitMode);
+ if (newTable == null) {
+ log.info("銆恈reateOuthospQuarterTable銆戝綋鍓嶅懆鏈熻〃宸插瓨鍦紝鏃犻渶鎿嶄綔");
+ } else {
+ log.info("銆恈reateOuthospQuarterTable銆戞柊寤哄垎琛ㄦ垚鍔燂細{}锛屽凡鍒锋柊瑙嗗浘 v_pat_med_outhosp", newTable);
+ }
+ } catch (Exception e) {
+ log.error("銆恈reateOuthospQuarterTable銆戝缓琛ㄥ紓甯�", e);
+ }
+ }
+
+
+ /**
+ * 鎸夋寚瀹氭ā寮忓缓闂ㄨ瘖鍒嗚〃骞舵洿鏂板姩鎬佽鍥�
+ * splitMode: 瀛e害 / 骞� / 鏈� / 涓嶅垎琛�
+ * 琛ㄥ悕锛�
+ * quarter -> pat_med_outhosp_20260103
+ * year -> pat_med_outhosp_2026
+ * month -> pat_med_outhosp_202601
+ */
+ public String createPartitionTableAndRefreshView(String splitMode) {
+ LocalDate today = LocalDate.now();
+ int year = today.getYear();
+ int month = today.getMonthValue();
+
+ // 1. 鏍规嵁妯″紡璁$畻鏂拌〃鍚嶅拰妯℃澘琛ㄥ悕
+ String newTableName;
+ String templateName;
+
+ if ("骞�".equals(splitMode)) {
+ // 鎸夊勾锛歱at_med_outhosp_2026
+ newTableName = "pat_med_outhosp_" + year;
+ // 妯℃澘琛細浼樺厛涓婁竴骞村垎琛�
+ String prevYearTable = "pat_med_outhosp_" + (year - 1);
+ templateName = patMedOuthospMapper.tableExists(prevYearTable) > 0 ? prevYearTable : "pat_med_outhosp";
+
+ } else if ("鏈�".equals(splitMode)) {
+ // 鎸夋湀锛歱at_med_outhosp_202601
+ newTableName = String.format("pat_med_outhosp_%d%02d", year, month);
+ // 妯℃澘琛細浼樺厛涓婁竴鏈堝垎琛�
+ LocalDate prevMonth = today.minusMonths(1);
+ String prevMonthTable = String.format("pat_med_outhosp_%d%02d", prevMonth.getYear(), prevMonth.getMonthValue());
+ templateName = patMedOuthospMapper.tableExists(prevMonthTable) > 0 ? prevMonthTable : "pat_med_outhosp";
+
+ } else {
+ // 榛樿鎸夊搴︼細pat_med_outhosp_20260103
+ String quarterSuffix;
+ if (month <= 3) {
+ quarterSuffix = "0103";
+ } else if (month <= 6) {
+ quarterSuffix = "0406";
+ } else if (month <= 9) {
+ quarterSuffix = "0709";
+ } else {
+ quarterSuffix = "1012";
+ }
+ newTableName = "pat_med_outhosp_" + year + quarterSuffix;
+ templateName = resolveQuarterTemplateName(year, quarterSuffix);
+ }
+
+ // 2. 妫�鏌ヨ〃鏄惁宸插瓨鍦�
+ if (patMedOuthospMapper.tableExists(newTableName) > 0) {
+ log.info("[寤鸿〃] 琛� {} 宸插瓨鍦紝鏃犻渶閲嶅寤鸿〃锛屼絾浠嶇劧灏濊瘯鍒锋柊瀛樺偍杩囩▼锛堢‘淇濆垎琛ㄥ凡绾冲叆鏌ヨ锛�", newTableName);
+ refreshOuthospView();
+ return null;
+ }
+
+ log.info("[寤鸿〃] 妯″紡={}锛屼娇鐢ㄦā鏉胯〃 {} 鍒涘缓 {}", splitMode, templateName, newTableName);
+
+ // 3. 鍒涘缓鏂拌〃锛圠IKE 妯℃澘琛紝鍙鍒剁粨鏋�+绱㈠紩锛屼笉鍚暟鎹級
+ patMedOuthospMapper.createPatMedOuthosp(templateName, newTableName);
+ // 4. 璁剧疆鑷涓婚敭
+ patMedOuthospMapper.createPatMedOuthospAutoAdd(newTableName);
+
+ // 5. 閲嶅缓鍔ㄦ�佽鍥�
+ refreshOuthospView();
+
+ log.info("[寤鸿〃] 寤鸿〃骞跺埛鏂拌鍥惧畬鎴愶紝鏂拌〃锛歿}", newTableName);
+ return newTableName;
+ }
+
+ /**
+ * 瀛e害鍒嗚〃妯℃澘纭畾锛氫紭鍏堜笂涓�瀛e害鍒嗚〃锛屾病鏈夊垯鐢ㄤ富琛�
+ */
+ private String resolveQuarterTemplateName(int year, String currentQuarterSuffix) {
+ String[][] quarters = {{"0103", "1012"}, {"0406", "0103"}, {"0709", "0406"}, {"1012", "0709"}};
+ String prevSuffix = null;
+ int prevYear = year;
+ for (String[] q : quarters) {
+ if (q[0].equals(currentQuarterSuffix)) {
+ prevSuffix = q[1];
+ if (currentQuarterSuffix.equals("0103")) {
+ prevYear = year - 1;
+ }
+ break;
+ }
+ }
+ if (prevSuffix != null) {
+ String prevTableName = "pat_med_outhosp_" + prevYear + prevSuffix;
+ if (patMedOuthospMapper.tableExists(prevTableName) > 0) {
+ return prevTableName;
+ }
+ }
+ return "pat_med_outhosp";
+ }
+
+ /**
+ * 鍒锋柊瀛樺偍杩囩▼ sp_query_outhosp
+ * 閫昏緫锛�
+ * 1. 浠� information_schema 鍔ㄦ�佽幏鍙� pat_med_outhosp 瀛楁鍒楄〃
+ * 2. 鏌ュ嚭鎵�鏈夊垎琛紙鍚庣紑涓�4-8浣嶇函鏁板瓧锛夋嫾 UNION ALL
+ * 3. 鏍规嵁瀛楁鏄惁瀛樺湪鍔ㄦ�佸喅瀹氬瓨鍌ㄨ繃绋嬪弬鏁板拰 WHERE 鏉′欢
+ * 4. 鐢ㄥ師鐢� JDBC 鎵ц锛圕REATE PROCEDURE 鍐呭惈鍒嗗彿锛孧yBatis 鏃犳硶澶勭悊锛�
+ */
+ private void refreshOuthospView() {
+ // 1. 鑾峰彇鎵�鏈夊垎琛�
+ List<String> allTables = patMedOuthospMapper.getAllOuthospTableNames();
+ List<String> partTables = allTables.stream().filter(t -> t.matches("pat_med_outhosp_[0-9]{4,8}")).sorted().collect(java.util.stream.Collectors.toList());
+
+ // 2. 鍔ㄦ�佽幏鍙栦富琛ㄥ瓧娈靛垪琛�
+ List<String> columns = patMedOuthospMapper.getTableColumns("pat_med_outhosp");
+ Set<String> cs = new HashSet<>(columns);
+ String colList = String.join(",", columns);
+
+ // 3. 鎷� UNION ALL锛坉el_flag 鍐呭祵鍏� SET @sql='...' 涓紝鐢� ''0'' 杞箟锛�
+ StringBuilder union = new StringBuilder();
+ for (String tbl : partTables) {
+ union.append("SELECT ").append(colList).append(" FROM ").append(tbl).append(" WHERE del_flag=''0'' UNION ALL ");
+ }
+ union.append("SELECT ").append(colList).append(" FROM pat_med_outhosp WHERE del_flag=''0''");
+
+ // 4. 浠� DB 鍏冩暟鎹姩鎬佹瀯寤哄弬鏁板垪琛�
+ // 鎺掗櫎鏃犱笟鍔℃剰涔夌殑绠$悊瀛楁
+ Set<String> excludeCols = new HashSet<>(java.util.Arrays.asList("id", "del_flag", "create_by", "create_time", "update_by", "update_time", "remark"));
+ // 寮哄埗绮剧‘鍖归厤鐨勫瓧娈碉紙瀛楁鍚嶄笉绗﹀悎 eqPattern 瑙勫垯浣嗕笟鍔′笂闇�绮剧‘鏌ヨ锛�
+ Set<String> forceEqCols = new HashSet<>(java.util.Arrays.asList("orgid", "guid", "campusid"));
+ // 绮剧‘鍖归厤瀛楁鐨勫叧閿瘝锛堝惈 no/code/flag/status/state/num/type/level/grade/sex/gender/phone/tel/id_锛�
+ java.util.regex.Pattern eqPattern = java.util.regex.Pattern.compile("(no|code|flag|status|state|num|type|level|grade|sex|gender|phone|tel|id_.*|.*_id)$", java.util.regex.Pattern.CASE_INSENSITIVE);
+
+ List<Map<String, String>> colMetaList = patMedOuthospMapper.getTableColumnMeta("pat_med_outhosp");
+ // [paramName, colName, kind, sqlType]
+ List<Object[]> activeParams = new ArrayList<>();
+ Set<String> addedDateCols = new HashSet<>();
+ for (Map<String, String> meta : colMetaList) {
+ String colName = meta.get("column_name");
+ String dataType = meta.get("data_type").toLowerCase();
+ String colType = meta.get("column_type").toUpperCase();
+ if (excludeCols.contains(colName)) continue;
+ switch (dataType) {
+ case "tinyint":
+ case "smallint":
+ case "int":
+ case "bigint":
+ case "integer":
+ case "decimal":
+ case "float":
+ case "double":
+ activeParams.add(new Object[]{"p_" + colName, colName, "num", colType});
+ break;
+ case "date":
+ case "datetime":
+ case "timestamp":
+ // 鏃ユ湡鍒楃敓鎴愬尯闂村弬鏁帮紝闃叉閲嶅娣诲姞
+ if (addedDateCols.add(colName)) {
+ if (colName.equals("admitdate")) {
+ activeParams.add(new Object[]{"p_begin_" + colName, colName, "date_ge", "DATE"});
+ activeParams.add(new Object[]{"p_end_" + colName, colName, "date_le", "DATE"});
+ }
+ }
+ break;
+ default:
+ // varchar / char / text 绛夊瓧绗︿覆绫诲瀷
+ if (dataType.contains("char") || dataType.contains("text") || dataType.contains("enum")) {
+ if (colName.equals("deptcode")) {
+ activeParams.add(new Object[]{"p_" + colName, colName, "in", colType});
+ break;
+ }
+ if (colName.equals("hospitaldistrictcode")) {
+ activeParams.add(new Object[]{"p_" + colName, colName, "in", colType});
+ break;
+ }
+ String kind = forceEqCols.contains(colName) ? "eq" : (eqPattern.matcher(colName).find() ? "eq" : "like");
+ activeParams.add(new Object[]{"p_" + colName, colName, kind, colType});
+ }
+ break;
+ }
+ }
+
+ // 6. 鎷煎弬鏁板畾涔夛紙鍘婚櫎閲嶅鍙傛暟鍚嶏紝濡� p_begin_xxx/p_end_xxx 鍚屽垪锛�
+ StringBuilder paramDef = new StringBuilder("CREATE PROCEDURE sp_query_outhosp(");
+ Set<String> addedParams = new LinkedHashSet<>();
+ for (Object[] m : activeParams) {
+ String pName = (String) m[0];
+ String dtype = (String) m[3];
+ if (addedParams.add(pName)) {
+ paramDef.append("IN ").append(pName).append(" ").append(dtype).append(",");
+ }
+ }
+ paramDef.append("IN p_page_size INT,IN p_page_num INT)");
+
+ // 7. 鎷煎瓨鍌ㄨ繃绋嬩富浣�
+ // 浼樺寲绛栫暐锛氱敤 @cond 鍙橀噺鏀堕泦鎵�鏈夎繃婊ゆ潯浠讹紝鐒跺悗娉ㄥ叆鍒版瘡涓瓙鏌ヨ鐨� WHERE 涓�
+ // 杩欐牱 MySQL 鍙互瀵规瘡寮犲垎琛ㄧ洿鎺ヨ蛋绱㈠紩锛岄伩鍏嶅叏琛ㄦ壂鎻忓悗澶栧眰鍐嶈繃婊�
+ List<String> body = new ArrayList<>();
+ body.add(paramDef.toString());
+ body.add("BEGIN");
+ body.add(" SET @cond='';");
+
+ // 7a. 鍔ㄦ�佹嫾鎺� @cond 鏉′欢鐗囨
+ for (Object[] m : activeParams) {
+ String pName = (String) m[0];
+ String col = (String) m[1];
+ String kind = (String) m[2];
+ String line;
+ switch (kind) {
+ case "num":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + "='," + pName + "); END IF;";
+ break;
+ case "eq":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + "=',QUOTE(" + pName + ")); END IF;";
+ break;
+ case "like":
+ // MySQL 瀛樺偍杩囩▼鍐� '' 琛ㄧず涓�涓崟寮曞彿
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + " LIKE CONCAT(''%''," + pName + ",''%'')'); END IF;";
+ break;
+ case "date_ge":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + ">=',QUOTE(" + pName + ")); END IF;";
+ break;
+ case "date_le":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + "<=',QUOTE(" + pName + ")); END IF;";
+ break;
+ case "in":
+ // 鍙傛暟涓洪�楀彿鍒嗛殧瀛楃涓诧紝鐢� FIND_IN_SET 鍖归厤瀛楁鍦ㄩ泦鍚堜腑
+ // 鐢熸垚 SQL锛� FIND_IN_SET(col, 'val1,val2,...')
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND FIND_IN_SET(" + col + ",',QUOTE(" + pName + "),')'); END IF;";
+ break;
+ default:
+ line = "";
+ }
+ if (!line.isEmpty()) body.add(line);
+ }
+
+ // 7b. 鏋勫缓 UNION ALL SQL锛氭瘡涓瓙鏌ヨ鐨� WHERE 鍐呯洿鎺ユ敞鍏� @cond
+ // 鏈�缁堝瓨鍌ㄨ繃绋嬮噷鎵ц鐨� SQL 绫讳技锛�
+ // SELECT cols FROM tbl1 WHERE del_flag='0' AND orgid=? AND ...
+ // UNION ALL SELECT cols FROM tbl2 WHERE del_flag='0' AND orgid=? AND ...
+ // ORDER BY update_time DESC LIMIT ? OFFSET ?
+ //
+ // 瀹炵幇鏂瑰紡锛氱敤 CONCAT(鍗曞紩鍙峰瓧绗︿覆, @cond, ...) 鎷兼帴
+ // del_flag=''0'' 鍦ㄥ瓨鍌ㄨ繃绋嬪唴鍗曞紩鍙峰瓧绗︿覆涓〃绀轰竴涓� '0'
+ List<String> allQueryTables = new ArrayList<>(partTables);
+ allQueryTables.add("pat_med_outhosp");
+
+ StringBuilder concatArgs = new StringBuilder();
+ for (int i = 0; i < allQueryTables.size(); i++) {
+ String tbl = allQueryTables.get(i);
+ if (i > 0) {
+ concatArgs.append(",' UNION ALL SELECT ").append(colList).append(" FROM ").append(tbl).append(" WHERE del_flag=''0''',@cond");
+ } else {
+ concatArgs.append("'SELECT ").append(colList).append(" FROM ").append(tbl).append(" WHERE del_flag=''0''',@cond");
+ }
+ }
+
+ String orderCol = cs.contains("update_time") ? "update_time" : "id";
+ body.add(" SET @sql=CONCAT(" + concatArgs + ",' ORDER BY " + orderCol + " DESC');");
+ body.add(" IF p_page_size IS NOT NULL AND p_page_num IS NOT NULL THEN");
+ body.add(" SET @sql=CONCAT(@sql,' LIMIT ',p_page_size,' OFFSET ',p_page_num);");
+ body.add(" END IF;");
+ body.add(" PREPARE stmt FROM @sql;");
+ body.add(" EXECUTE stmt;");
+ body.add(" DEALLOCATE PREPARE stmt;");
+ body.add("END");
+
+ String procSql = String.join("\n", body);
+ log.debug("[鍒锋柊瀛樺偍杩囩▼] DDL=\n{}", procSql);
+
+ // 8. 閫氳繃鍘熺敓 JDBC 鎵ц锛圕REATE PROCEDURE 鍚垎鍙凤紝MyBatis 涓嶆敮鎸侊級
+ // 绛栫暐锛�
+ // - 瀛樺偍杩囩▼涓嶅瓨鍦� 鈫� 鍏ㄩ噺鍒涘缓
+ // - 瀛樺偍杩囩▼宸插瓨鍦� 鈫� 鍙妸 DB 涓繕娌℃湁鐨勫垎琛ㄤ互 UNION ALL 褰㈠紡杩藉姞杩� SET @sql=CONCAT(...) 閲岋紝
+ // 鍏朵綑鎵�鏈夋潯浠堕�昏緫锛堜汉宸ユ敼杩囩殑妯$硦/鍖洪棿绛夛級鍘熸牱淇濈暀锛岀粷涓嶈鐩�
+ try (Connection conn = dataSource.getConnection(); Statement jdbcStmt = conn.createStatement()) {
+
+ // 鍏堟煡 DB 涓槸鍚﹀瓨鍦ㄨ瀛樺偍杩囩▼鍙婂叾瀹屾暣 DDL
+ String showCreateDdl = null;
+ try (java.sql.ResultSet rs = jdbcStmt.executeQuery("SHOW CREATE PROCEDURE sp_query_outhosp")) {
+ if (rs.next()) {
+ showCreateDdl = rs.getString("Create Procedure");
+ }
+ } catch (Exception ignored) {
+ // 瀛樺偍杩囩▼涓嶅瓨鍦ㄦ椂 SHOW CREATE 浼氭姏寮傚父锛屽拷鐣�
+ }
+
+ if (showCreateDdl == null) {
+ // 瀛樺偍杩囩▼涓嶅瓨鍦紝鍏ㄩ噺鍒涘缓
+ jdbcStmt.execute(procSql);
+ log.info("[鍒锋柊瀛樺偍杩囩▼] sp_query_outhosp 棣栨鍒涘缓锛屽垎琛ㄦ暟閲忥細{}", partTables.size());
+ } else {
+ // 瀛樺偍杩囩▼宸插瓨鍦細鎵惧嚭 DB 閲屽凡鏈夊摢浜涘垎琛紝鎶婃柊澧炵殑杩藉姞杩涘幓
+ // 鎵惧嚭褰撳墠 DDL 閲屽凡鍑虹幇鐨勬墍鏈� pat_med_outhosp_xxx 琛ㄥ悕
+ java.util.regex.Matcher tblMatcher = java.util.regex.Pattern.compile("pat_med_outhosp_([0-9]{4,8})").matcher(showCreateDdl);
+ Set<String> existingTables = new java.util.LinkedHashSet<>();
+ while (tblMatcher.find()) {
+ existingTables.add(tblMatcher.group(0));
+ }
+
+ // 鎵惧嚭鏈鏂板缓鍚庤繕娌¤繘鍏ュ瓨鍌ㄨ繃绋嬬殑鍒嗚〃
+ List<String> newTables = partTables.stream().filter(t -> !existingTables.contains(t)).collect(java.util.stream.Collectors.toList());
+
+ if (newTables.isEmpty()) {
+ log.info("[鍒锋柊瀛樺偍杩囩▼] 鏃犳柊澧炲垎琛紝瀛樺偍杩囩▼鏃犻渶鏇存柊");
+ } else {
+ // 鐩存帴浠� DDL 閲屾彁鍙栧瓧娈靛垪琛紙閬垮厤涓� Java 鍔ㄦ�佹煡琛ㄥ瓧娈典笉涓�鑷达級
+ // DDL 閲屽瓧娈靛垪琛ㄥ氨鍦細 SELECT 鍚庨潰鍒� FROM 鍓嶉潰
+ java.util.regex.Matcher colMatcher = java.util.regex.Pattern.compile("SELECT\\s+(.+?)\\s+FROM\\s+pat_med_outhosp", java.util.regex.Pattern.CASE_INSENSITIVE).matcher(showCreateDdl);
+ String existingColList = colMatcher.find() ? colMatcher.group(1).trim() : colList;
+
+ // 绮剧‘閿氱偣锛�',@cond,' UNION ALL SELECT cols FROM pat_med_outhosp WHERE
+ String mainTableAnchor = "',@cond,' UNION ALL SELECT " + existingColList + " FROM pat_med_outhosp WHERE ";
+ int mainAnchorIdx = showCreateDdl.indexOf(mainTableAnchor);
+
+ // 瀛楁鍒楄〃鍖归厤涓嶅埌鏃讹紝绠�鍖栧畾浣�
+ if (mainAnchorIdx < 0) {
+ // 鎵� ',@cond,' UNION ALL SELECT ... FROM pat_med_outhosp WHERE
+ // 鍏堟壘 FROM pat_med_outhosp WHERE锛屽啀寰�鍓嶆壘 ',@cond,'
+ int fromIdx = showCreateDdl.indexOf(" FROM pat_med_outhosp WHERE ");
+ if (fromIdx >= 0) {
+ String before = showCreateDdl.substring(0, fromIdx);
+ int condIdx = before.lastIndexOf("',@cond,'");
+ if (condIdx >= 0) mainAnchorIdx = condIdx;
+ }
+ }
+
+ if (mainAnchorIdx < 0) {
+ log.warn("[鍒锋柊瀛樺偍杩囩▼] 鏈壘鍒颁富琛ㄩ敋鐐癸紝璺宠繃杩藉姞");
+ } else {
+ // 鏂拌〃鐗囨锛氭瘡寮犳柊琛ㄨ拷鍔犱竴娈� ',@cond,' UNION ALL SELECT cols FROM 鏂拌〃 WHERE del_flag=''0''
+ // 鎻掑湪涓昏〃閿氱偣鍓嶉潰锛屼富琛ㄩ敋鐐规湰韬紙',@cond,' UNION ALL ...涓昏〃...锛変繚鎸佷笉鍔�
+ StringBuilder newTablesFragment = new StringBuilder();
+ for (String nt : newTables) {
+ newTablesFragment.append("',@cond,' UNION ALL SELECT ").append(existingColList).append(" FROM ").append(nt).append(" WHERE del_flag=''0''");
+ }
+
+ // 鎻掑叆鍒颁富琛� ',@cond,' 鐗囨鍓嶉潰
+ String updatedDdl = showCreateDdl.substring(0, mainAnchorIdx) + newTablesFragment + showCreateDdl.substring(mainAnchorIdx);
+
+ log.debug("[鍒锋柊瀛樺偍杩囩▼] 鏇存柊鍚� DDL=\n{}", updatedDdl);
+
+ // 瀹夊叏淇濇姢锛欴ROP 鍓嶅厛淇濆瓨鍘� DDL锛孋REATE 澶辫触鍒欑珛鍒荤敤鍘� DDL 鎭㈠
+ jdbcStmt.execute("DROP PROCEDURE IF EXISTS sp_query_outhosp");
+ try {
+ jdbcStmt.execute(updatedDdl);
+ log.info("[鍒锋柊瀛樺偍杩囩▼] sp_query_outhosp 杩藉姞鏂板垎琛� {}锛屽師鏈夋潯浠朵繚鎸佷笉鍙�", newTables);
+ } catch (Exception createEx) {
+ log.error("[鍒锋柊瀛樺偍杩囩▼] 鏂� DDL 鎵ц澶辫触锛屾鍦ㄧ敤鍘� DDL 鎭㈠, updatedDdl=\n{}", updatedDdl, createEx);
+ try {
+ jdbcStmt.execute(showCreateDdl);
+ log.info("[鍒锋柊瀛樺偍杩囩▼] sp_query_outhosp 宸茬敤鍘� DDL 鎭㈠鎴愬姛");
+ } catch (Exception rollbackEx) {
+ log.error("[鍒锋柊瀛樺偍杩囩▼] 鍘� DDL 鎭㈠涔熷け璐ワ紒瀛樺偍杩囩▼涓㈠け锛佽鎵嬪姩淇, 鍘� DDL=\n{}", showCreateDdl, rollbackEx);
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.error("[鍒锋柊瀛樺偍杩囩▼] sp_query_outhosp 鏇存柊澶辫触, DDL=\n{}", procSql, e);
+ }
+
+ // 9. 鍚屾鍒锋柊 count 瀛樺偍杩囩▼
+ refreshOuthospCountProc(partTables, activeParams, colList);
+ }
+
+ /**
+ * 鍒锋柊璁℃暟瀛樺偍杩囩▼ sp_count_outhosp
+ * 涓� sp_query_outhosp 鍙傛暟瀹屽叏涓�鑷达紝鍙繑鍥炴�绘潯鏁帮紝涓嶅垎椤�
+ */
+ private void refreshOuthospCountProc(List<String> partTables, List<Object[]> activeParams, String colList) {
+ // 鎷煎弬鏁板畾涔夛紙鍘绘帀 p_page_size/p_page_num锛�
+ StringBuilder paramDef = new StringBuilder("CREATE PROCEDURE sp_count_outhosp(");
+ Set<String> addedParams = new LinkedHashSet<>();
+ for (Object[] m : activeParams) {
+ String pName = (String) m[0];
+ String dtype = (String) m[3];
+ if (addedParams.add(pName)) {
+ paramDef.append("IN ").append(pName).append(" ").append(dtype).append(",");
+ }
+ }
+ // 鍘绘帀鏈�鍚庣殑澶氫綑閫楀彿
+ String paramDefStr = paramDef.toString();
+ if (paramDefStr.endsWith(",")) {
+ paramDefStr = paramDefStr.substring(0, paramDefStr.length() - 1);
+ }
+ paramDefStr += ")";
+
+ List<String> body = new ArrayList<>();
+ body.add(paramDefStr);
+ body.add("BEGIN");
+ body.add(" SET @cond='';");
+
+ // 鏉′欢鐗囨锛堜笌 sp_query_outhosp 瀹屽叏涓�鑷达級
+ for (Object[] m : activeParams) {
+ String pName = (String) m[0];
+ String col = (String) m[1];
+ String kind = (String) m[2];
+ String line;
+ switch (kind) {
+ case "num":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + "='," + pName + "); END IF;";
+ break;
+ case "eq":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + "=',QUOTE(" + pName + ")); END IF;";
+ break;
+ case "like":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + " LIKE CONCAT(''%''," + pName + ",''%'')'); END IF;";
+ break;
+ case "date_ge":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + ">=',QUOTE(" + pName + ")); END IF;";
+ break;
+ case "date_le":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND " + col + "<=',QUOTE(" + pName + ")); END IF;";
+ break;
+ case "in":
+ line = " IF " + pName + " IS NOT NULL THEN SET @cond=CONCAT(@cond,' AND FIND_IN_SET(" + col + ",',QUOTE(" + pName + "),')'); END IF;";
+ break;
+ default:
+ line = "";
+ }
+ if (!line.isEmpty()) body.add(line);
+ }
+
+ // 鎷� COUNT UNION ALL SQL锛氬悇鍒嗚〃鍚勮涓�娆″啀姹囨��
+ // SELECT SUM(cnt) FROM (SELECT COUNT(1) cnt FROM tbl1 WHERE del_flag=''0'' ...
+ // UNION ALL SELECT COUNT(1) cnt FROM tbl2 WHERE del_flag=''0'' ...) t
+ List<String> allQueryTables = new ArrayList<>(partTables);
+ allQueryTables.add("pat_med_outhosp");
+
+ StringBuilder concatArgs = new StringBuilder();
+ concatArgs.append("'SELECT SUM(cnt) FROM (");
+ for (int i = 0; i < allQueryTables.size(); i++) {
+ String tbl = allQueryTables.get(i);
+ if (i > 0) {
+ concatArgs.append(" UNION ALL SELECT COUNT(1) cnt FROM ").append(tbl).append(" WHERE del_flag=''''0''''").append("',@cond,'");
+ } else {
+ concatArgs.append("SELECT COUNT(1) cnt FROM ").append(tbl).append(" WHERE del_flag=''''0''''").append("',@cond,'");
+ }
+ }
+ concatArgs.append(") t';");
+
+ // 閲嶆柊鎷硷細姣忎釜瀛愯〃 WHERE del_flag=''0'' 鍚庢嫾 @cond
+ // 瀛樺偍杩囩▼鍐� '' 琛ㄧず涓�涓崟寮曞彿锛屾墍浠� del_flag=''0'' 姝g‘
+ StringBuilder concatArgs2 = new StringBuilder();
+ for (int i = 0; i < allQueryTables.size(); i++) {
+ String tbl = allQueryTables.get(i);
+ if (i == 0) {
+ concatArgs2.append("'SELECT SUM(cnt) FROM (SELECT COUNT(1) cnt FROM ").append(tbl).append(" WHERE del_flag=''0''',@cond");
+ } else {
+ concatArgs2.append(",' UNION ALL SELECT COUNT(1) cnt FROM ").append(tbl).append(" WHERE del_flag=''0''',@cond");
+ }
+ }
+ concatArgs2.append(",' ) t'");
+
+ body.add(" SET @sql=CONCAT(" + concatArgs2 + ");");
+ body.add(" PREPARE stmt FROM @sql;");
+ body.add(" EXECUTE stmt;");
+ body.add(" DEALLOCATE PREPARE stmt;");
+ body.add("END");
+
+ String procSql = String.join("\n", body);
+ log.debug("[鍒锋柊count瀛樺偍杩囩▼] DDL=\n{}", procSql);
+
+ try (Connection conn = dataSource.getConnection(); Statement jdbcStmt = conn.createStatement()) {
+ String showCreateDdl = null;
+ try (java.sql.ResultSet rs = jdbcStmt.executeQuery("SHOW CREATE PROCEDURE sp_count_outhosp")) {
+ if (rs.next()) showCreateDdl = rs.getString("Create Procedure");
+ } catch (Exception ignored) {
+ }
+
+ if (showCreateDdl == null) {
+ jdbcStmt.execute(procSql);
+ log.info("[鍒锋柊count瀛樺偍杩囩▼] sp_count_outhosp 棣栨鍒涘缓锛屽垎琛ㄦ暟閲忥細{}", partTables.size());
+ } else {
+ // 鍙拷鍔犳柊鍒嗚〃锛屼笉瑕嗙洊宸叉湁鏉′欢
+ java.util.regex.Matcher tblMatcher = java.util.regex.Pattern.compile("pat_med_outhosp_([0-9]{4,8})").matcher(showCreateDdl);
+ Set<String> existingTables = new java.util.LinkedHashSet<>();
+ while (tblMatcher.find()) existingTables.add(tblMatcher.group(0));
+
+ List<String> newTables = partTables.stream().filter(t -> !existingTables.contains(t)).collect(java.util.stream.Collectors.toList());
+ if (newTables.isEmpty()) {
+ log.info("[鍒锋柊count瀛樺偍杩囩▼] 鏃犳柊澧炲垎琛紝鏃犻渶鏇存柊");
+ return;
+ }
+
+ // 浠� DDL 閲屾彁鍙� COUNT(1) cnt FROM 鍚庨潰鐨勫瓧娈垫ā寮忔棤妗堬紝COUNT瀛樺偍杩囩▼娌℃湁瀛楁鍒楄〃
+ // 瀹氫綅涓昏〃閿氱偣锛�',@cond,' UNION ALL SELECT COUNT(1) cnt FROM pat_med_outhosp WHERE
+ String mainAnchor = "',@cond,' UNION ALL SELECT COUNT(1) cnt FROM pat_med_outhosp WHERE ";
+ int mainAnchorIdx = showCreateDdl.indexOf(mainAnchor);
+ if (mainAnchorIdx < 0) {
+ int fromIdx = showCreateDdl.indexOf(" FROM pat_med_outhosp WHERE ");
+ if (fromIdx >= 0) {
+ String before = showCreateDdl.substring(0, fromIdx);
+ int condIdx = before.lastIndexOf("',@cond,'");
+ if (condIdx >= 0) mainAnchorIdx = condIdx;
+ }
+ }
+
+ if (mainAnchorIdx < 0) {
+ log.warn("[鍒锋柊count瀛樺偍杩囩▼] 鏈壘鍒颁富琛ㄩ敋鐐癸紝璺宠繃杩藉姞");
+ return;
+ }
+
+ StringBuilder newFrag = new StringBuilder();
+ for (String nt : newTables) {
+ newFrag.append("',@cond,' UNION ALL SELECT COUNT(1) cnt FROM ").append(nt).append(" WHERE del_flag=''0''");
+ }
+ String updatedDdl = showCreateDdl.substring(0, mainAnchorIdx) + newFrag + showCreateDdl.substring(mainAnchorIdx);
+ log.debug("[鍒锋柊count瀛樺偍杩囩▼] 鏇存柊鍚� DDL=\n{}", updatedDdl);
+
+ jdbcStmt.execute("DROP PROCEDURE IF EXISTS sp_count_outhosp");
+ try {
+ jdbcStmt.execute(updatedDdl);
+ log.info("[鍒锋柊count瀛樺偍杩囩▼] sp_count_outhosp 杩藉姞鏂板垎琛� {}", newTables);
+ } catch (Exception createEx) {
+ log.error("[鍒锋柊count瀛樺偍杩囩▼] 鏂� DDL 澶辫触锛屾仮澶嶅師 DDL, updatedDdl=\n{}", updatedDdl, createEx);
+ try {
+ jdbcStmt.execute(showCreateDdl);
+ log.info("[鍒锋柊count瀛樺偍杩囩▼] 宸叉仮澶嶅師 DDL");
+ } catch (Exception rollbackEx) {
+ log.error("[鍒锋柊count瀛樺偍杩囩▼] 鎭㈠涔熷け璐ワ紒璇锋墜鍔ㄤ慨澶�, 鍘� DDL=\n{}", showCreateDdl, rollbackEx);
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.error("[鍒锋柊count瀛樺偍杩囩▼] sp_count_outhosp 鏇存柊澶辫触", e);
+ }
+ }
+
+
+}
diff --git a/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java b/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java
index efae19c..72836dd 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java
@@ -82,7 +82,7 @@
public List<PatArchiveOthreInfo> selectPatArchiveInfoByInhospQC(PatArchiveReq patArchive);
- public List<PatArchiveOthreInfo> selectPatArchiveInfoByOuthospQC(PatArchiveReq patArchive);
+// public List<PatArchiveOthreInfo> selectPatArchiveInfoByOuthospQC(PatArchiveReq patArchive);
public List<PatArchiveOthreInfo> selectPatArchiveInfoByPhysicalQC(PatArchiveReq patArchive);
diff --git a/smartor/src/main/java/com/smartor/mapper/PatArchiveOutMapper.java b/smartor/src/main/java/com/smartor/mapper/PatArchiveOutMapper.java
index 8e1495f..8bbcbeb 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatArchiveOutMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatArchiveOutMapper.java
@@ -24,7 +24,7 @@
*/
public PatArchiveOut selectPatArchiveOutByPatid(Long patid);
- public List<PerSonWorkbenchDto> selectPatArchiveCount(@Param("deptIds") long[] deptIds,@Param("drCodes") String[] drCodes);
+ public List<PerSonWorkbenchDto> selectPatArchiveCount(@Param("deptcodes") List<String> deptcodes,@Param("drCodes") String[] drCodes);
/**
* 鏌ヨ澶栭儴鎮h�呮。妗堝垪琛�
diff --git a/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java b/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
index f8fc62a..52a80b7 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
@@ -25,7 +25,7 @@
*/
public PatMedInhosp selectPatMedInhospByInhospid(Long inhospid);
- public List<PatMedInhosp> selectPatMedInhosp(PatMedInhosp patMedInhosp);
+ public List<PatMedInhosp> selectPatMedInhosp(PatMedInhosp patMedInhosp);
public String getTagnameBypatid(Long patid);
@@ -92,10 +92,9 @@
public PatMedRes selectPatMedInhospCount(PatMedReq patMedReq);
- public List<PatMedRes> getDeptRanking(PatMedReq patMedReq);
-
/**
* 鏌ヨ涓変釜缁村害浠绘剰涓�涓湭澶勭悊鐨勫嚭闄㈡偅鑰�
+ *
* @return
*/
public List<PatMedInhosp> selectNeedProcessList();
diff --git a/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java b/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
index b80f83e..bf12d7c 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
@@ -1,10 +1,9 @@
package com.smartor.mapper;
import java.util.List;
+import java.util.Map;
-import com.smartor.domain.PatMedOuthosp;
-import com.smartor.domain.PatMedReq;
-import com.smartor.domain.PatMedRes;
+import com.smartor.domain.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -16,21 +15,6 @@
*/
@Mapper
public interface PatMedOuthospMapper {
- /**
- * 鏌ヨ鎮h�呴棬璇婅褰�
- *
- * @param id 鎮h�呴棬璇婅褰曚富閿�
- * @return 鎮h�呴棬璇婅褰�
- */
- public PatMedOuthosp selectPatMedOuthospById(Long id);
-
- /**
- * 鏌ヨ鎮h�呴棬璇婅褰曞垪琛�
- *
- * @param patMedOuthosp 鎮h�呴棬璇婅褰�
- * @return 鎮h�呴棬璇婅褰曢泦鍚�
- */
- public List<PatMedOuthosp> selectPatMedOuthospList(PatMedOuthosp patMedOuthosp);
/**
* 鏂板鎮h�呴棬璇婅褰�
@@ -38,17 +22,44 @@
* @param patMedOuthosp 鎮h�呴棬璇婅褰�
* @return 缁撴灉
*/
- public int insertPatMedOuthosp(PatMedOuthosp patMedOuthosp);
-
- public int batchPatMedOuthosp(List<PatMedOuthosp> patMedOuthosps);
+// public int insertPatMedOuthosp(PatMedOuthosp patMedOuthosp);
/**
- * 鎵归噺鎻掑叆锛屽拷鐣ラ噸澶嶏紙INSERT IGNORE锛�
+ * 鏂板鍒版寚瀹氬垎琛紙鐢ㄤ簬璺敱鍒版渶鏂板垎琛級
*
- * @param patMedOuthosps 闂ㄦ�ヨ瘖璁板綍鍒楄〃
- * @return 瀹為檯鎻掑叆鏁伴噺
+ * @param tableName 鐩爣琛ㄥ悕
+ * @param record 闂ㄨ瘖璁板綍
+ * @return 鎻掑叆鏉℃暟
*/
- public int batchInsertIgnore(List<PatMedOuthosp> patMedOuthosps);
+ int insertIntoTable(@Param("tableName") String tableName, @Param("record") PatMedOuthosp record);
+
+
+ /**
+ * 鍒ゆ柇鎸囧畾鍒嗚〃涓槸鍚﹀瓨鍦ㄨ id
+ */
+ int existsInTable(@Param("tableName") String tableName, @Param("id") Long id);
+
+ /**
+ * 鏇存柊鍒版寚瀹氬垎琛紙鐢ㄤ簬璺敱鍒版纭垎琛級
+ */
+ int updateInTable(@Param("tableName") String tableName, @Param("record") PatMedOuthosp record);
+
+ /**
+ * 璋冪敤瀛樺偍杩囩▼ sp_query_outhosp 鏌ヨ闂ㄨ瘖璁板綍
+ *
+ * @param req 鍏ュ弬瀵硅薄
+ * @return 闂ㄨ瘖璁板綍鍒楄〃
+ */
+ List<PatMedOuthosp> callSpQueryOuthosp(PatMedOuthospQueryReq req);
+
+ /**
+ * 璋冪敤瀛樺偍杩囩▼ sp_query_outhosp 鏌ヨ闂ㄨ瘖璁板綍鏁伴噺
+ *
+ * @param req 鍏ュ弬瀵硅薄
+ * @return 闂ㄨ瘖璁板綍鍒楄〃
+ */
+ Long callSpQueryOuthospCount(PatMedOuthospQueryReq req);
+
/**
* 淇敼鎮h�呴棬璇婅褰�
@@ -56,62 +67,46 @@
* @param patMedOuthosp 鎮h�呴棬璇婅褰�
* @return 缁撴灉
*/
- public int updatePatMedOuthosp(PatMedOuthosp patMedOuthosp);
+// public int updatePatMedOuthosp(PatMedOuthosp patMedOuthosp);
- /**
- * 鍒犻櫎鎮h�呴棬璇婅褰�
- *
- * @param id 鎮h�呴棬璇婅褰曚富閿�
- * @return 缁撴灉
- */
- public int deletePatMedOuthospById(Long id);
-
- /**
- * 鎵归噺鍒犻櫎鎮h�呴棬璇婅褰�
- *
- * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
- * @return 缁撴灉
- */
- public int deletePatMedOuthospByIds(Long[] ids);
-
- PatMedRes selectPatMedOuthospCount(PatMedReq patMedReq);
-
- public List<PatMedRes> getDeptRanking(PatMedReq patMedReq);
-
- /**
- * 鑾峰彇琛ㄧ殑鏁伴噺
- *
- * @return
- */
- int countPatMedOuthosp();
-
- /**
- * 淇敼琛ㄥ悕
- *
- * @return
- */
- void renameTable(@Param("oldName") String oldName, @Param("newName") String newName);
/**
* 鍒涘缓鏂拌〃
*
- * @param templateName
- * @param newName
+ * @param templateName 妯℃澘琛ㄥ悕
+ * @param newName 鏂拌〃鍚�
*/
void createPatMedOuthosp(@Param("templateName") String templateName, @Param("newName") String newName);
void createPatMedOuthospAutoAdd(@Param("newName") String newName);
-
void setAutoIncrement(@Param("tableName") String tableName, @Param("autoInc") long autoInc);
// 鏌ヨ鎵�鏈� pat_med_outhosp 寮�澶寸殑琛ㄥ悕
List<String> getAllOuthospTableNames();
- // 鏌ヨ鎸囧畾琛ㄧ殑鏈�澶d
- Long getMaxIdFromTable(@Param("tableName") String tableName);
+ // 鏌ヨ鎸囧畾琛ㄧ殑瀛楁鍒楄〃锛堟寜 ordinal_position 鎺掑簭锛�
+ List<String> getTableColumns(@Param("tableName") String tableName);
- void createOrReplaceView(@Param("viewSql") String viewSql);
+ /**
+ * 鏌ヨ鎸囧畾琛ㄧ殑瀛楁鍏冩暟鎹紙column_name, data_type, column_type锛�
+ *
+ * @param tableName 琛ㄥ悕
+ * @return 姣忚鍖呭惈 column_name / data_type / column_type
+ */
+ List<Map<String, String>> getTableColumnMeta(@Param("tableName") String tableName);
+
+
+ /**
+ * 鍒涘缓鎴栨洿鏂板瓨鍌ㄨ繃绋嬶紙鏀寔 DROP / CREATE PROCEDURE 璇彞锛�
+ */
+ void createOrReplaceProcedure(@Param("procSql") String procSql);
+
+ /**
+ * 妫�鏌ヨ〃鏄惁宸插瓨鍦�
+ *
+ * @param tableName 琛ㄥ悕
+ * @return 瀛樺湪杩斿洖1锛屼笉瀛樺湪杩斿洖0
+ */
+ int tableExists(@Param("tableName") String tableName);
}
-
-
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
index 5be1d90..be736ac 100644
--- a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
@@ -35,6 +35,7 @@
/**
* 鐢ㄤ簬琛ュ伩鏌ヨ
+ *
* @param ServiceSubtaskEntity
* @return
*/
@@ -75,7 +76,8 @@
* @return
*/
@MapKey("groupKey")
- public Map<String, Map<String,Object>> selectTimelyRateBatch(ServiceSubtaskEntity ServiceSubtaskvo);
+ public Map<String, Map<String, Object>> selectTimelyRateBatch(ServiceSubtaskEntity ServiceSubtaskvo);
+
/**
* 闅忚鍙婃椂鐜囪鎯�
*
@@ -176,4 +178,12 @@
* allVisitCount: 褰撳墠鐧诲綍浜洪殢璁夸换鍔℃�婚噺
*/
public Map<String, Object> getCurrentUserServiceSubtaskCount(ServiceSubtaskEntity serviceSubtaskVO);
+ /**
+ * 鑾峰彇闂ㄨ瘖闅忚浜烘暟
+ *
+ * @param patMedReq
+ * @return
+ */
+ PatMedRes selectVisitCount(PatMedReq patMedReq);
+
}
diff --git a/smartor/src/main/java/com/smartor/service/PersonWorkbenchService.java b/smartor/src/main/java/com/smartor/service/PersonWorkbenchService.java
index 1e688e6..f3baece 100644
--- a/smartor/src/main/java/com/smartor/service/PersonWorkbenchService.java
+++ b/smartor/src/main/java/com/smartor/service/PersonWorkbenchService.java
@@ -15,6 +15,6 @@
/**
* 褰撳墠鐧诲綍鐢ㄦ埛鐨勯棬璇娿�佸湪闄€�佸嚭闄㈢梾浜虹殑缁熻鎯呭喌
*/
- public List<PerSonWorkbenchDto> getPatCount(String detpId, String drCode);
+ public List<PerSonWorkbenchDto> getPatCount(String deptIds, String drCode);
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
index d1496e0..7a3878f 100644
--- a/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
@@ -8,6 +8,7 @@
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.IHNGatherPatArchiveService;
+import com.smartor.service.IPatMedOuthospService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,7 +57,7 @@
private PatArchiveMapper patArchiveMapper;
@Autowired
- private ThreadPoolTaskExecutor taskExecutor;
+ private IPatMedOuthospService patMedOuthospService;
@Autowired
private ShardingMapper shardingMapper;
@@ -187,7 +188,7 @@
patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
patMedOuthosp1.setPatid(patArchives.get(0).getId());
}
- i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp1);
+ i = patMedOuthospService.insertPatMedOuthosp(patMedOuthosp1);
}
return i;
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 9a0e2cf..6baf3e1 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -63,7 +63,7 @@
private PatArchivecontactMapper patArchivecontactMapper;
@Autowired
- private IPatMedPhysicalService patMedPhysicalService;
+ private PatMedOuthospMapper patMedOuthospMapper;
@Autowired
private RedisCache redisCache;
@@ -273,9 +273,11 @@
}
} else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) {
// 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3
- List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthosp(patArchiveReq);
- if (CollectionUtils.isNotEmpty(patArchives2)) {
- patArchiveList.addAll(patArchives2);
+// List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthosp(patArchiveReq);
+ List<PatArchiveOthreInfo> patientInfoQC = getPatientInfoUtils(patArchiveReq);
+
+ if (CollectionUtils.isNotEmpty(patientInfoQC)) {
+ patArchiveList.addAll(patientInfoQC);
}
} else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) {
// 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3
@@ -594,9 +596,9 @@
patArchiveList.addAll(patArchives1);
}
} else if (patArchive.getAllhosp() != null && patArchive.getAllhosp() == 2) {
- List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthosp(patArchive);
- if (CollectionUtils.isNotEmpty(patArchives2)) {
- patArchiveList.addAll(patArchives2);
+ List<PatArchiveOthreInfo> patientInfoUtils = getPatientInfoUtils(patArchive);
+ if (CollectionUtils.isNotEmpty(patientInfoUtils)) {
+ patArchiveList.addAll(patientInfoUtils);
}
} else if (patArchive.getAllhosp() != null && patArchive.getAllhosp() == 3) {
List<PatArchiveOthreInfo> patArchives3 = patArchiveMapper.selectPatArchiveInfoByPhysical(patArchive);
@@ -781,9 +783,13 @@
}
} else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) {
// 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
- List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthospQC(patArchiveReq);
- if (CollectionUtils.isNotEmpty(patArchives2)) {
- patArchiveList.addAll(patArchives2);
+ List<PatArchiveOthreInfo> patArchives2 = new ArrayList<>();
+// List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthospQC(patArchiveReq);
+
+ //闂ㄦ�ヨ瘖淇℃伅锛岄噰鐢ㄥ垎琛ㄦ煡璇紙鍏堟煡闂ㄦ�ヨ瘖鐨勫瓨鍌ㄨ繃绋嬶紝鍐嶆煡鎮h�呭熀鏈俊鎭〃锛屽叧鑱旀潯浠讹細patid锛�
+ List<PatArchiveOthreInfo> patientInfoUtils = getPatientInfoUtils(patArchiveReq);
+ if (CollectionUtils.isNotEmpty(patientInfoUtils)) {
+ patArchiveList.addAll(patientInfoUtils);
}
} else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) {
// 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
@@ -847,7 +853,19 @@
count = patArchiveMapper.countPatArchiveInfoByInhospQC(patArchiveReq);
} else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) {
// 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
- count = patArchiveMapper.countPatArchiveInfoByOuthospQC(patArchiveReq);
+// count = patArchiveMapper.countPatArchiveInfoByOuthospQC(patArchiveReq);
+ PatMedOuthospQueryReq req=new PatMedOuthospQueryReq();
+ String deptcodes = CollectionUtils.isEmpty(patArchiveReq.getLeaveldeptcodes()) ? null : String.join(",", patArchiveReq.getLeaveldeptcodes());
+ String leavehospitaldistrictcodes = CollectionUtils.isEmpty(patArchiveReq.getLeavehospitaldistrictcodes()) ? null : String.join(",", patArchiveReq.getLeavehospitaldistrictcodes());
+ req.setDeptcode(deptcodes);
+ req.setHospitaldistrictcode(leavehospitaldistrictcodes);
+ req.setOrgid(patArchiveReq.getOrgid());
+ req.setDrname(StringUtils.isNotEmpty(patArchiveReq.getDrname()) ? patArchiveReq.getDrname() : null);
+ req.setPatname(StringUtils.isNotEmpty(patArchiveReq.getName()) ? patArchiveReq.getName() : null);
+ req.setDiagname(StringUtils.isNotEmpty(patArchiveReq.getLeavediagname()) ? patArchiveReq.getLeavediagname() : null);
+ count = patMedOuthospMapper.callSpQueryOuthospCount(req);
+
+
} else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) {
// 鏌ョ湅浣忛櫌 1 鏌ョ湅闂ㄨ瘖 2 鏌ョ湅浣撴 3 鏌ョ湅鍑洪櫌 4
count = patArchiveMapper.countPatArchiveInfoByPhysicalQC(patArchiveReq);
@@ -859,5 +877,33 @@
return count;
}
+
+ private List<PatArchiveOthreInfo> getPatientInfoUtils(PatArchiveReq patArchiveReq) {
+ List<PatArchiveOthreInfo> patArchiveList = new ArrayList<>();
+
+ //闂ㄦ�ヨ瘖淇℃伅锛岄噰鐢ㄥ垎琛ㄦ煡璇紙鍏堟煡闂ㄦ�ヨ瘖鐨勫瓨鍌ㄨ繃绋嬶紝鍐嶆煡鎮h�呭熀鏈俊鎭〃锛屽叧鑱旀潯浠讹細patid锛�
+ PatMedOuthospQueryReq req=new PatMedOuthospQueryReq();
+ String deptcodes = CollectionUtils.isEmpty(patArchiveReq.getLeaveldeptcodes()) ? null : String.join(",", patArchiveReq.getLeaveldeptcodes());
+ String leavehospitaldistrictcodes = CollectionUtils.isEmpty(patArchiveReq.getLeavehospitaldistrictcodes()) ? null : String.join(",", patArchiveReq.getLeavehospitaldistrictcodes());
+ req.setDeptcode(deptcodes);
+ req.setHospitaldistrictcode(leavehospitaldistrictcodes);
+ req.setOrgid(patArchiveReq.getOrgid());
+ req.setDrname(StringUtils.isNotEmpty(patArchiveReq.getDrname()) ? patArchiveReq.getDrname() : null);
+ req.setPatname(StringUtils.isNotEmpty(patArchiveReq.getName()) ? patArchiveReq.getName() : null);
+ req.setDiagname(StringUtils.isNotEmpty(patArchiveReq.getLeavediagname()) ? patArchiveReq.getLeavediagname() : null);
+ req.setPageNum(patArchiveReq.getPageNum()==null?null:patArchiveReq.getPageNum());
+ req.setPageSize(patArchiveReq.getPageSize()==null?null:patArchiveReq.getPageSize());
+ List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.callSpQueryOuthosp(req);
+ for (PatMedOuthosp patMedOuthosp:patMedOuthosps ) {
+ PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp.getPatid());
+ PatArchiveOthreInfo patArchiveOthreInfo = DtoConversionUtils.sourceToTarget(patArchive, PatArchiveOthreInfo.class);
+ patArchiveOthreInfo.setDeptcode(patMedOuthosp.getDeptcode());
+ patArchiveOthreInfo.setDeptname(patMedOuthosp.getDeptname());
+ patArchiveOthreInfo.setDrcode(patMedOuthosp.getDrcode());
+ patArchiveOthreInfo.setDrname(patMedOuthosp.getDrname());
+ patArchiveList.add(patArchiveOthreInfo);
+ }
+ return patArchiveList;
+ }
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
index 1095668..6d833d5 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
@@ -1,27 +1,26 @@
package com.smartor.service.impl;
+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 lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.Statement;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
-
-import com.ruoyi.common.core.domain.entity.SysDept;
-import com.ruoyi.common.core.domain.entity.SysUserDept;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.DtoConversionUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.smartor.domain.*;
-import com.smartor.domain.entity.ServiceSubtaskEntity;
-import com.smartor.mapper.*;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.ObjectUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-import com.smartor.service.IPatMedOuthospService;
-import org.springframework.util.CollectionUtils;
/**
* 鎮h�呴棬璇婅褰昐ervice涓氬姟灞傚鐞�
@@ -36,7 +35,7 @@
private PatMedOuthospMapper patMedOuthospMapper;
@Autowired
- private SysUserDeptMapper sysUserDeptMapper;
+ private DataSource dataSource;
@Autowired
private ServiceSubtaskMapper serviceSubtaskMapper;
@@ -62,7 +61,8 @@
*/
@Override
public PatMedOuthosp selectPatMedOuthospById(Long id) {
- return patMedOuthospMapper.selectPatMedOuthospById(id);
+// return patMedOuthospMapper.selectPatMedOuthospById(id);
+ return null;
}
/**
@@ -73,9 +73,10 @@
*/
@Override
public List<PatMedOuthosp> selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) {
- List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp);
+ PatMedOuthospQueryReq patMedOuthospQueryReq = DtoConversionUtils.sourceToTarget(patMedOuthosp, PatMedOuthospQueryReq.class);
+ List<PatMedOuthosp> patMedOuthospQueryResps = patMedOuthospMapper.callSpQueryOuthosp(patMedOuthospQueryReq);
if (patMedOuthosp.getPageNum() != null) {
- for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) {
+ for (PatMedOuthosp patMedOuthosp1 : patMedOuthospQueryResps) {
PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid());
if (patArchive.getBirthdate() != null) {
Map<String, String> map = calculateAge(patArchive.getBirthdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now());
@@ -101,7 +102,7 @@
if (!CollectionUtils.isEmpty(serviceSubtaskList)) patMedOuthosp1.setServerState("1");
}
}
- return patMedOuthosps;
+ return patMedOuthospQueryResps;
}
public Map<String, String> calculateAge(LocalDate birthdate, LocalDate today) {
@@ -158,27 +159,109 @@
/**
* 鏂板鎮h�呴棬璇婅褰�
+ * 鏍规嵁 admitdate 璺敱鍒板搴斿垎琛紱鑻ュ垎琛ㄤ笉瀛樺湪鍒欏啓鍏ヤ富琛�
*
* @param patMedOuthosp 鎮h�呴棬璇婅褰�
* @return 缁撴灉
*/
@Override
public int insertPatMedOuthosp(PatMedOuthosp patMedOuthosp) {
+ if (patMedOuthosp.getAdmitdate() != null) {
+ log.error("闂ㄦ�ュ氨璇婃椂闂翠笉鑳戒负绌�");
+ return 0;
+ }
patMedOuthosp.setCreateTime(DateUtils.getNowDate());
patMedOuthosp.setUpdateTime(DateUtils.getNowDate());
- return patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
+ patMedOuthosp.setGuid(UUID.randomUUID().toString());
+ //闇�瑕佹彃鍏ュ埌鍝釜琛紝鏍规嵁灏辫瘖鏃堕棿鐨勬棩鏈熸潵瀹氾紝濡傛灉鏍规嵁灏辫瘖鏃堕棿鏉ョ‘瀹氱殑琛ㄤ笉瀛樺湪锛屽垯瀛樺湪pat_med_outhosp琛ㄤ腑
+ String targetTable = resolveTargetTable(patMedOuthosp.getAdmitdate());
+ if (targetTable != null) {
+ log.info("[insert] 璺敱鍒板垎琛�: {}", targetTable);
+ return patMedOuthospMapper.insertIntoTable(targetTable, patMedOuthosp);
+ }
+ return 0;
}
/**
* 淇敼鎮h�呴棬璇婅褰�
+ * 鏍规嵁 admitdate 璺敱鍒板搴斿垎琛紱鑻ュ垎琛ㄤ笉瀛樺湪鍒欐敼涓昏〃
*
* @param patMedOuthosp 鎮h�呴棬璇婅褰�
* @return 缁撴灉
*/
@Override
public int updatePatMedOuthosp(PatMedOuthosp patMedOuthosp) {
- patMedOuthosp.setUpdateTime(DateUtils.getNowDate());
- return patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp);
+ if (patMedOuthosp.getSerialnum() == null) {
+ log.error("娴佹按鍙蜂笉鑳戒负绌�");
+ return 0;
+ }
+ PatMedOuthospQueryReq patMedOuthospQueryReq = new PatMedOuthospQueryReq();
+ patMedOuthospQueryReq.setSerialnum(patMedOuthosp.getSerialnum());
+ patMedOuthospQueryReq.setGuid(patMedOuthosp.getGuid());
+ patMedOuthospQueryReq.setOuthospno(patMedOuthosp.getOuthospno());
+ List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.callSpQueryOuthosp(patMedOuthospQueryReq);
+
+ if (patMedOuthosps == null || patMedOuthosps.size() == 0) {
+ insertPatMedOuthosp(patMedOuthosp);
+ } else {
+ patMedOuthosp.setUpdateTime(DateUtils.getNowDate());
+ String targetTable = resolveTargetTable(patMedOuthosp.getAdmitdate());
+ if (targetTable != null) {
+ log.info("[update] 璺敱鍒板垎琛�: {}", targetTable);
+ return patMedOuthospMapper.updateInTable(targetTable, patMedOuthosp);
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * 鏍规嵁 create_time 鎺ㄧ畻鐩爣鍒嗚〃鍚嶏紝涓庡缓琛ㄧ瓥鐣ヤ繚鎸佷竴鑷�
+ * <ul>
+ * <li>6浣嶅悗缂�锛圷YYYMM锛夆啋 鎸夋湀鍒嗚〃</li>
+ * <li>8浣嶅悗缂�锛圷YYYMMdd锛夆啋 鎸夊搴﹀垎琛紝瀛e害鍚庣紑鍥哄畾涓� 0103/0406/0709/1012</li>
+ * <li>4浣嶅悗缂�锛圷YYY锛� 鈫� 鎸夊勾鍒嗚〃</li>
+ * </ul>
+ * 鎺ㄧ畻鍑鸿〃鍚嶅悗鏍¢獙琛ㄦ槸鍚﹀瓨鍦紝涓嶅瓨鍦ㄨ繑鍥� null锛堝洖钀戒富琛級
+ *
+ * @param createTime 鍒涘缓鏃堕棿锛屼负 null 鏃惰繑鍥� null
+ * @return 鐩爣鍒嗚〃鍚嶏紝鎴� null
+ */
+ private String resolveTargetTable(java.util.Date createTime) {
+ if (createTime == null) return null;
+ List<String> allTables = patMedOuthospMapper.getAllOuthospTableNames();
+ if (allTables == null || allTables.isEmpty()) return null;
+
+ // 鍒ゆ柇褰撳墠鍒嗚〃鍚庣紑闀垮害锛堜互绗竴寮犺〃涓哄噯锛�
+ String sample = allTables.get(0);
+ String suffix = sample.replaceFirst("pat_med_outhosp_", "");
+ int suffixLen = suffix.length();
+
+ java.util.Calendar cal = java.util.Calendar.getInstance();
+ cal.setTime(createTime);
+ int year = cal.get(java.util.Calendar.YEAR);
+ int month = cal.get(java.util.Calendar.MONTH) + 1; // 1-based
+
+ String targetTable;
+ if (suffixLen == 4) {
+ // 鎸夊勾
+ targetTable = "pat_med_outhosp_" + year;
+ } else if (suffixLen == 6) {
+ // 鎸夋湀
+ targetTable = String.format("pat_med_outhosp_%d%02d", year, month);
+ } else {
+ // 鎸夊搴︼紙8浣嶅悗缂�锛屽 20260103锛�
+ String quarterSuffix;
+ if (month <= 3) quarterSuffix = "0103";
+ else if (month <= 6) quarterSuffix = "0406";
+ else if (month <= 9) quarterSuffix = "0709";
+ else quarterSuffix = "1012";
+ targetTable = "pat_med_outhosp_" + year + quarterSuffix;
+ }
+
+ boolean exists = allTables.contains(targetTable);
+
+ log.info("[璺敱] createTime={} 鈫� 鐩爣琛�={} exists={}", createTime, targetTable, exists);
+ return exists ? targetTable : "pat_med_outhosp";
}
/**
@@ -189,7 +272,8 @@
*/
@Override
public int deletePatMedOuthospByIds(Long[] ids) {
- return patMedOuthospMapper.deletePatMedOuthospByIds(ids);
+// return patMedOuthospMapper.deletePatMedOuthospByIds(ids);
+ return 0;
}
/**
@@ -200,22 +284,26 @@
*/
@Override
public int deletePatMedOuthospById(Long id) {
- return patMedOuthospMapper.deletePatMedOuthospById(id);
+// return patMedOuthospMapper.deletePatMedOuthospById(id);
+ return 0;
}
@Override
public PatMedRes selectPatMedOuthospCount(PatMedReq patMedReq) {
-// // 鑾峰彇褰撳墠鐧婚檰浜虹殑閮ㄩ棬鏉冮檺
-// if (CollectionUtils.isEmpty(patMedReq.getDeptcodeList())) {
-// Long userId = SecurityUtils.getUserId();
-// List<SysDept> sysDepts = sysUserDeptMapper.selectDeptListByUserId(userId);
-// List<String> deptCode = new ArrayList<>();
-// for (SysDept sysDept : sysDepts) {
-// deptCode.add(sysDept.getDeptId().toString());
-// }
-// patMedReq.setDeptcodeList(deptCode);
-// }
- return patMedOuthospMapper.selectPatMedOuthospCount(patMedReq);
+ //鑾峰彇闂ㄨ瘖鐥呬汉淇℃伅锛屽苟缁熻浜烘暟鍜屼汉娆�
+ PatMedOuthospQueryReq req = new PatMedOuthospQueryReq();
+ String deptcodes = CollectionUtils.isEmpty(patMedReq.getDeptcodeList()) ? null : String.join(",", patMedReq.getDeptcodeList());
+ req.setBeginAdmitdate(patMedReq.getStartDate());
+ req.setEndAdmitdate(patMedReq.getEndDate());
+ req.setDeptcode(deptcodes);
+ req.setOrgid(patMedReq.getOrgid());
+// req.setCampusid(patMedReq.getCampusid());
+ Long count = patMedOuthospMapper.callSpQueryOuthospCount(req);
+
+ //鏌ヨ闅忚浜烘鍜屼汉鏁�
+ PatMedRes patMedRes = serviceSubtaskMapper.selectVisitCount(patMedReq);
+ patMedRes.setRc(count == null ? 0 : count.intValue());
+ return patMedRes;
}
@Override
@@ -249,7 +337,7 @@
if (org.apache.commons.collections4.CollectionUtils.isEmpty(serviceTaskdeptList) || serviceTaskdeptList.size() == 0) {
patMedOuthosp1.setDeptcheckFlag("2");
patMedOuthosp1.setRemark("閫氳繃閮ㄩ棬,娌℃湁鎵惧埌闂ㄨ瘖闅忚浠诲姟ID");
- patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
+ updatePatMedOuthosp(patMedOuthosp1);
} else {
for (ServiceTaskdept serviceTaskdept1 : serviceTaskdeptList) {
writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedOuthosp1, patArchive, 1);
@@ -265,7 +353,7 @@
if (org.apache.commons.collections4.CollectionUtils.isEmpty(serviceTaskdiags) || serviceTaskdiags.size() == 0) {
patMedOuthosp1.setDiagcheckFlag("2");
patMedOuthosp1.setRemark("閫氳繃icd10,娌℃湁鎵惧埌闂ㄨ瘖闅忚浠诲姟ID");
- patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
+ updatePatMedOuthosp(patMedOuthosp1);
} else {
for (ServiceTaskdiag serviceTaskdept1 : serviceTaskdiags) {
writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedOuthosp1, patArchive, 2);
@@ -294,7 +382,7 @@
if (type == 1) patMedOuthosp.setDiagcheckFlag("2");
if (type == 2) patMedOuthosp.setDeptcheckFlag("2");
patMedOuthosp.setRemark("璇ユ偅鑰呴棬璇婇殢璁块暱鏈熶换鍔′笉瀛樺湪,浠诲姟ID涓�:" + taskid);
- patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp);
+ updatePatMedOuthosp(patMedOuthosp);
return;
}
ServiceTask serviceTask = serviceTasks.get(0);
@@ -356,16 +444,17 @@
patMedOuthosp1.setId(patMedOuthosp.getId());
if (type == 1) patMedOuthosp1.setDiagcheckFlag("2");
if (type == 2) patMedOuthosp1.setDeptcheckFlag("2");
- patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
+ updatePatMedOuthosp(patMedOuthosp1);
} else {
//鐢熸垚瀛愪换鍔″け璐ワ紝
log.info("鐢熸垚瀛愪换鍔″け璐erviceSubtask鐨則askid涓猴細{},patid涓猴細{}", serviceSubtask.getTaskid(), serviceSubtask.getPatid());
PatMedOuthosp pmo = new PatMedOuthosp();
- pmo.setId(patMedOuthosp.getId());
+ pmo.setGuid(patMedOuthosp.getGuid());
+ pmo.setSerialnum(patMedOuthosp.getSerialnum());
if (type == 1) pmo.setDiagcheckFlag("2");
if (type == 2) pmo.setDeptcheckFlag("2");
pmo.setRemark("鐢熸垚瀛愪换鍔″け璐�");
- patMedOuthospMapper.updatePatMedOuthosp(pmo);
+ updatePatMedOuthosp(pmo);
}
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/PersonWorkbenchServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PersonWorkbenchServiceImpl.java
index 40b2e37..de0b93f 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PersonWorkbenchServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PersonWorkbenchServiceImpl.java
@@ -1,7 +1,10 @@
package com.smartor.service.impl;
+import com.smartor.domain.PatMedOuthosp;
+import com.smartor.domain.PatMedOuthospQueryReq;
import com.smartor.domain.PerSonWorkbenchDto;
import com.smartor.mapper.PatArchiveOutMapper;
+import com.smartor.mapper.PatMedOuthospMapper;
import com.smartor.service.PersonWorkbenchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -20,12 +23,16 @@
@Autowired
private PatArchiveOutMapper patArchiveOutMapper;
+ @Autowired
+ private PatMedOuthospMapper patMedOuthospMapper;
+
@Override
- public List<PerSonWorkbenchDto> getPatCount(String detpId, String drCode) {
- long[] deptIds = Arrays.stream(detpId.split(",")).mapToLong(Long::parseLong).toArray();
+ public List<PerSonWorkbenchDto> getPatCount(String deptcode, String drCode) {
+ List<String> deptIds = Arrays.asList(deptcode.split(","));
String[] drCodes = drCode.split(",");
List<PerSonWorkbenchDto> perSonWorkbenchDtos = patArchiveOutMapper.selectPatArchiveCount(deptIds, drCodes);
+
return perSonWorkbenchDtos;
}
}
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
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
index 2ae5675..936fd83 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -15,6 +15,7 @@
import com.smartor.mapper.*;
import com.smartor.service.IPatArchiveService;
import com.smartor.service.IPatMedInhospService;
+import com.smartor.service.IPatMedOuthospService;
import com.smartor.service.IServiceSLTDHealthcareRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -48,7 +49,7 @@
private IPatMedInhospService patMedInhospService;
@Autowired
- private PatMedOuthospMapper patMedOuthospMapper;
+ private IPatMedOuthospService patMedOuthospService;
@Autowired
private SysUser2Mapper sysUser2Mapper;
@@ -502,19 +503,15 @@
try {
//杩欓噷鐢ㄨ嚜鍔ㄥ拷鐣ラ噸澶嶄細鏈夐棶棰橈紝濡傛灉琛ㄩ噸鏂板缓锛宻erialnum绱㈠紩浼氫涪澶便�傚氨鏃犳硶鍘婚噸锛屾墍浠ヨ繕鏄渶瑕佸唴瀛橀噷鍘婚噸
batchList = DistinctByProperty.distinctByProperty(batchList, PatMedOuthosp::getSerialnum);
- int insertCount = patMedOuthospMapper.batchInsertIgnore(batchList);
+ Integer insertCount = 0;
+ for (PatMedOuthosp patMedOuthosp : batchList) {
+ insertCount += patMedOuthospService.insertPatMedOuthosp(patMedOuthosp);
+ }
+
log.info("鎵归噺鎻掑叆闂ㄦ�ヨ瘖璁板綍锛屾�绘暟锛歿}, 瀹為檯鎻掑叆锛歿}", batchList.size(), insertCount);
} catch (Exception e) {
log.error("鎵归噺鎻掑叆闂ㄦ�ヨ瘖璁板綍澶辫触", e);
- // 闄嶇骇涓洪�愭潯鎻掑叆
- for (PatMedOuthosp patMedOuthosp : batchList) {
- try {
- patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
- } catch (Exception ex) {
- log.warn("鍗曟潯鎻掑叆澶辫触锛歴erialnum={}", patMedOuthosp.getSerialnum());
- }
- }
}
}
return true;
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
index 302bb8b..e050f00 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -325,9 +325,9 @@
if (CollectionUtils.isNotEmpty(patMedInhospList)) patid = patMedInhospList.get(0).getPatid();
} else if (serviceSubTaskMYDAnswerReq.getMzzy().equals("2")) {
//闂ㄨ瘖
- PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
+ PatMedOuthospQueryReq patMedOuthosp = new PatMedOuthospQueryReq();
patMedOuthosp.setSerialnum(serviceSubTaskMYDAnswerReq.getSerialnum());
- patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp);
+ patMedOuthosps = patMedOuthospMapper.callSpQueryOuthosp(patMedOuthosp);
if (CollectionUtils.isNotEmpty(patMedOuthosps)) patid = patMedOuthosps.get(0).getPatid();
} else if (serviceSubTaskMYDAnswerReq.getMzzy().equals("3")) {
//鎸囧畾涓�涓儴闂紝鐢ㄦ潵澶勭悊鎶曡瘔寤鸿
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 85f2ff7..ed24b0b 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -104,10 +104,16 @@
private IServiceOutPathService iServiceOutPathService;
@Autowired
+ private IPatMedOuthospService iPatMedOuthospService;
+
+ @Autowired
private FtpService ftpService;
@Autowired
private PatMedInhospMapper patMedInhospMapper;
+
+ @Autowired
+ private PatMedOuthospMapper patMedOuthospMapper;
@Autowired
private PatArchiveMapper patArchiveMapper;
@@ -315,7 +321,7 @@
List<ServiceSubtaskRes> serviceSubtaskResList = new ArrayList<>();
for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
ServiceSubtaskRes serviceSubtaskRes = DtoConversionUtils.sourceToTarget(serviceSubtask, ServiceSubtaskRes.class);
- if(ObjectUtils.isNotEmpty(serviceSubtask.getContinueContent())){
+ if (ObjectUtils.isNotEmpty(serviceSubtask.getContinueContent())) {
serviceSubtaskRes.setContinueContent(serviceSubtask.getContinueContent());
}
serviceSubtaskResList.add(serviceSubtaskRes);
@@ -621,8 +627,7 @@
serviceTaskdept.setDeptCode(deptCode);
serviceTaskdept.setDeptType("1");
serviceTaskdept.setServiceType(serviceTaskVO.getServiceType());
- //鍏堥�氳繃浠诲姟ID銆侀儴闂╟ode,鍒ゆ柇ServiceTaskdept鏄惁瀛樺湪锛屼笉瀛樺湪鍒欐柊澧烇紝瀛樺湪鍒欎慨鏀�
- serviceTaskdeptService.insertOrUpdateServiceTaskdept(serviceTaskdept);
+ serviceTaskdeptService.insertServiceTaskdept(serviceTaskdept);
}
}
if (StringUtils.isNotEmpty(serviceTaskVO.getLeavehospitaldistrictcode())) {
@@ -631,8 +636,7 @@
serviceTaskdept.setDeptCode(districtcode);
serviceTaskdept.setDeptType("2");
serviceTaskdept.setServiceType(serviceTaskVO.getServiceType());
- //鍏堥�氳繃浠诲姟ID銆侀儴闂╟ode,鍒ゆ柇ServiceTaskdept鏄惁瀛樺湪锛屼笉瀛樺湪鍒欐柊澧烇紝瀛樺湪鍒欎慨鏀�
- serviceTaskdeptService.insertOrUpdateServiceTaskdept(serviceTaskdept);
+ serviceTaskdeptService.insertServiceTaskdept(serviceTaskdept);
}
}
}
@@ -765,8 +769,15 @@
serviceTaskdept.setDeptCode(deptCode);
serviceTaskdept.setDeptType("1");
serviceTaskdept.setServiceType(serviceTaskVO.getServiceType());
- //鍏堥�氳繃浠诲姟ID銆侀儴闂╟ode,鍒ゆ柇ServiceTaskdept鏄惁瀛樺湪锛屼笉瀛樺湪鍒欐柊澧烇紝瀛樺湪鍒欎慨鏀�
- serviceTaskdeptService.insertOrUpdateServiceTaskdept(serviceTaskdept);
+ ServiceTaskdept st = new ServiceTaskdept();
+ st.setDeptCode(deptCode);
+ st.setTaskId(serviceTask.getTaskid());
+ List<ServiceTaskdept> serviceTaskdepts = serviceTaskdeptService.selectServiceTaskdeptList(st);
+ if (CollectionUtils.isEmpty(serviceTaskdepts)) {
+ serviceTaskdeptService.insertServiceTaskdept(serviceTaskdept);
+ } else {
+ serviceTaskdeptService.updateServiceTaskdept(serviceTaskdept);
+ }
}
}
if (StringUtils.isNotEmpty(serviceTaskVO.getLeavehospitaldistrictcode())) {
@@ -781,7 +792,15 @@
serviceTaskdept.setDeptType("2");
serviceTaskdept.setServiceType(serviceTaskVO.getServiceType());
//鍏堥�氳繃浠诲姟ID銆侀儴闂╟ode,鍒ゆ柇ServiceTaskdept鏄惁瀛樺湪锛屼笉瀛樺湪鍒欐柊澧烇紝瀛樺湪鍒欎慨鏀�
- serviceTaskdeptService.insertOrUpdateServiceTaskdept(serviceTaskdept);
+ ServiceTaskdept st = new ServiceTaskdept();
+ st.setDeptCode(districtcode);
+ st.setTaskId(serviceTask.getTaskid());
+ List<ServiceTaskdept> serviceTaskdepts = serviceTaskdeptService.selectServiceTaskdeptList(st);
+ if (CollectionUtils.isEmpty(serviceTaskdepts)) {
+ serviceTaskdeptService.insertServiceTaskdept(serviceTaskdept);
+ } else {
+ serviceTaskdeptService.updateServiceTaskdept(serviceTaskdept);
+ }
}
}
} else if (serviceTaskVO.getAppltype().equals("3")) {
@@ -2183,6 +2202,26 @@
List<ServiceStatisticsResponse> result = serviceSubtaskMapper.getServiceStatistics(request);
+ //鑾峰彇闂ㄦ�ヨ瘖鏁版嵁
+
+ //濉厖闂ㄨ瘖鏁版嵁
+ for (ServiceStatisticsResponse serviceStatisticsResponse : result) {
+ PatMedOuthospQueryReq req = new PatMedOuthospQueryReq();
+ String deptcodes = CollectionUtils.isEmpty(request.getDeptcodes()) ? null : String.join(",", request.getDeptcodes());
+ if (!request.getTimeType().equals("month")) {
+ req.setBeginAdmitdate(DateUtils.parseDate(serviceStatisticsResponse.getTimePeriod()));
+ req.setEndAdmitdate(DateUtils.parseDate(serviceStatisticsResponse.getTimePeriod()));
+ } else {
+ // year 绫诲瀷锛歵imePeriod 鏍煎紡涓� "yyyy-MM"锛屽彇褰撴湀绗竴澶╁拰鏈�鍚庝竴澶�
+ java.time.YearMonth ym = java.time.YearMonth.parse(serviceStatisticsResponse.getTimePeriod());
+ req.setBeginAdmitdate(DateUtils.toDate(ym.atDay(1)));
+ req.setEndAdmitdate(DateUtils.toDate(ym.atEndOfMonth()));
+ }
+ req.setDeptcode(deptcodes);
+ req.setOrgid(request.getOrgid());
+ Long count = patMedOuthospMapper.callSpQueryOuthospCount(req);
+ serviceStatisticsResponse.setPmoCount(count);
+ }
log.info("getServiceStatistics杩斿洖缁撴灉鏁伴噺锛歿}", result.size());
return result;
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
index b341968..4ac0673 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -325,9 +325,9 @@
patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhospList.get(0).getPatid());
}
} else if (StringUtils.isNotEmpty(mzserialnum)) {
- PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
+ PatMedOuthospQueryReq patMedOuthosp = new PatMedOuthospQueryReq();
patMedOuthosp.setSerialnum(mzserialnum);
- List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp);
+ List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.callSpQueryOuthosp(patMedOuthosp);
if (CollectionUtils.isNotEmpty(patMedOuthosps)) {
patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosps.get(0).getPatid());
}
diff --git a/smartor/src/main/resources/mapper/smartor/HeLibraryAssortMapper.xml b/smartor/src/main/resources/mapper/smartor/HeLibraryAssortMapper.xml
index ad40e83..0cac58b 100644
--- a/smartor/src/main/resources/mapper/smartor/HeLibraryAssortMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/HeLibraryAssortMapper.xml
@@ -42,18 +42,17 @@
<select id="selectHeLibraryAssortList" parameterType="com.smartor.domain.HeLibraryAssort"
resultMap="HeLibraryAssortResult">
<include refid="selectHeLibraryAssortVo"/>
- where 1=1
- and del_flag != 1
- <if test="assortname != null and assortname != ''">and assortname like concat('%', #{assortname}, '%')</if>
- <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
- <if test="isupload != null ">and isupload = #{isupload}</if>
- <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
- <if test="pid != null ">and pid = #{pid}</if>
- <if test="guid != null and guid != ''">and guid = #{guid}</if>
- <if test="seqno != null ">and seqno = #{seqno}</if>
- <if test="hetype != null ">and hetype = #{hetype}</if>
-
+ where del_flag != 1
+ <if test="assortname != null and assortname != ''">and assortname like concat('%', #{assortname}, '%')</if>
+ <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
+ <if test="isupload != null ">and isupload = #{isupload}</if>
+ <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+ <if test="pid != null ">and pid = #{pid}</if>
+ <if test="guid != null and guid != ''">and guid = #{guid}</if>
+ <if test="seqno != null ">and seqno = #{seqno}</if>
+ <if test="hetype != null ">and hetype = #{hetype}</if>
order by seqno asc
+ <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
</select>
<select id="selectSeqMax" resultType="integer">
@@ -124,7 +123,7 @@
<update id="deleteHeLibraryAssortById" parameterType="Long">
update he_library_assort
<trim prefix="SET" suffixOverrides=",">
- del_flag = 1
+ del_flag = 1
</trim>
where id = #{id}
</update>
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 0fb3300..0882e3f 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -997,96 +997,96 @@
) as tmp
</select>
- <select id="selectPatArchiveInfoByOuthospQC" parameterType="com.smartor.domain.PatArchiveReq"
- resultMap="PatArchiveOthreInfoResult">
+<!-- <select id="selectPatArchiveInfoByOuthospQC" parameterType="com.smartor.domain.PatArchiveReq"-->
+<!-- resultMap="PatArchiveOthreInfoResult">-->
- select
- a.idcardno,
- a.id,
- a.age_unit,
- a.age_unit2,
- a.patid_his,
- a.sd_flag,
- a.campusid,
- a.patientno,
- a.notrequired_flag,
- a.notrequiredreason,
- d.deptname,
- d.deptcode,
- d.drcode,
- d.drname,
- a.name,
- a.sex,
- a.nation,
- a.native_place,
- a.place_of_residence,
- a.birthplace,
- a.birthdate,
- a.age,
- a.age2,
- a.viptype,
- a.sourcefrom,
- a.archivetime,
- a.archiveby,
- a.telcode,
- a.relativetelcode,
- a.idcardtype,
- a.orgid,
- a.openid,
- a.del_flag,
- a.update_by,
- a.update_time,
- a.create_by,
- a.create_time,
- a.isupload,
- a.upload_time,
- a.filter_drname,
- a.filter_drcode,
- a.pattype
- 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>
- <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
- </select>
+<!-- select-->
+<!-- a.idcardno,-->
+<!-- a.id,-->
+<!-- a.age_unit,-->
+<!-- a.age_unit2,-->
+<!-- a.patid_his,-->
+<!-- a.sd_flag,-->
+<!-- a.campusid,-->
+<!-- a.patientno,-->
+<!-- a.notrequired_flag,-->
+<!-- a.notrequiredreason,-->
+<!-- d.deptname,-->
+<!-- d.deptcode,-->
+<!-- d.drcode,-->
+<!-- d.drname,-->
+<!-- a.name,-->
+<!-- a.sex,-->
+<!-- a.nation,-->
+<!-- a.native_place,-->
+<!-- a.place_of_residence,-->
+<!-- a.birthplace,-->
+<!-- a.birthdate,-->
+<!-- a.age,-->
+<!-- a.age2,-->
+<!-- a.viptype,-->
+<!-- a.sourcefrom,-->
+<!-- a.archivetime,-->
+<!-- a.archiveby,-->
+<!-- a.telcode,-->
+<!-- a.relativetelcode,-->
+<!-- a.idcardtype,-->
+<!-- a.orgid,-->
+<!-- a.openid,-->
+<!-- a.del_flag,-->
+<!-- a.update_by,-->
+<!-- a.update_time,-->
+<!-- a.create_by,-->
+<!-- a.create_time,-->
+<!-- a.isupload,-->
+<!-- a.upload_time,-->
+<!-- a.filter_drname,-->
+<!-- a.filter_drcode,-->
+<!-- a.pattype-->
+<!-- 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>-->
+<!-- <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>-->
+<!-- </select>-->
<select id="selectPatArchiveInfoByPhysicalQC" parameterType="com.smartor.domain.PatArchiveReq"
resultMap="PatArchiveOthreInfoResult">
@@ -1240,37 +1240,37 @@
</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>
+<!-- <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">
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
index 45e43b7..ed9d355 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
@@ -77,33 +77,33 @@
resultMap="PatArchiveOutResult">
<include refid="selectPatArchiveOutVo"/>
where 1=1
- <if test="patientno != null and patientno != ''">and patientno = #{patientno}</if>
- <if test="pattype != null and pattype != ''">and pattype = #{pattype}</if>
- <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
- <if test="sex != null ">and sex = #{sex}</if>
- <if test="nation != null and nation != ''">and nation = #{nation}</if>
- <if test="nativePlace != null and nativePlace != ''">and native_place = #{nativePlace}</if>
- <if test="placeOfResidence != null and placeOfResidence != ''">and place_of_residence =
- #{placeOfResidence}
- </if>
- <if test="birthplace != null and birthplace != ''">and birthplace = #{birthplace}</if>
- <if test="idcardno != null and idcardno != ''">and idcardno = #{idcardno}</if>
- <if test="birthdate != null ">and birthdate = #{birthdate}</if>
- <if test="age != null ">and age = #{age}</if>
- <if test="archivetime != null ">and archivetime = #{archivetime}</if>
- <if test="archiveby != null and archiveby != ''">and archiveby = #{archiveby}</if>
- <if test="telcode != null and telcode != ''">and telcode = #{telcode}</if>
- <if test="relativetelcode != null and relativetelcode != ''">and relativetelcode = #{relativetelcode}</if>
- <if test="idcardtype != null and idcardtype != ''">and idcardtype = #{idcardtype}</if>
- <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
- <if test="openid != null and openid != ''">and openid = #{openid}</if>
- <if test="dduserid != null and dduserid != ''">and dduserid = #{dduserid}</if>
- <if test="source != null ">and source = #{source}</if>
- <if test="isupload != null ">and isupload = #{isupload}</if>
- <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
- <if test="pid != null ">and pid = #{pid}</if>
- <if test="guid != null and guid != ''">and guid = #{guid}</if>
- <if test="membertype != null and membertype != ''">and membertype = #{membertype}</if>
+ <if test="patientno != null and patientno != ''">and patientno = #{patientno}</if>
+ <if test="pattype != null and pattype != ''">and pattype = #{pattype}</if>
+ <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
+ <if test="sex != null ">and sex = #{sex}</if>
+ <if test="nation != null and nation != ''">and nation = #{nation}</if>
+ <if test="nativePlace != null and nativePlace != ''">and native_place = #{nativePlace}</if>
+ <if test="placeOfResidence != null and placeOfResidence != ''">and place_of_residence =
+ #{placeOfResidence}
+ </if>
+ <if test="birthplace != null and birthplace != ''">and birthplace = #{birthplace}</if>
+ <if test="idcardno != null and idcardno != ''">and idcardno = #{idcardno}</if>
+ <if test="birthdate != null ">and birthdate = #{birthdate}</if>
+ <if test="age != null ">and age = #{age}</if>
+ <if test="archivetime != null ">and archivetime = #{archivetime}</if>
+ <if test="archiveby != null and archiveby != ''">and archiveby = #{archiveby}</if>
+ <if test="telcode != null and telcode != ''">and telcode = #{telcode}</if>
+ <if test="relativetelcode != null and relativetelcode != ''">and relativetelcode = #{relativetelcode}</if>
+ <if test="idcardtype != null and idcardtype != ''">and idcardtype = #{idcardtype}</if>
+ <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
+ <if test="openid != null and openid != ''">and openid = #{openid}</if>
+ <if test="dduserid != null and dduserid != ''">and dduserid = #{dduserid}</if>
+ <if test="source != null ">and source = #{source}</if>
+ <if test="isupload != null ">and isupload = #{isupload}</if>
+ <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+ <if test="pid != null ">and pid = #{pid}</if>
+ <if test="guid != null and guid != ''">and guid = #{guid}</if>
+ <if test="membertype != null and membertype != ''">and membertype = #{membertype}</if>
</select>
<select id="selectPatArchiveOutByPatid" parameterType="Long" resultMap="PatArchiveOutResult">
@@ -116,40 +116,37 @@
from (
SELECT "浣忛櫌" as name1, count(1) as count FROM `pat_med_inhosp`
where 1=1
- and del_flag = 0 and endtime = null
- <if test="orgid != null and orgid != ''">
- AND orgid = #{orgid}
- </if>
- <if test="deptIds != null ">and deptId in
- <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
- #{deptId}
- </foreach>
- </if>
- <if test="drCodes != null ">and drcode in
- <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
- #{drCode}
- </foreach>
- </if>
+ and del_flag = 0 and endtime = null
+ <if test="orgid != null and orgid != ''">
+ AND orgid = #{orgid}
+ </if>
+ <if test="deptcodes != null ">and deptcode in
+ <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ <if test="drCodes != null ">and drcode in
+ <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
+ #{drCode}
+ </foreach>
+ </if>
union
select "鍑洪櫌" name1, count(1) as count FROM `pat_med_inhosp`
where 1=1
- and del_flag = 0 and endtime != null
- <if test="orgid != null and orgid != ''">
- AND orgid = #{orgid}
- </if>
- <if test="deptIds != null ">and deptId in
- <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
- #{deptId}
- </foreach>
- </if>
- <if test="drCodes != null ">and drcode in
- <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
- #{drCode}
- </foreach>
- </if>
- union
- select "闂ㄨ瘖" name1, count(1) as count FROM `pat_med_outhosp`
- where del_flag=0
+ and del_flag = 0 and endtime != null
+ <if test="orgid != null and orgid != ''">
+ AND orgid = #{orgid}
+ </if>
+ <if test="deptcodes != null ">and leaveldeptcode in
+ <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ <if test="drCodes != null ">and drcode in
+ <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
+ #{drCode}
+ </foreach>
+ </if>
) aa
</select>
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index 3934f1a..d44dd96 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -215,80 +215,80 @@
LEFT JOIN
pat_archivetag c ON c.patid = a.id AND (c.del_flag = 0 OR c.del_flag IS NULL)
where 1=1
- AND a.del_flag = 0
- AND b.del_flag = 0
- AND a.idcardno IS NOT NULL
- <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') >=
- date_format(#{startOutHospTime},'%y%m%d')
- </if>
- <if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') <=
- date_format(#{endOutHospTime},'%y%m%d')
- </if>
- <if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') >=
- date_format(#{startInHospTime},'%y%m%d')
- </if>
- <if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') <=
- date_format(#{endInHospTime},'%y%m%d')
- </if>
- <if test="hospitalname != null and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
- '%')
- </if>
- <if test="patname != null and patname != ''">and patname like concat('%', #{patname}, '%')</if>
- <if test="hospitaldistrictname != null and hospitaldistrictname != ''">and hospitaldistrictname like
- concat('%', #{hospitaldistrictname}, '%')
- </if>
- <if test="endtime != null ">and b.endtime = #{endtime}</if>
- <if test="managementDoctor != null ">and b.management_doctor = #{managementDoctor}</if>
- <if test="managementDoctorCode != null ">and b.management_doctor_code = #{managementDoctorCode}</if>
- <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
- <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
- <if test="orgid != null ">and b.orgid = #{orgid}</if>
- <if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
- <if test="endtime != null ">and b.endtime = #{endtime}</if>
- <if test="patno != null ">and b.patno = #{patno}</if>
- <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
- <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if>
- <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
- <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
- <if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if>
- <if test="cry != null and cry == 0 ">and b.endtime is null</if>
- <if test="cry != null and cry == 1 ">and b.inhospstate=1</if>
- <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
- <if test="campusid != null ">and b.campusid = #{campusid}</if>
- <if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
- <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
- <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
- <if test="leaveldeptcode != null ">and b.leaveldeptcode = #{leaveldeptcode}</if>
- <if test="leavediagname != null and leavediagname != ''">and b.leavediagname like concat('%',
- #{leavediagname}, '%')
- </if>
- <if test="drname != null and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
- <if test="leaveldeptname != null and leaveldeptname != ''">and b.leaveldeptname like concat('%',
- #{leaveldeptname}, '%')
- </if>
- <if test="deptname != null and deptname != ''">and b.deptname like concat('%',
- #{deptname}, '%')
- </if>
- <if test="patid != null and patid != ''">and a.id =#{patid}
- </if>
- <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and
- b.leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
- </if>
+ AND a.del_flag = 0
+ AND b.del_flag = 0
+ AND a.idcardno IS NOT NULL
+ <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') >=
+ date_format(#{startOutHospTime},'%y%m%d')
+ </if>
+ <if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') <=
+ date_format(#{endOutHospTime},'%y%m%d')
+ </if>
+ <if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') >=
+ date_format(#{startInHospTime},'%y%m%d')
+ </if>
+ <if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') <=
+ date_format(#{endInHospTime},'%y%m%d')
+ </if>
+ <if test="hospitalname != null and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
+ '%')
+ </if>
+ <if test="patname != null and patname != ''">and patname like concat('%', #{patname}, '%')</if>
+ <if test="hospitaldistrictname != null and hospitaldistrictname != ''">and hospitaldistrictname like
+ concat('%', #{hospitaldistrictname}, '%')
+ </if>
+ <if test="endtime != null ">and b.endtime = #{endtime}</if>
+ <if test="managementDoctor != null ">and b.management_doctor = #{managementDoctor}</if>
+ <if test="managementDoctorCode != null ">and b.management_doctor_code = #{managementDoctorCode}</if>
+ <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
+ <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
+ <if test="orgid != null ">and b.orgid = #{orgid}</if>
+ <if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
+ <if test="endtime != null ">and b.endtime = #{endtime}</if>
+ <if test="patno != null ">and b.patno = #{patno}</if>
+ <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
+ <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if>
+ <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
+ <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
+ <if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if>
+ <if test="cry != null and cry == 0 ">and b.endtime is null</if>
+ <if test="cry != null and cry == 1 ">and b.inhospstate=1</if>
+ <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
+ <if test="campusid != null ">and b.campusid = #{campusid}</if>
+ <if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
+ <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
+ <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
+ <if test="leaveldeptcode != null ">and b.leaveldeptcode = #{leaveldeptcode}</if>
+ <if test="leavediagname != null and leavediagname != ''">and b.leavediagname like concat('%',
+ #{leavediagname}, '%')
+ </if>
+ <if test="drname != null and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">and b.leaveldeptname like concat('%',
+ #{leaveldeptname}, '%')
+ </if>
+ <if test="deptname != null and deptname != ''">and b.deptname like concat('%',
+ #{deptname}, '%')
+ </if>
+ <if test="patid != null and patid != ''">and a.id =#{patid}
+ </if>
+ <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and
+ b.leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
+ </if>
- <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
- AND b.leavehospitaldistrictcode IN
- <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
- close=")">
- #{leavehospitaldistrictcode}
- </foreach>
- </if>
- <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
- AND b.leaveldeptcode IN
- <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
- close=")">
- #{leaveldeptcode}
- </foreach>
- </if>
+ <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
+ AND b.leavehospitaldistrictcode IN
+ <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+ close=")">
+ #{leavehospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
+ AND b.leaveldeptcode IN
+ <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
+ close=")">
+ #{leaveldeptcode}
+ </foreach>
+ </if>
GROUP BY
b.inhospid,
a.age,
@@ -854,80 +854,6 @@
</foreach>
</delete>
- <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
- SELECT deptname, COUNT(1) AS rc
- FROM (
- <if test="mz != null">
- SELECT deptname
- FROM pat_med_outhosp
- where 1=1
- and del_flag=0
- <if test="deptcodeList != null and deptcodeList.size() > 0">
- and deptcode in
- <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
- <if test="orgid != null and orgid != ''">
- and orgid = #{orgid}
- </if>
- </if>
- <if test="mz != null and zy != null">
- UNION ALL
- </if>
- <if test="zy != null">
- SELECT deptname
- FROM pat_med_inhosp
- where 1=1
- and del_flag=0
- and inhospstate=0
- <if test="deptcodeList != null and deptcodeList.size() > 0">
- and deptcode in
- <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
- <if test="orgid != null and orgid != ''">
- and orgid = #{orgid}
- </if>
- </if>
- <if test="cy != null and zy != null">
- UNION ALL
- SELECT deptname
- FROM pat_med_inhosp
- where 1=1
- and del_flag=0
- and inhospstate=1
- <if test="deptcodeList != null and deptcodeList.size() > 0">
- and deptcode in
- <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
- <if test="orgid != null and orgid != ''">
- and orgid = #{orgid}
- </if>
- </if>
- <if test="mz != null and zy != null and cy==null">
- UNION ALL
- SELECT deptname
- FROM pat_med_inhosp
- where 1=1
- and del_flag=0
- and inhospstate=1
- <if test="deptcodeList != null and deptcodeList.size() > 0">
- and deptcode in
- <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
- <if test="orgid != null and orgid != ''">
- and orgid = #{orgid}
- </if>
- </if>
- ) AS combined
- GROUP BY deptname;
- </select>
<select id="selectPatMedInhospCount" parameterType="com.smartor.domain.PatMedReq"
resultType="com.smartor.domain.PatMedRes">
SELECT SUM( rs ) AS rs,
@@ -1093,12 +1019,13 @@
<!-- 鏌ヨ涓変釜缁村害浠绘剰涓�涓湭澶勭悊鐨勫嚭闄㈡偅鑰� -->
<select id="selectNeedProcessList" resultMap="PatMedInhospResult">
- SELECT * FROM pat_med_inhosp
+ SELECT *
+ FROM pat_med_inhosp
WHERE inhospstate = '1'
AND fuflag = '1'
AND del_flag = '0'
AND (
- dept_check_flag = '0'
+ dept_check_flag = '0'
OR ward_check_flag = '0'
OR diag_check_flag = '0'
)
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 9b42b4a..8a53951 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -43,482 +43,460 @@
<result property="campusid" column="campusid"/>
</resultMap>
- <sql id="selectPatMedOuthospVo">
- select id,
- outhospno,
- campusid,
- server_state,
- diagcheck_flag,
- patno,
- remark,
- fudate,
- fuflag,
- serialnum,
- patid,
- hospitalname,
- hospitalcode,
- icd10code,
- diagname,
- deptcode,
- deptname,
- drcode,
- drname,
- admitdate,
- orgid,
- del_flag,
- guid,
- update_by,
- update_time,
- create_by,
- create_time,
- isupload,
- upload_time,
- schemestatus,
- deptid,
- schemetime,
- hpi,
- patname,
- mainsuit
- from pat_med_outhosp
- </sql>
+<!-- <sql id="selectPatMedOuthospVo">-->
+<!-- select id,-->
+<!-- outhospno,-->
+<!-- campusid,-->
+<!-- server_state,-->
+<!-- diagcheck_flag,-->
+<!-- patno,-->
+<!-- remark,-->
+<!-- fudate,-->
+<!-- fuflag,-->
+<!-- serialnum,-->
+<!-- patid,-->
+<!-- hospitalname,-->
+<!-- hospitalcode,-->
+<!-- icd10code,-->
+<!-- diagname,-->
+<!-- deptcode,-->
+<!-- deptname,-->
+<!-- drcode,-->
+<!-- drname,-->
+<!-- admitdate,-->
+<!-- orgid,-->
+<!-- del_flag,-->
+<!-- guid,-->
+<!-- update_by,-->
+<!-- update_time,-->
+<!-- create_by,-->
+<!-- create_time,-->
+<!-- isupload,-->
+<!-- upload_time,-->
+<!-- schemestatus,-->
+<!-- deptid,-->
+<!-- schemetime,-->
+<!-- hpi,-->
+<!-- patname,-->
+<!-- mainsuit-->
+<!-- from pat_med_outhosp-->
+<!-- </sql>-->
- <select id="selectPatMedOuthospList" parameterType="com.smartor.domain.PatMedOuthosp"
- resultMap="PatMedOuthospResult">
- select
- pmo.id,
- pmo.outhospno,
- pmo.patno,
- pmo.serialnum,
- pmo.patid,
- pmo.icd10code,
- pmo.diagname,
- pmo.deptcode,
- pmo.deptname,
- pmo.drcode,
- pmo.drname,
- pmo.admitdate,
- pmo.schemestatus,
- pmo.deptid,
- pmo.schemetime,
- pmo.fuflag,
- pmo.patname,
- pmo.update_time,
- pmo.mainsuit
- from pat_med_outhosp pmo
- <where>pmo.del_flag='0'
- <if test="orgid != null ">and pmo.orgid = #{orgid}</if>
- <if test="serialnum != null ">and pmo.serialnum = #{serialnum}</if>
- <if test="serverState != null ">and pmo.server_state = #{serverState}</if>
- <if test="hospitalname != null and hospitalname != ''">and pmo.hospitalname like concat('%',
- #{hospitalname},
- '%')
- </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="deptname != null and deptname != ''">and pmo.deptname like concat('%', #{deptname}, '%')</if>
- <if test="drname != null and drname != ''">and pmo.drname like concat('%', #{drname}, '%')</if>
- <if test="patname != null and patname != ''">and pmo.patname like concat('%', #{patname}, '%')</if>
- <if test="beginTime != null ">and date_format(pmo.admitdate,'%y%m%d') >=
- date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="endTime != null ">and date_format(pmo.admitdate,'%y%m%d') <=
- date_format(#{endTime},'%y%m%d')
- </if>
- <if test="patid != null ">and pmo.patid = #{patid}</if>
- <if test="campusid != null ">and pmo.campusid = #{campusid}</if>
- <if test="fuflag != null ">and pmo.fuflag = #{fuflag}</if>
- <if test="patno != null ">and pmo.patno = #{patno}</if>
- <if test="outhospno != null and outhospno != ''">and pmo.outhospno = #{outhospno}</if>
- <if test="diagcheckFlag != null and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if>
- <if test="diagname != null and diagname != ''">and pmo.diagname like concat('%',#{diagname}, '%')</if>
- </where>
- order by pmo.update_time desc
- <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
- </select>
+ <!-- <select id="selectPatMedOuthospList" parameterType="com.smartor.domain.PatMedOuthosp"-->
+ <!-- resultMap="PatMedOuthospResult">-->
+ <!-- select-->
+ <!-- pmo.id,-->
+ <!-- pmo.outhospno,-->
+ <!-- pmo.patno,-->
+ <!-- pmo.serialnum,-->
+ <!-- pmo.patid,-->
+ <!-- pmo.icd10code,-->
+ <!-- pmo.diagname,-->
+ <!-- pmo.deptcode,-->
+ <!-- pmo.deptname,-->
+ <!-- pmo.drcode,-->
+ <!-- pmo.drname,-->
+ <!-- pmo.admitdate,-->
+ <!-- pmo.schemestatus,-->
+ <!-- pmo.deptid,-->
+ <!-- pmo.schemetime,-->
+ <!-- pmo.fuflag,-->
+ <!-- pmo.patname,-->
+ <!-- pmo.update_time,-->
+ <!-- pmo.mainsuit-->
+ <!-- from pat_med_outhosp pmo-->
+ <!-- <where>pmo.del_flag='0'-->
+ <!-- <if test="orgid != null ">and pmo.orgid = #{orgid}</if>-->
+ <!-- <if test="serialnum != null ">and pmo.serialnum = #{serialnum}</if>-->
+ <!-- <if test="serverState != null ">and pmo.server_state = #{serverState}</if>-->
+ <!-- <if test="hospitalname != null and hospitalname != ''">and pmo.hospitalname like concat('%',-->
+ <!-- #{hospitalname},-->
+ <!-- '%')-->
+ <!-- </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="deptname != null and deptname != ''">and pmo.deptname like concat('%', #{deptname}, '%')</if>-->
+ <!-- <if test="drname != null and drname != ''">and pmo.drname like concat('%', #{drname}, '%')</if>-->
+ <!-- <if test="patname != null and patname != ''">and pmo.patname like concat('%', #{patname}, '%')</if>-->
+ <!-- <if test="beginTime != null ">and date_format(pmo.admitdate,'%y%m%d') >=-->
+ <!-- date_format(#{beginTime},'%y%m%d')-->
+ <!-- </if>-->
+ <!-- <if test="endTime != null ">and date_format(pmo.admitdate,'%y%m%d') <=-->
+ <!-- date_format(#{endTime},'%y%m%d')-->
+ <!-- </if>-->
+ <!-- <if test="patid != null ">and pmo.patid = #{patid}</if>-->
+ <!-- <if test="campusid != null ">and pmo.campusid = #{campusid}</if>-->
+ <!-- <if test="fuflag != null ">and pmo.fuflag = #{fuflag}</if>-->
+ <!-- <if test="patno != null ">and pmo.patno = #{patno}</if>-->
+ <!-- <if test="outhospno != null and outhospno != ''">and pmo.outhospno = #{outhospno}</if>-->
+ <!-- <if test="diagcheckFlag != null and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if>-->
+ <!-- <if test="diagname != null and diagname != ''">and pmo.diagname like concat('%',#{diagname}, '%')</if>-->
+ <!-- </where>-->
+ <!-- order by pmo.update_time desc-->
+ <!-- <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>-->
+ <!-- </select>-->
- <select id="selectPatMedOuthospById" parameterType="Long" resultMap="PatMedOuthospResult">
- <include refid="selectPatMedOuthospVo"/>
- where id = #{id}
- </select>
- <insert id="insertPatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp" useGeneratedKeys="true"
- keyProperty="id">
- insert into pat_med_outhosp
+ <!-- <insert id="insertPatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp" useGeneratedKeys="true"-->
+ <!-- keyProperty="id">-->
+ <!-- insert into pat_med_outhosp-->
+ <!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
+ <!-- <if test="serialnum != null">serialnum,</if>-->
+ <!-- <if test="patid != null">patid,</if>-->
+ <!-- <if test="hospitalname != null">hospitalname,</if>-->
+ <!-- <if test="hospitalcode != null">hospitalcode,</if>-->
+ <!-- <if test="icd10code != null">icd10code,</if>-->
+ <!-- <if test="diagname != null">diagname,</if>-->
+ <!-- <if test="deptcode != null">deptcode,</if>-->
+ <!-- <if test="deptname != null">deptname,</if>-->
+ <!-- <if test="drcode != null">drcode,</if>-->
+ <!-- <if test="drname != null">drname,</if>-->
+ <!-- <if test="admitdate != null">admitdate,</if>-->
+ <!-- <if test="orgid != null">orgid,</if>-->
+ <!-- <if test="delFlag != null and delFlag != ''">del_flag,</if>-->
+ <!-- <if test="updateBy != null">update_by,</if>-->
+ <!-- <if test="updateTime != null">update_time,</if>-->
+ <!-- <if test="createBy != null">create_by,</if>-->
+ <!-- <if test="createTime != null">create_time,</if>-->
+ <!-- <if test="isupload != null">isupload,</if>-->
+ <!-- <if test="uploadTime != null">upload_time,</if>-->
+ <!-- <if test="schemestatus != null">schemestatus,</if>-->
+ <!-- <if test="deptid != null">deptid,</if>-->
+ <!-- <if test="schemetime != null">schemetime,</if>-->
+ <!-- <if test="hpi != null">hpi,</if>-->
+ <!-- <if test="mainsuit != null">mainsuit,</if>-->
+ <!-- <if test="outhospno != null">outhospno,</if>-->
+ <!-- <if test="patname != null">patname,</if>-->
+ <!-- <if test="guid != null">guid,</if>-->
+ <!-- <if test="patno != null">patno,</if>-->
+ <!-- <if test="diagcheckFlag != null">diagcheck_flag,</if>-->
+ <!-- <if test="remark != null">remark,</if>-->
+ <!-- <if test="fuflag != null">fuflag,</if>-->
+ <!-- <if test="fudate != null">fudate,</if>-->
+ <!-- <if test="campusid != null">campusid,</if>-->
+ <!-- <if test="serverState != null">server_state,</if>-->
+ <!-- </trim>-->
+ <!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
+ <!-- <if test="serialnum != null">#{serialnum},</if>-->
+ <!-- <if test="patid != null">#{patid},</if>-->
+ <!-- <if test="hospitalname != null">#{hospitalname},</if>-->
+ <!-- <if test="hospitalcode != null">#{hospitalcode},</if>-->
+ <!-- <if test="icd10code != null">#{icd10code},</if>-->
+ <!-- <if test="diagname != null">#{diagname},</if>-->
+ <!-- <if test="deptcode != null">#{deptcode},</if>-->
+ <!-- <if test="deptname != null">#{deptname},</if>-->
+ <!-- <if test="drcode != null">#{drcode},</if>-->
+ <!-- <if test="drname != null">#{drname},</if>-->
+ <!-- <if test="admitdate != null">#{admitdate},</if>-->
+ <!-- <if test="orgid != null">#{orgid},</if>-->
+ <!-- <if test="delFlag != null and delFlag != ''">#{delFlag},</if>-->
+ <!-- <if test="updateBy != null">#{updateBy},</if>-->
+ <!-- <if test="updateTime != null">#{updateTime},</if>-->
+ <!-- <if test="createBy != null">#{createBy},</if>-->
+ <!-- <if test="createTime != null">#{createTime},</if>-->
+ <!-- <if test="isupload != null">#{isupload},</if>-->
+ <!-- <if test="uploadTime != null">#{uploadTime},</if>-->
+ <!-- <if test="schemestatus != null">#{schemestatus},</if>-->
+ <!-- <if test="deptid != null">#{deptid},</if>-->
+ <!-- <if test="schemetime != null">#{schemetime},</if>-->
+ <!-- <if test="hpi != null">#{hpi},</if>-->
+ <!-- <if test="mainsuit != null">#{mainsuit},</if>-->
+ <!-- <if test="outhospno != null">#{outhospno},</if>-->
+ <!-- <if test="patname != null">#{patname},</if>-->
+ <!-- <if test="guid != null">#{guid},</if>-->
+ <!-- <if test="patno != null">#{patno},</if>-->
+ <!-- <if test="diagcheckFlag != null">#{diagcheckFlag},</if>-->
+ <!-- <if test="remark != null">#{remark},</if>-->
+ <!-- <if test="fuflag != null">#{fuflag},</if>-->
+ <!-- <if test="fudate != null">#{fudate},</if>-->
+ <!-- <if test="campusid != null">#{campusid},</if>-->
+ <!-- <if test="serverState != null">#{serverState},</if>-->
+ <!-- </trim>-->
+ <!-- </insert>-->
+
+ <!-- 鏂板鍒板姩鎬佽〃鍚嶏紙鐢ㄤ簬璺敱鍒版渶鏂板垎琛級 -->
+ <insert id="insertIntoTable" parameterType="map" useGeneratedKeys="true" keyProperty="record.id">
+ insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="serialnum != null">serialnum,</if>
- <if test="patid != null">patid,</if>
- <if test="hospitalname != null">hospitalname,</if>
- <if test="hospitalcode != null">hospitalcode,</if>
- <if test="icd10code != null">icd10code,</if>
- <if test="diagname != null">diagname,</if>
- <if test="deptcode != null">deptcode,</if>
- <if test="deptname != null">deptname,</if>
- <if test="drcode != null">drcode,</if>
- <if test="drname != null">drname,</if>
- <if test="admitdate != null">admitdate,</if>
- <if test="orgid != null">orgid,</if>
- <if test="delFlag != null and delFlag != ''">del_flag,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="isupload != null">isupload,</if>
- <if test="uploadTime != null">upload_time,</if>
- <if test="schemestatus != null">schemestatus,</if>
- <if test="deptid != null">deptid,</if>
- <if test="schemetime != null">schemetime,</if>
- <if test="hpi != null">hpi,</if>
- <if test="mainsuit != null">mainsuit,</if>
- <if test="outhospno != null">outhospno,</if>
- <if test="patname != null">patname,</if>
- <if test="guid != null">guid,</if>
- <if test="patno != null">patno,</if>
- <if test="diagcheckFlag != null">diagcheck_flag,</if>
- <if test="remark != null">remark,</if>
- <if test="fuflag != null">fuflag,</if>
- <if test="fudate != null">fudate,</if>
- <if test="campusid != null">campusid,</if>
- <if test="serverState != null">server_state,</if>
+ <if test="record.serialnum != null">serialnum,</if>
+ <if test="record.patid != null">patid,</if>
+ <if test="record.hospitalname != null">hospitalname,</if>
+ <if test="record.hospitalcode != null">hospitalcode,</if>
+ <if test="record.icd10code != null">icd10code,</if>
+ <if test="record.diagname != null">diagname,</if>
+ <if test="record.deptcode != null">deptcode,</if>
+ <if test="record.deptname != null">deptname,</if>
+ <if test="record.drcode != null">drcode,</if>
+ <if test="record.drname != null">drname,</if>
+ <if test="record.admitdate != null">admitdate,</if>
+ <if test="record.orgid != null">orgid,</if>
+ <if test="record.delFlag != null and record.delFlag != ''">del_flag,</if>
+ <if test="record.updateBy != null">update_by,</if>
+ <if test="record.updateTime != null">update_time,</if>
+ <if test="record.createBy != null">create_by,</if>
+ <if test="record.createTime != null">create_time,</if>
+ <if test="record.isupload != null">isupload,</if>
+ <if test="record.uploadTime != null">upload_time,</if>
+ <if test="record.schemestatus != null">schemestatus,</if>
+ <if test="record.deptid != null">deptid,</if>
+ <if test="record.schemetime != null">schemetime,</if>
+ <if test="record.hpi != null">hpi,</if>
+ <if test="record.mainsuit != null">mainsuit,</if>
+ <if test="record.outhospno != null">outhospno,</if>
+ <if test="record.patname != null">patname,</if>
+ <if test="record.guid != null">guid,</if>
+ <if test="record.patno != null">patno,</if>
+ <if test="record.diagcheckFlag != null">diagcheck_flag,</if>
+ <if test="record.remark != null">remark,</if>
+ <if test="record.fuflag != null">fuflag,</if>
+ <if test="record.fudate != null">fudate,</if>
+ <if test="record.campusid != null">campusid,</if>
+ <if test="record.serverState != null">server_state,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="serialnum != null">#{serialnum},</if>
- <if test="patid != null">#{patid},</if>
- <if test="hospitalname != null">#{hospitalname},</if>
- <if test="hospitalcode != null">#{hospitalcode},</if>
- <if test="icd10code != null">#{icd10code},</if>
- <if test="diagname != null">#{diagname},</if>
- <if test="deptcode != null">#{deptcode},</if>
- <if test="deptname != null">#{deptname},</if>
- <if test="drcode != null">#{drcode},</if>
- <if test="drname != null">#{drname},</if>
- <if test="admitdate != null">#{admitdate},</if>
- <if test="orgid != null">#{orgid},</if>
- <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="isupload != null">#{isupload},</if>
- <if test="uploadTime != null">#{uploadTime},</if>
- <if test="schemestatus != null">#{schemestatus},</if>
- <if test="deptid != null">#{deptid},</if>
- <if test="schemetime != null">#{schemetime},</if>
- <if test="hpi != null">#{hpi},</if>
- <if test="mainsuit != null">#{mainsuit},</if>
- <if test="outhospno != null">#{outhospno},</if>
- <if test="patname != null">#{patname},</if>
- <if test="guid != null">#{guid},</if>
- <if test="patno != null">#{patno},</if>
- <if test="diagcheckFlag != null">#{diagcheckFlag},</if>
- <if test="remark != null">#{remark},</if>
- <if test="fuflag != null">#{fuflag},</if>
- <if test="fudate != null">#{fudate},</if>
- <if test="campusid != null">#{campusid},</if>
- <if test="serverState != null">#{serverState},</if>
+ <if test="record.serialnum != null">#{record.serialnum},</if>
+ <if test="record.patid != null">#{record.patid},</if>
+ <if test="record.hospitalname != null">#{record.hospitalname},</if>
+ <if test="record.hospitalcode != null">#{record.hospitalcode},</if>
+ <if test="record.icd10code != null">#{record.icd10code},</if>
+ <if test="record.diagname != null">#{record.diagname},</if>
+ <if test="record.deptcode != null">#{record.deptcode},</if>
+ <if test="record.deptname != null">#{record.deptname},</if>
+ <if test="record.drcode != null">#{record.drcode},</if>
+ <if test="record.drname != null">#{record.drname},</if>
+ <if test="record.admitdate != null">#{record.admitdate},</if>
+ <if test="record.orgid != null">#{record.orgid},</if>
+ <if test="record.delFlag != null and record.delFlag != ''">#{record.delFlag},</if>
+ <if test="record.updateBy != null">#{record.updateBy},</if>
+ <if test="record.updateTime != null">#{record.updateTime},</if>
+ <if test="record.createBy != null">#{record.createBy},</if>
+ <if test="record.createTime != null">#{record.createTime},</if>
+ <if test="record.isupload != null">#{record.isupload},</if>
+ <if test="record.uploadTime != null">#{record.uploadTime},</if>
+ <if test="record.schemestatus != null">#{record.schemestatus},</if>
+ <if test="record.deptid != null">#{record.deptid},</if>
+ <if test="record.schemetime != null">#{record.schemetime},</if>
+ <if test="record.hpi != null">#{record.hpi},</if>
+ <if test="record.mainsuit != null">#{record.mainsuit},</if>
+ <if test="record.outhospno != null">#{record.outhospno},</if>
+ <if test="record.patname != null">#{record.patname},</if>
+ <if test="record.guid != null">#{record.guid},</if>
+ <if test="record.patno != null">#{record.patno},</if>
+ <if test="record.diagcheckFlag != null">#{record.diagcheckFlag},</if>
+ <if test="record.remark != null">#{record.remark},</if>
+ <if test="record.fuflag != null">#{record.fuflag},</if>
+ <if test="record.fudate != null">#{record.fudate},</if>
+ <if test="record.campusid != null">#{record.campusid},</if>
+ <if test="record.serverState != null">#{record.serverState},</if>
</trim>
</insert>
- <insert id="batchPatMedOuthosp">
- insert into pat_med_outhosp
- (
- serialnum,
- patid,
- hospitalname,
- hospitalcode,
- icd10code,
- diagname,
- deptcode,
- deptname,
- drcode,
- drname,
- admitdate,
- orgid,
- del_flag,
- update_by,
- update_time,
- create_by,
- create_time,
- isupload,
- upload_time,
- schemestatus,
- deptid,
- schemetime,
- hpi,
- mainsuit,
- outhospno,
- patname,
- guid,
- patno,
- diagcheck_flag,
- fuflag,
- fudate,
- campusid,
- server_state,
- remark)
- values
- <foreach collection="list" item="item" separator=",">
- (
- #{item.serialnum},
- #{item.patid},
- #{item.hospitalname},
- #{item.hospitalcode},
- #{item.icd10code},
- #{item.diagname},
- #{item.deptcode},
- #{item.deptname},
- #{item.drcode},
- #{item.drname},
- #{item.admitdate},
- #{item.orgid},
- #{item.delFlag},
- #{item.updateBy},
- #{item.updateTime},
- #{item.createBy},
- #{item.createTime},
- #{item.isupload},
- #{item.uploadTime},
- #{item.schemestatus},
- #{item.deptid},
- #{item.schemetime},
- #{item.hpi},
- #{item.mainsuit},
- #{item.outhospno},
- #{item.patname},
- #{item.guid},
- #{item.patno},
- #{item.diagcheckFlag},
- #{item.fuflag},
- #{item.fudate},
- #{item.campusid},
- #{item.serverState},
- #{item.remark}
- )
- </foreach>
- </insert>
-
- <insert id="batchInsertIgnore">
- insert ignore into pat_med_outhosp
- (
- serialnum,
- patid,
- hospitalname,
- hospitalcode,
- icd10code,
- diagname,
- deptcode,
- deptname,
- drcode,
- drname,
- admitdate,
- orgid,
- del_flag,
- update_by,
- update_time,
- create_by,
- create_time,
- isupload,
- upload_time,
- schemestatus,
- deptid,
- schemetime,
- hpi,
- mainsuit,
- outhospno,
- patname,
- guid,
- patno,
- diagcheck_flag,
- fuflag,
- fudate,
- campusid,
- server_state,
- remark)
- values
- <foreach collection="list" item="item" separator=",">
- (
- #{item.serialnum},
- #{item.patid},
- #{item.hospitalname},
- #{item.hospitalcode},
- #{item.icd10code},
- #{item.diagname},
- #{item.deptcode},
- #{item.deptname},
- #{item.drcode},
- #{item.drname},
- #{item.admitdate},
- #{item.orgid},
- #{item.delFlag},
- #{item.updateBy},
- #{item.updateTime},
- #{item.createBy},
- #{item.createTime},
- #{item.isupload},
- #{item.uploadTime},
- #{item.schemestatus},
- #{item.deptid},
- #{item.schemetime},
- #{item.hpi},
- #{item.mainsuit},
- #{item.outhospno},
- #{item.patname},
- #{item.guid},
- #{item.patno},
- #{item.diagcheckFlag},
- #{item.fuflag},
- #{item.fudate},
- #{item.campusid},
- #{item.serverState},
- #{item.remark}
- )
- </foreach>
- </insert>
- <update id="updatePatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp">
- update pat_med_outhosp
- <trim prefix="SET" suffixOverrides=",">
- <if test="serialnum != null">serialnum = #{serialnum},</if>
- <if test="patid != null">patid = #{patid},</if>
- <if test="hospitalname != null">hospitalname = #{hospitalname},</if>
- <if test="hospitalcode != null">hospitalcode = #{hospitalcode},</if>
- <if test="icd10code != null">icd10code = #{icd10code},</if>
- <if test="diagname != null">diagname = #{diagname},</if>
- <if test="deptcode != null">deptcode = #{deptcode},</if>
- <if test="deptname != null">deptname = #{deptname},</if>
- <if test="drcode != null">drcode = #{drcode},</if>
- <if test="drname != null">drname = #{drname},</if>
- <if test="admitdate != null">admitdate = #{admitdate},</if>
- <if test="orgid != null">orgid = #{orgid},</if>
- <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="isupload != null">isupload = #{isupload},</if>
- <if test="uploadTime != null">upload_time = #{uploadTime},</if>
- <if test="schemestatus != null">schemestatus = #{schemestatus},</if>
- <if test="deptid != null">deptid = #{deptid},</if>
- <if test="schemetime != null">schemetime = #{schemetime},</if>
- <if test="hpi != null">hpi = #{hpi},</if>
- <if test="mainsuit != null">mainsuit = #{mainsuit},</if>
- <if test="outhospno != null">outhospno = #{outhospno},</if>
- <if test="patname != null">patname = #{patname},</if>
- <if test="guid != null">guid = #{guid},</if>
- <if test="patno != null">patno = #{patno},</if>
- <if test="diagcheckFlag != null">diagcheck_flag = #{diagcheckFlag},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="fuflag != null">fuflag = #{fuflag},</if>
- <if test="fudate != null">fudate = #{fudate},</if>
- <if test="campusid != null">campusid = #{campusid},</if>
- <if test="serverState != null">server_state = #{serverState},</if>
- </trim>
- where id = #{id}
+
+ <!-- <update id="updatePatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp">-->
+ <!-- update pat_med_outhosp-->
+ <!-- <trim prefix="SET" suffixOverrides=",">-->
+ <!-- <if test="serialnum != null">serialnum = #{serialnum},</if>-->
+ <!-- <if test="patid != null">patid = #{patid},</if>-->
+ <!-- <if test="hospitalname != null">hospitalname = #{hospitalname},</if>-->
+ <!-- <if test="hospitalcode != null">hospitalcode = #{hospitalcode},</if>-->
+ <!-- <if test="icd10code != null">icd10code = #{icd10code},</if>-->
+ <!-- <if test="diagname != null">diagname = #{diagname},</if>-->
+ <!-- <if test="deptcode != null">deptcode = #{deptcode},</if>-->
+ <!-- <if test="deptname != null">deptname = #{deptname},</if>-->
+ <!-- <if test="drcode != null">drcode = #{drcode},</if>-->
+ <!-- <if test="drname != null">drname = #{drname},</if>-->
+ <!-- <if test="admitdate != null">admitdate = #{admitdate},</if>-->
+ <!-- <if test="orgid != null">orgid = #{orgid},</if>-->
+ <!-- <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>-->
+ <!-- <if test="updateBy != null">update_by = #{updateBy},</if>-->
+ <!-- <if test="updateTime != null">update_time = #{updateTime},</if>-->
+ <!-- <if test="createBy != null">create_by = #{createBy},</if>-->
+ <!-- <if test="createTime != null">create_time = #{createTime},</if>-->
+ <!-- <if test="isupload != null">isupload = #{isupload},</if>-->
+ <!-- <if test="uploadTime != null">upload_time = #{uploadTime},</if>-->
+ <!-- <if test="schemestatus != null">schemestatus = #{schemestatus},</if>-->
+ <!-- <if test="deptid != null">deptid = #{deptid},</if>-->
+ <!-- <if test="schemetime != null">schemetime = #{schemetime},</if>-->
+ <!-- <if test="hpi != null">hpi = #{hpi},</if>-->
+ <!-- <if test="mainsuit != null">mainsuit = #{mainsuit},</if>-->
+ <!-- <if test="outhospno != null">outhospno = #{outhospno},</if>-->
+ <!-- <if test="patname != null">patname = #{patname},</if>-->
+ <!-- <if test="guid != null">guid = #{guid},</if>-->
+ <!-- <if test="patno != null">patno = #{patno},</if>-->
+ <!-- <if test="diagcheckFlag != null">diagcheck_flag = #{diagcheckFlag},</if>-->
+ <!-- <if test="remark != null">remark = #{remark},</if>-->
+ <!-- <if test="fuflag != null">fuflag = #{fuflag},</if>-->
+ <!-- <if test="fudate != null">fudate = #{fudate},</if>-->
+ <!-- <if test="campusid != null">campusid = #{campusid},</if>-->
+ <!-- <if test="serverState != null">server_state = #{serverState},</if>-->
+ <!-- </trim>-->
+ <!-- where id = #{id}-->
+ <!-- </update>-->
+
+
+ <select id="getTableColumns" resultType="String">
+ SELECT column_name
+ FROM information_schema.columns
+ WHERE table_schema = DATABASE()
+ AND table_name = #{tableName}
+ ORDER BY ordinal_position
+ </select>
+
+ <select id="getTableColumnMeta" resultType="java.util.HashMap">
+ SELECT column_name AS column_name,
+ data_type AS data_type,
+ column_type AS column_type
+ FROM information_schema.columns
+ WHERE table_schema = DATABASE()
+ AND table_name = #{tableName}
+ ORDER BY ordinal_position
+ </select>
+
+ <update id="createOrReplaceProcedure">
+ ${procSql}
</update>
- <delete id="deletePatMedOuthospById" parameterType="Long">
- delete
- from pat_med_outhosp
- where id = #{id}
- </delete>
-
- <delete id="deletePatMedOuthospByIds" parameterType="String">
- delete from pat_med_outhosp where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
-
- <select id="selectPatMedOuthospCount" parameterType="com.smartor.domain.PatMedReq"
- resultType="com.smartor.domain.PatMedRes">
- SELECT SUM( rs ) AS rs,
- SUM( rc ) AS rc
- FROM (
- SELECT
- COUNT(id) AS rc,
- 0 AS rs
- FROM
- pat_med_outhosp
- where 1=1
- and del_flag = 0
- <if test="orgid != null">
- and orgid = #{orgid}
- </if>
- and date_format(admitdate,'%y%m%d') >= date_format(#{startDate},'%y%m%d')
- and date_format(admitdate,'%y%m%d') <= date_format(#{endDate},'%y%m%d')
- <if test="deptcodeList != null and deptcodeList.size()>0">
- and deptcode in
- <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
- union all
- select
- 0 AS rc,
- count(1) AS rs
- FROM
- service_subtask
- where 1=1
- and del_flag = 0
- and service_type=3
- <if test="orgid != null">
- and orgid = #{orgid}
- </if>
- <if test="startDate != null">
- AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' )
- </if>
- <if test="endDate != null">
- AND date_format( visit_time, '%y%m%d' ) <= date_format(#{endDate},'%y%m%d')
- </if>
- <if test="deptcodeList != null and deptcodeList.size()>0">
- and deptcode in
- <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
- ) AS combined_data
+ <!-- 璋冪敤瀛樺偍杩囩▼ sp_query_outhosp 鏌ヨ闂ㄨ瘖璁板綍 -->
+ <select id="callSpQueryOuthosp" parameterType="com.smartor.domain.PatMedOuthospQueryReq"
+ resultType="com.smartor.domain.PatMedOuthosp"
+ statementType="CALLABLE">
+ {CALL sp_query_outhosp(
+ #{outhospno, jdbcType=VARCHAR, mode=IN},
+ #{serialnum, jdbcType=VARCHAR, mode=IN},
+ #{patid, jdbcType=BIGINT, mode=IN},
+ #{patname, jdbcType=VARCHAR, mode=IN},
+ #{patno, jdbcType=VARCHAR, mode=IN},
+ #{hospitalname, jdbcType=VARCHAR, mode=IN},
+ #{hospitalcode, jdbcType=VARCHAR, mode=IN},
+ #{icd10code, jdbcType=VARCHAR, mode=IN},
+ #{diagname, jdbcType=VARCHAR, mode=IN},
+ #{deptid, jdbcType=BIGINT, mode=IN},
+ #{deptcode, jdbcType=VARCHAR, mode=IN},
+ #{deptname, jdbcType=VARCHAR, mode=IN},
+ #{drcode, jdbcType=VARCHAR, mode=IN},
+ #{drname, jdbcType=VARCHAR, mode=IN},
+ #{beginAdmitdate,jdbcType=DATE, mode=IN},
+ #{endAdmitdate, jdbcType=DATE, mode=IN},
+ #{orgid, jdbcType=VARCHAR, mode=IN},
+ #{isupload, jdbcType=BIGINT, mode=IN},
+ #{schemestatus, jdbcType=BIGINT, mode=IN},
+ #{hpi, jdbcType=VARCHAR, mode=IN},
+ #{mainsuit, jdbcType=VARCHAR, mode=IN},
+ #{pid, jdbcType=INTEGER, mode=IN},
+ #{guid, jdbcType=VARCHAR, mode=IN},
+ #{pguid, jdbcType=VARCHAR, mode=IN},
+ #{hospitaldistrictcode, jdbcType=VARCHAR, mode=IN},
+ #{hospitaldistrictname, jdbcType=VARCHAR, mode=IN},
+ #{diagcheckFlag, jdbcType=VARCHAR, mode=IN},
+ #{fuflag, jdbcType=VARCHAR, mode=IN},
+ #{campusid, jdbcType=VARCHAR, mode=IN},
+ #{serverState, jdbcType=VARCHAR, mode=IN}
+ #{pageSize, jdbcType=INTEGER, mode=IN},
+ #{pageNum, jdbcType=INTEGER, mode=IN}
+ )}
</select>
- <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
- SELECT deptname, COUNT(1) AS rc
- FROM pat_med_outhosp
- where 1=1
- and del_flag = 0
- <if test="orgid != null and orgid != ''">
- and orgid = #{orgid}
- </if>
- <if test="inhospstate != null">
- and inhospstate= #{inhospstate}
- </if>
- <if test="serverState != null">
- and server_state= #{inhospstate}
- </if>
- <if test="deptcodeList != null and deptcodeList.size()>0">
- and deptcode in
- <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
+
+ <select id="callSpQueryOuthospCount" parameterType="com.smartor.domain.PatMedOuthospQueryReq"
+ resultType="Long"
+ statementType="CALLABLE">
+ {CALL sp_count_outhosp(
+ #{outhospno, jdbcType=VARCHAR, mode=IN},
+ #{serialnum, jdbcType=VARCHAR, mode=IN},
+ #{patid, jdbcType=BIGINT, mode=IN},
+ #{patname, jdbcType=VARCHAR, mode=IN},
+ #{patno, jdbcType=VARCHAR, mode=IN},
+ #{hospitalname, jdbcType=VARCHAR, mode=IN},
+ #{hospitalcode, jdbcType=VARCHAR, mode=IN},
+ #{icd10code, jdbcType=VARCHAR, mode=IN},
+ #{diagname, jdbcType=VARCHAR, mode=IN},
+ #{deptid, jdbcType=BIGINT, mode=IN},
+ #{deptcode, jdbcType=VARCHAR, mode=IN},
+ #{deptname, jdbcType=VARCHAR, mode=IN},
+ #{drcode, jdbcType=VARCHAR, mode=IN},
+ #{drname, jdbcType=VARCHAR, mode=IN},
+ #{beginAdmitdate,jdbcType=DATE, mode=IN},
+ #{endAdmitdate, jdbcType=DATE, mode=IN},
+ #{orgid, jdbcType=VARCHAR, mode=IN},
+ #{isupload, jdbcType=BIGINT, mode=IN},
+ #{schemestatus, jdbcType=BIGINT, mode=IN},
+ #{hpi, jdbcType=VARCHAR, mode=IN},
+ #{mainsuit, jdbcType=VARCHAR, mode=IN},
+ #{pid, jdbcType=INTEGER, mode=IN},
+ #{guid, jdbcType=VARCHAR, mode=IN},
+ #{pguid, jdbcType=VARCHAR, mode=IN},
+ #{hospitaldistrictcode, jdbcType=VARCHAR, mode=IN},
+ #{hospitaldistrictname, jdbcType=VARCHAR, mode=IN},
+ #{diagcheckFlag, jdbcType=VARCHAR, mode=IN},
+ #{fuflag, jdbcType=VARCHAR, mode=IN},
+ #{campusid, jdbcType=VARCHAR, mode=IN},
+ #{serverState, jdbcType=VARCHAR, mode=IN}
+ )}
</select>
- <!-- PatMedOuthospMapper.xml -->
- <select id="countPatMedOuthosp" resultType="int">
+ <select id="existsInTable" resultType="int">
SELECT COUNT(*)
- FROM pat_med_outhosp
+ FROM ${tableName}
+ WHERE id = #{id}
</select>
- <update id="renameTable">
- RENAME
- TABLE
- ${oldName}
- TO
- ${newName}
+ <update id="updateInTable" parameterType="map">
+ update ${tableName}
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="record.serialnum != null">serialnum = #{record.serialnum},</if>
+ <if test="record.patid != null">patid = #{record.patid},</if>
+ <if test="record.hospitalname != null">hospitalname = #{record.hospitalname},</if>
+ <if test="record.hospitalcode != null">hospitalcode = #{record.hospitalcode},</if>
+ <if test="record.icd10code != null">icd10code = #{record.icd10code},</if>
+ <if test="record.diagname != null">diagname = #{record.diagname},</if>
+ <if test="record.deptcode != null">deptcode = #{record.deptcode},</if>
+ <if test="record.deptname != null">deptname = #{record.deptname},</if>
+ <if test="record.drcode != null">drcode = #{record.drcode},</if>
+ <if test="record.drname != null">drname = #{record.drname},</if>
+ <if test="record.admitdate != null">admitdate = #{record.admitdate},</if>
+ <if test="record.orgid != null">orgid = #{record.orgid},</if>
+ <if test="record.delFlag != null and record.delFlag != ''">del_flag = #{record.delFlag},</if>
+ <if test="record.updateBy != null">update_by = #{record.updateBy},</if>
+ <if test="record.updateTime != null">update_time = #{record.updateTime},</if>
+ <if test="record.createBy != null">create_by = #{record.createBy},</if>
+ <if test="record.createTime != null">create_time = #{record.createTime},</if>
+ <if test="record.isupload != null">isupload = #{record.isupload},</if>
+ <if test="record.uploadTime != null">upload_time = #{record.uploadTime},</if>
+ <if test="record.schemestatus != null">schemestatus = #{record.schemestatus},</if>
+ <if test="record.deptid != null">deptid = #{record.deptid},</if>
+ <if test="record.schemetime != null">schemetime = #{record.schemetime},</if>
+ <if test="record.hpi != null">hpi = #{record.hpi},</if>
+ <if test="record.mainsuit != null">mainsuit = #{record.mainsuit},</if>
+ <if test="record.outhospno != null">outhospno = #{record.outhospno},</if>
+ <if test="record.patname != null">patname = #{record.patname},</if>
+ <if test="record.guid != null">guid = #{record.guid},</if>
+ <if test="record.patno != null">patno = #{record.patno},</if>
+ <if test="record.diagcheckFlag != null">diagcheck_flag = #{record.diagcheckFlag},</if>
+ <if test="record.remark != null">remark = #{record.remark},</if>
+ <if test="record.fuflag != null">fuflag = #{record.fuflag},</if>
+ <if test="record.fudate != null">fudate = #{record.fudate},</if>
+ <if test="record.campusid != null">campusid = #{record.campusid},</if>
+ <if test="record.serverState != null">server_state = #{record.serverState},</if>
+ </trim>
+ <where>del_flag=0
+ <if test="record.guid != null">and guid = #{record.guid}</if>
+ <if test="record.serialnum != null">and serialnum = #{record.serialnum}</if>
+ </where>
</update>
+
+ <select id="tableExists" resultType="int">
+ SELECT COUNT(*)
+ FROM information_schema.tables
+ WHERE table_schema = DATABASE()
+ AND table_name = #{tableName}
+ </select>
<update id="createPatMedOuthosp">
CREATE TABLE ${newName} LIKE ${templateName}
@@ -538,14 +516,4 @@
WHERE table_schema = DATABASE()
AND table_name LIKE 'pat_med_outhosp%'
</select>
-
- <select id="getMaxIdFromTable" resultType="Long">
- SELECT IFNULL(MAX(id), 0)
- FROM ${tableName}
- </select>
-
- <update id="createOrReplaceView">
- ${viewSql}
- </update>
-
</mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 2a698b7..c28555d 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1927,25 +1927,6 @@
</foreach>
</if>
- <!-- GROUP BY-->
- <!-- <choose>-->
- <!-- <when test="timeType == 'day'">-->
- <!-- DATE_FORMAT(visit_time, '%Y-%m-%d')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'month'">-->
- <!-- DATE_FORMAT(visit_time, '%Y-%m')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'year'">-->
- <!-- DATE_FORMAT(visit_time, '%Y')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'week'">-->
- <!-- CONCAT(YEAR(visit_time), '-W', LPAD(WEEK(visit_time, 1), 2, '0'))-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- DATE_FORMAT(visit_time, '%Y-%m-%d')-->
- <!-- </otherwise>-->
- <!-- </choose>-->
-
UNION ALL
-- 鍑洪櫌浜烘鏁版嵁
@@ -1997,85 +1978,48 @@
</foreach>
</if>
- <!-- GROUP BY-->
- <!-- <choose>-->
- <!-- <when test="timeType == 'day'">-->
- <!-- DATE_FORMAT(endtime, '%Y-%m-%d')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'month'">-->
- <!-- DATE_FORMAT(endtime, '%Y-%m')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'year'">-->
- <!-- DATE_FORMAT(endtime, '%Y')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'week'">-->
- <!-- CONCAT(YEAR(endtime), '-W', LPAD(WEEK(endtime, 1), 2, '0'))-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- DATE_FORMAT(endtime, '%Y-%m-%d')-->
- <!-- </otherwise>-->
- <!-- </choose>-->
+<!-- UNION ALL-->
- UNION ALL
+<!-- -- 闂ㄨ瘖浜烘鏁版嵁-->
+<!-- SELECT-->
+<!-- <choose>-->
+<!-- <when test="timeType == 'day'">-->
+<!-- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
+<!-- </when>-->
+<!-- <when test="timeType == 'month'">-->
+<!-- DATE_FORMAT(admitdate, '%Y-%m') AS timePeriod,-->
+<!-- </when>-->
+<!-- <when test="timeType == 'year'">-->
+<!-- DATE_FORMAT(admitdate, '%Y') AS timePeriod,-->
+<!-- </when>-->
+<!-- <when test="timeType == 'week'">-->
+<!-- CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0')) AS timePeriod,-->
+<!-- </when>-->
+<!-- <otherwise>-->
+<!-- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
+<!-- </otherwise>-->
+<!-- </choose>-->
+<!-- 0 AS dischargeFollowCount,-->
+<!-- 0 AS outpatientFollowCount,-->
+<!-- 0 AS pmiCount,-->
+<!-- 1 AS pmoCount-->
+<!-- FROM pat_med_outhosp-->
+<!-- WHERE del_flag = '0'-->
+<!-- <if test="startDate != null and endDate != null">-->
+<!-- AND admitdate >= #{startDate}-->
+<!-- AND admitdate <= DATE_ADD(#{endDate}, INTERVAL 1 DAY)-->
+<!-- </if>-->
+<!-- <if test="orgid != null">-->
+<!-- AND orgid = #{orgid}-->
+<!-- </if>-->
- -- 闂ㄨ瘖浜烘鏁版嵁
- SELECT
- <choose>
- <when test="timeType == 'day'">
- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,
- </when>
- <when test="timeType == 'month'">
- DATE_FORMAT(admitdate, '%Y-%m') AS timePeriod,
- </when>
- <when test="timeType == 'year'">
- DATE_FORMAT(admitdate, '%Y') AS timePeriod,
- </when>
- <when test="timeType == 'week'">
- CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0')) AS timePeriod,
- </when>
- <otherwise>
- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,
- </otherwise>
- </choose>
- 0 AS dischargeFollowCount,
- 0 AS outpatientFollowCount,
- 0 AS pmiCount,
- 1 AS pmoCount
- FROM pat_med_outhosp
- WHERE del_flag = '0'
- <if test="startDate != null and endDate != null">
- AND admitdate >= #{startDate}
- AND admitdate <= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
- </if>
- <if test="orgid != null">
- AND orgid = #{orgid}
- </if>
+<!-- <if test="deptcodes != null and deptcodes.size() > 0">-->
+<!-- AND deptcode IN-->
+<!-- <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">-->
+<!-- #{deptcode}-->
+<!-- </foreach>-->
+<!-- </if>-->
- <if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
- <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
-
- <!-- GROUP BY-->
- <!-- <choose>-->
- <!-- <when test="timeType == 'day'">-->
- <!-- DATE_FORMAT(admitdate, '%Y-%m-%d')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'month'">-->
- <!-- DATE_FORMAT(admitdate, '%Y-%m')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'year'">-->
- <!-- DATE_FORMAT(admitdate, '%Y')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'week'">-->
- <!-- CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0'))-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- DATE_FORMAT(admitdate, '%Y-%m-%d')-->
- <!-- </otherwise>-->
- <!-- </choose>-->
) AS combined_data
GROUP BY timePeriod
ORDER BY timePeriod DESC
@@ -2265,6 +2209,34 @@
</if>
</select>
+
+ <select id="selectVisitCount" parameterType="com.smartor.domain.PatMedReq"
+ resultType="com.smartor.domain.PatMedRes">
+ select
+ 0 AS rc,
+ count(1) AS rs
+ FROM
+ service_subtask
+ where 1=1
+ and del_flag = 0
+ and service_type=3
+ <if test="orgid != null">
+ and orgid = #{orgid}
+ </if>
+ <if test="startDate != null">
+ AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' )
+ </if>
+ <if test="endDate != null">
+ AND date_format( visit_time, '%y%m%d' ) <= date_format(#{endDate},'%y%m%d')
+ </if>
+ <if test="deptcodeList != null and deptcodeList.size()>0">
+ and deptcode in
+ <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ </select>
+
<select id="getCurrentUserServiceSubtaskCount" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" resultType="map">
SELECT
COUNT(CASE WHEN sendstate = 2 AND date_format(visit_time,'%y%m%d') <= date_format(CURDATE(),'%y%m%d') THEN 1 END) AS pendingVisitCount,
--
Gitblit v1.9.3