From 1577fd7ee29d1b0b7eea979264d5dcdbeab52743 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 15 五月 2026 13:42:48 +0800
Subject: [PATCH] 1首先执行 2次要执行 如果设置了1,只生成1的,2的不生成;如果1的没有生成成功,才会生成2
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskRuleController.java | 118 ++++++
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java | 293 +++++++++++++++-
smartor/src/main/java/com/smartor/service/IServiceTaskRuleService.java | 61 +++
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml | 37 +-
smartor/src/main/java/com/smartor/service/impl/ServiceTaskRuleServiceImpl.java | 96 +++++
smartor/src/main/resources/mapper/smartor/ServiceTaskRuleMapper.xml | 263 ++++++++++++++
smartor/src/main/java/com/smartor/domain/ServiceTaskRule.java | 100 +++++
smartor/src/main/java/com/smartor/mapper/ServiceTaskRuleMapper.java | 71 +++
8 files changed, 998 insertions(+), 41 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskRuleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskRuleController.java
new file mode 100644
index 0000000..97d4331
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskRuleController.java
@@ -0,0 +1,118 @@
+package com.ruoyi.web.controller.smartor;
+
+import java.util.List;
+
+import com.ruoyi.common.annotation.AddOrgId;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.smartor.domain.ServiceTaskRule;
+import com.smartor.service.IServiceTaskRuleService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 浠诲姟鎵ц瑙勫垯Controller
+ *
+ * @author lihu
+ * @date 2026-05-15
+ */
+@Api("浠诲姟鎵ц瑙勫垯")
+@RestController
+@RequestMapping("/smartor/taskrule")
+public class ServiceTaskRuleController extends BaseController
+{
+ @Autowired
+ private IServiceTaskRuleService serviceTaskRuleService;
+
+ /**
+ * 鏌ヨ浠诲姟鎵ц瑙勫垯鍒楄〃
+ */
+ @ApiOperation("鏌ヨ浠诲姟鎵ц瑙勫垯鍒楄〃")
+ //@PreAuthorize("@ss.hasPermi('smartor:rule:list')")
+ @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
+ @PostMapping("/list")
+ public TableDataInfo list(@RequestBody ServiceTaskRule serviceTaskRule)
+ {
+ startPage();
+ List<ServiceTaskRule> list = serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭浠诲姟鎵ц瑙勫垯鍒楄〃
+ */
+ @ApiOperation("瀵煎嚭浠诲姟鎵ц瑙勫垯鍒楄〃")
+ //@PreAuthorize("@ss.hasPermi('smartor:rule:export')")
+ @Log(title = "浠诲姟鎵ц瑙勫垯", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ServiceTaskRule serviceTaskRule)
+ {
+ List<ServiceTaskRule> list = serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule);
+ ExcelUtil<ServiceTaskRule> util = new ExcelUtil<ServiceTaskRule>(ServiceTaskRule.class);
+ util.exportExcel(response, list, "浠诲姟鎵ц瑙勫垯鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇浠诲姟鎵ц瑙勫垯璇︾粏淇℃伅
+ */
+ @ApiOperation("鑾峰彇浠诲姟鎵ц瑙勫垯璇︾粏淇℃伅")
+ //@PreAuthorize("@ss.hasPermi('smartor:rule:query')")
+ @GetMapping(value = "/getInfo/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(serviceTaskRuleService.selectServiceTaskRuleById(id));
+ }
+
+ /**
+ * 鏂板浠诲姟鎵ц瑙勫垯
+ */
+ @ApiOperation("鏂板浠诲姟鎵ц瑙勫垯")
+ //@PreAuthorize("@ss.hasPermi('smartor:rule:add')")
+ @Log(title = "浠诲姟鎵ц瑙勫垯", businessType = BusinessType.INSERT)
+ @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
+ @PostMapping("/add")
+ public AjaxResult add(@RequestBody ServiceTaskRule serviceTaskRule)
+ {
+ return toAjax(serviceTaskRuleService.insertServiceTaskRule(serviceTaskRule));
+ }
+
+ /**
+ * 淇敼浠诲姟鎵ц瑙勫垯
+ */
+ @ApiOperation("淇敼浠诲姟鎵ц瑙勫垯")
+ //@PreAuthorize("@ss.hasPermi('smartor:rule:edit')")
+ @Log(title = "浠诲姟鎵ц瑙勫垯", businessType = BusinessType.UPDATE)
+ @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
+ @PostMapping("/edit")
+ public AjaxResult edit(@RequestBody ServiceTaskRule serviceTaskRule)
+ {
+ return toAjax(serviceTaskRuleService.updateServiceTaskRule(serviceTaskRule));
+ }
+
+ /**
+ * 鍒犻櫎浠诲姟鎵ц瑙勫垯
+ */
+ @ApiOperation("鍒犻櫎浠诲姟鎵ц瑙勫垯")
+ //@PreAuthorize("@ss.hasPermi('smartor:rule:remove')")
+ @Log(title = "浠诲姟鎵ц瑙勫垯", businessType = BusinessType.DELETE)
+ @GetMapping("/remove/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(serviceTaskRuleService.deleteServiceTaskRuleByIds(ids));
+ }
+}
diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
index f85de21..423e043 100644
--- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
+++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
@@ -58,24 +58,25 @@
</sql>
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
- <include refid="selectGenTableVo"/>
- where
- <if test="orgid != null and orgid != ''">
- AND orgid = #{orgid}
- </if>
- <if test="tableName != null and tableName != ''">
- AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
- </if>
- <if test="tableComment != null and tableComment != ''">
- AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
- </if>
- <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
- AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
- </if>
- <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
- AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
- </if>
- </select>
+ <include refid="selectGenTableVo"/>
+ <where>
+ <if test="orgid != null and orgid != ''">
+ AND orgid = #{orgid}
+ </if>
+ <if test="tableName != null and tableName != ''">
+ AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
+ </if>
+ <if test="tableComment != null and tableComment != ''">
+ AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
+ </if>
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+ AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
+ </if>
+ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+ AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
+ </if>
+ </where>
+ </select>
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceTaskRule.java b/smartor/src/main/java/com/smartor/domain/ServiceTaskRule.java
new file mode 100644
index 0000000..cb34af2
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/ServiceTaskRule.java
@@ -0,0 +1,100 @@
+package com.smartor.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 浠诲姟鎵ц瑙勫垯瀵硅薄 service_task_rule
+ *
+ * @author lihu
+ * @date 2026-05-15
+ */
+@Data
+@ApiModel("浠诲姟鎵ц瑙勫垯")
+public class ServiceTaskRule extends BaseEntity
+ {
+private static final long serialVersionUID = 1L;
+
+ /** 浠诲姟ID */
+ @ApiModelProperty("浠诲姟ID")
+ //鏁版嵁搴撹嚜澧炴敼鎴怈TableId(type = IdType.AUTO)
+ private Long id;
+
+ /** 閮ㄩ棬瑙勫垯锛�1棣栧厛鎵ц 2娆¤鎵ц锛� */
+ @ApiModelProperty("閮ㄩ棬瑙勫垯锛�1棣栧厛鎵ц 2娆¤鎵ц锛�")
+ @Excel(name = "閮ㄩ棬瑙勫垯", readConverterExp = "1=棣栧厛鎵ц,2=娆¤鎵ц")
+ private String deptRule;
+
+ /** 鐥呭尯瑙勫垯锛�1棣栧厛鎵ц 2娆¤鎵ц锛� */
+ @ApiModelProperty("鐥呭尯瑙勫垯锛�1棣栧厛鎵ц 2娆¤鎵ц锛�")
+ @Excel(name = "鐥呭尯瑙勫垯", readConverterExp = "1=棣栧厛鎵ц,2=娆¤鎵ц")
+ private String wradRule;
+
+ /** 鐤剧梾瑙勫垯锛�1棣栧厛鎵ц 2娆¤鎵ц锛� */
+ @ApiModelProperty("鐤剧梾瑙勫垯锛�1棣栧厛鎵ц 2娆¤鎵ц锛�")
+ @Excel(name = "鐤剧梾瑙勫垯", readConverterExp = "1=棣栧厛鎵ц,2=娆¤鎵ц")
+ private String diagRule;
+
+ /** 鍒犻櫎鏍囧織锛�0锛氭湭鍒犻櫎 1锛氬凡鍒犻櫎锛� */
+ @ApiModelProperty("鍒犻櫎鏍囧織锛�0锛氭湭鍒犻櫎 1锛氬凡鍒犻櫎锛�")
+ private String delFlag;
+
+ /** 鐖禛UID */
+ @ApiModelProperty("鐖禛UID")
+ @Excel(name = "鐖禛UID")
+ private String pguid;
+
+ /** GUID */
+ @ApiModelProperty("GUID")
+ @Excel(name = "GUID")
+ private String guid;
+
+ /** 鐖禝D */
+ @ApiModelProperty("鐖禝D")
+ @Excel(name = "鐖禝D")
+ private Long pid;
+
+ /** 鍖婚櫌鏈烘瀯ID */
+ @ApiModelProperty("鍖婚櫌鏈烘瀯ID")
+ @Excel(name = "鍖婚櫌鏈烘瀯ID")
+ private String orgid;
+
+ /** 闄㈠尯 */
+ @ApiModelProperty("闄㈠尯")
+ @Excel(name = "闄㈠尯")
+ private String campusid;
+
+ /** 涓婁紶鏃堕棿 */
+ @ApiModelProperty("涓婁紶鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "涓婁紶鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date uploadTime;
+
+ /** 閮ㄩ棬缂栫爜 */
+ @ApiModelProperty("閮ㄩ棬缂栫爜")
+ @Excel(name = "閮ㄩ棬缂栫爜")
+ private String deptcode;
+
+ /** 閮ㄩ棬缂栫爜鍚嶇О */
+ @ApiModelProperty("閮ㄩ棬缂栫爜鍚嶇О")
+ @Excel(name = "閮ㄩ棬缂栫爜鍚嶇О")
+ private String deptname;
+
+ /** 鐥呭尯缂栫爜 */
+ @ApiModelProperty("鐥呭尯缂栫爜")
+ @Excel(name = "鐥呭尯缂栫爜")
+ private String wardcode;
+
+ /** 鐥呭尯缂栫爜鍚嶇О */
+ @ApiModelProperty("鐥呭尯缂栫爜鍚嶇О")
+ @Excel(name = "鐥呭尯缂栫爜鍚嶇О")
+ private String wardname;
+
+ }
+
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceTaskRuleMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceTaskRuleMapper.java
new file mode 100644
index 0000000..1278647
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceTaskRuleMapper.java
@@ -0,0 +1,71 @@
+package com.smartor.mapper;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import com.smartor.domain.ServiceTaskRule;
+
+/**
+ * 浠诲姟鎵ц瑙勫垯Mapper鎺ュ彛
+ *
+ * @author lihu
+ * @date 2026-05-15
+ */
+@Mapper
+public interface ServiceTaskRuleMapper
+{
+ /**
+ * 鏌ヨ浠诲姟鎵ц瑙勫垯
+ *
+ * @param id 浠诲姟鎵ц瑙勫垯涓婚敭
+ * @return 浠诲姟鎵ц瑙勫垯
+ */
+ public ServiceTaskRule selectServiceTaskRuleById(Long id);
+
+ /**
+ * 鏌ヨ浠诲姟鎵ц瑙勫垯鍒楄〃
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 浠诲姟鎵ц瑙勫垯闆嗗悎
+ */
+ public List<ServiceTaskRule> selectServiceTaskRuleList(ServiceTaskRule serviceTaskRule);
+
+ /**
+ * 鏂板浠诲姟鎵ц瑙勫垯
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 缁撴灉
+ */
+ public int insertServiceTaskRule(ServiceTaskRule serviceTaskRule);
+
+ /**
+ * 淇敼浠诲姟鎵ц瑙勫垯
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 缁撴灉
+ */
+ public int updateServiceTaskRule(ServiceTaskRule serviceTaskRule);
+
+ /**
+ * 鍒犻櫎浠诲姟鎵ц瑙勫垯
+ *
+ * @param id 浠诲姟鎵ц瑙勫垯涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteServiceTaskRuleById(Long id);
+
+ /**
+ * 鎵归噺鍒犻櫎浠诲姟鎵ц瑙勫垯
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteServiceTaskRuleByIds(Long[] ids);
+
+ /**
+ * 鏍规嵁绉戝缂栫爜鍜岀梾鍖虹紪鐮佹煡璇换鍔℃墽琛岃鍒�
+ *
+ * @param serviceTaskRule 鏌ヨ鏉′欢锛堝寘鍚玠eptcode鍜寃ardcode瀛楁锛�
+ * @return 浠诲姟鎵ц瑙勫垯
+ */
+ public ServiceTaskRule selectServiceTaskRuleByDeptOrWard(ServiceTaskRule serviceTaskRule);
+}
diff --git a/smartor/src/main/java/com/smartor/service/IServiceTaskRuleService.java b/smartor/src/main/java/com/smartor/service/IServiceTaskRuleService.java
new file mode 100644
index 0000000..0a52fc2
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/service/IServiceTaskRuleService.java
@@ -0,0 +1,61 @@
+package com.smartor.service;
+
+import java.util.List;
+import com.smartor.domain.ServiceTaskRule;
+
+/**
+ * 浠诲姟鎵ц瑙勫垯Service鎺ュ彛
+ *
+ * @author lihu
+ * @date 2026-05-15
+ */
+public interface IServiceTaskRuleService
+{
+ /**
+ * 鏌ヨ浠诲姟鎵ц瑙勫垯
+ *
+ * @param id 浠诲姟鎵ц瑙勫垯涓婚敭
+ * @return 浠诲姟鎵ц瑙勫垯
+ */
+ public ServiceTaskRule selectServiceTaskRuleById(Long id);
+
+ /**
+ * 鏌ヨ浠诲姟鎵ц瑙勫垯鍒楄〃
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 浠诲姟鎵ц瑙勫垯闆嗗悎
+ */
+ public List<ServiceTaskRule> selectServiceTaskRuleList(ServiceTaskRule serviceTaskRule);
+
+ /**
+ * 鏂板浠诲姟鎵ц瑙勫垯
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 缁撴灉
+ */
+ public int insertServiceTaskRule(ServiceTaskRule serviceTaskRule);
+
+ /**
+ * 淇敼浠诲姟鎵ц瑙勫垯
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 缁撴灉
+ */
+ public int updateServiceTaskRule(ServiceTaskRule serviceTaskRule);
+
+ /**
+ * 鎵归噺鍒犻櫎浠诲姟鎵ц瑙勫垯
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑浠诲姟鎵ц瑙勫垯涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteServiceTaskRuleByIds(Long[] ids);
+
+ /**
+ * 鍒犻櫎浠诲姟鎵ц瑙勫垯淇℃伅
+ *
+ * @param id 浠诲姟鎵ц瑙勫垯涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteServiceTaskRuleById(Long id);
+}
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
index 3a0dbc4..1c4d159 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -57,6 +57,8 @@
private PatMedOperationMapper patMedOperationMapper;
@Autowired
private PatMedOperationItemMapper patMedOperationItemMapper;
+ @Autowired
+ private ServiceTaskRuleMapper serviceTaskRuleMapper;
@Value("${spring.profiles.active}")
private String active;
@@ -307,27 +309,13 @@
}
}
- //2.鍑洪櫌闅忚
- String generationRule = iSysConfigService.selectConfigByKey("multitask.generation.rule");
- //generationRule 0:鎵�鏈夋湇鍔¢兘鐢熸垚; 1:涓撶梾浠诲姟浼樺厛
- if ("0".equals(generationRule)) {
- //绉戝浠诲姟鏂板
- addDeptSubTask(config, generationRule);
- //鏍规嵁鎮h�呮墍鍦ㄧ梾鍖猴紝鑾峰彇璇ョ梾鍖虹殑闀挎湡浠诲姟,鏂板崕鍖婚櫌鍙互鍏堜笉鐢ㄦ牴鎹梾鍖哄拰鐤剧梾鏉ュ仛
- if (!active.equals("xh")) {
- addWardSubTask(config, generationRule);
- addIcd10SubTask(config, generationRule);
- addOperationSubTask(config, generationRule);
- }
+ //2.鍑洪櫌闅忚 - 鍩轰簬瑙勫垯鐨勪换鍔$敓鎴�
+ addSubTaskByRule(config);
+ //鏍规嵁鎮h�呮墍鍦ㄧ梾鍖猴紝鑾峰彇璇ョ梾鍖虹殑闀挎湡浠诲姟,鏂板崕鍖婚櫌鍙互鍏堜笉鐢ㄦ牴鎹梾鍖哄拰鐤剧梾鏉ュ仛
+ if (!active.equals("xh")) {
+ addOperationSubTask(config);
}
- //涓芥按鐨勭壒娈婅姹傦紙闇�瑕佸厛鎵ц鐤剧梾锛屽鏋滅柧鐥呬负绌猴紝鍒欐墽琛岀瀹ゅ拰鐥呭尯锛�
- if ("1".equals(generationRule)) {
- addIcd10SubTask(config, generationRule);
- //绉戝浠诲姟鏂板
- addDeptSubTask(config, generationRule);
- addWardSubTask(config, generationRule);
- }
//鑾峰彇鏈鐞嗗湪闄㈢殑鏁版嵁(濡傛灉鍒氬垰鍑洪櫌鐨勬偅鑰呮暟鎹殑鍑洪櫌鏃堕棿,鍦ㄤ笅闈㈡煡璇㈠嚭鐨勫叆闄㈡椂闂翠箣鍓�,閭d箣鍓嶇殑鍑洪櫌鎮h�呯殑鏁版嵁,涔熷緱鍋滄帀,鍥犱负鍙堝叆闄簡)
PatMedInhosp patMedInhosp = new PatMedInhosp();
@@ -1178,7 +1166,7 @@
}
}
- private void addOperationSubTask(String config, String generationRule) {
+ private void addOperationSubTask(String config) {
// 鎵嬫湳闅忚
PatMedOperationItem pmoi = new PatMedOperationItem();
//鑾峰彇闇�瑕佸嚭闄㈢柧鐥呴殢璁匡紝鏈鐞嗙殑鏁版嵁
@@ -1223,7 +1211,7 @@
}
}
- private void addIcd10SubTask(String config, String generationRule) {
+ private void addIcd10SubTask(String config) {
PatMedInhosp pmjb = new PatMedInhosp();
//鑾峰彇闇�瑕佸嚭闄㈢柧鐥呴殢璁匡紝鏈鐞嗙殑鏁版嵁
pmjb.setDiagcheckFlag("0");
@@ -1314,7 +1302,7 @@
}
}
- private void addWardSubTask(String config, String generationRule) {
+ private void addWardSubTask(String config) {
PatMedInhosp pmbq = new PatMedInhosp();
//鑾峰彇闇�瑕佸嚭闄㈤儴闂ㄩ殢璁匡紝鏈鐞嗙殑鏁版嵁
pmbq.setWardcheckFlag("0");
@@ -1383,7 +1371,7 @@
}
}
- private void addDeptSubTask(String config, String generationRule) {
+ private void addDeptSubTask(String config) {
//鑾峰彇闇�瑕佸嚭闄㈤儴闂ㄩ殢璁匡紝鏈鐞嗙殑鏁版嵁
PatMedInhosp pmks = new PatMedInhosp();
pmks.setDeptcheckFlag("0");
@@ -1443,5 +1431,264 @@
}
}
+ /**
+ * 鍩轰簬瑙勫垯鐨勪换鍔$敓鎴愭柟娉�
+ * 鏍规嵁鎮h�呯闄㈢瀹ゆ垨鐥呭尯鏌ヨservice_task_rule锛岃幏鍙杁eptRule銆亀radRule銆乨iagRule
+ * 鏍规嵁瑙勫垯鍊煎喅瀹氳皟鐢ㄥ摢涓柟娉曠敓鎴愰殢璁夸换鍔�
+ */
+ private void addSubTaskByRule(String config) {
+ // 鑾峰彇鎵�鏈夐渶瑕佸鐞嗙殑鍑洪櫌鎮h�咃紙绉戝缁村害鏈鐞嗭級
+ PatMedInhosp pmks = new PatMedInhosp();
+ pmks.setDeptcheckFlag("0");
+ pmks.setInhospstate("1");
+ pmks.setFuflag("1");
+ List<PatMedInhosp> patMedInhosps = patMedInhospMapper.selectPatMedInhospList(pmks);
+ log.info("銆愬熀浜庤鍒欍�戦渶瑕佸鐞嗙殑鍑洪櫌鎮h�呬俊鎭細{}", CollectionUtils.isNotEmpty(patMedInhosps) ? patMedInhosps.size() : null);
+
+ for (PatMedInhosp patMedInhosp1 : patMedInhosps) {
+ // 鑾峰彇鎮h�呭熀鏈俊鎭�
+ PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp1.getPatid());
+ if (Objects.isNull(patArchive)) {
+ patMedInhosp1.setDeptcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("鎮h�呭熀鏈俊鎭负绌�");
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ continue;
+ }
+
+ try {
+ // 鏌ヨ瑙勫垯锛氭牴鎹闄㈢瀹ゆ垨鐥呭尯
+ ServiceTaskRule ruleQuery = new ServiceTaskRule();
+ ruleQuery.setDeptcode(patMedInhosp1.getLeaveldeptcode());
+ ruleQuery.setWardcode(patMedInhosp1.getLeavehospitaldistrictcode());
+ ServiceTaskRule rule = serviceTaskRuleMapper.selectServiceTaskRuleByDeptOrWard(ruleQuery);
+
+ if (rule == null) {
+ // 瑙勫垯涓虹┖锛屽叏閮ㄧ敓鎴�
+ log.info("銆愬熀浜庤鍒欍�戞偅鑰厈}鏈厤缃鍒欙紝鎵ц鍏ㄩ儴鐢熸垚閫昏緫", patMedInhosp1.getInhospid());
+ addDeptSubTaskForPatient(patMedInhosp1, patArchive, config);
+ if (!active.equals("xh")) {
+ addWardSubTaskForPatient(patMedInhosp1, patArchive, config);
+ addIcd10SubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+ } else {
+ // 鏈夎鍒欙紝鎸夎鍒欐墽琛�
+ log.info("銆愬熀浜庤鍒欍�戞偅鑰厈}鏌ヨ鍒拌鍒欙細deptRule={}, wradRule={}, diagRule={}", patMedInhosp1.getInhospid(), rule.getDeptRule(), rule.getWradRule(), rule.getDiagRule());
+
+ // 鍒ゆ柇鏄惁鏈夎鍒欎负"1"锛堥鍏堟墽琛岋級
+ boolean hasPrimaryRule = "1".equals(rule.getDeptRule()) || "1".equals(rule.getWradRule()) || "1".equals(rule.getDiagRule());
+
+ if (hasPrimaryRule) {
+ // 鏈夐瑕佽鍒欙紝鍙墽琛岄瑕佽鍒欏搴旂殑鏂规硶
+ int generatedCount = 0;
+
+ // 鎸夐『搴忥細绉戝 -> 鐥呭尯 -> 鐤剧梾
+ if ("1".equals(rule.getDeptRule())) {
+ log.info("銆愬熀浜庤鍒欍�戞墽琛岀瀹ら瑕佽鍒�");
+ generatedCount += addDeptSubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+
+ if (!active.equals("xh")) {
+ if ("1".equals(rule.getWradRule())) {
+ log.info("銆愬熀浜庤鍒欍�戞墽琛岀梾鍖洪瑕佽鍒�");
+ generatedCount += addWardSubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+
+ if ("1".equals(rule.getDiagRule())) {
+ log.info("銆愬熀浜庤鍒欍�戞墽琛岀柧鐥呴瑕佽鍒�");
+ generatedCount += addIcd10SubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+ }
+
+ // 濡傛灉棣栬瑙勫垯鐢熸垚鐨勫瓙浠诲姟涓虹┖锛屽垯璋冪敤鍏朵粬娆¤瑙勫垯鐨勬柟娉�
+ if (generatedCount == 0) {
+ log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欐湭鐢熸垚瀛愪换鍔★紝寮�濮嬫墽琛屾瑕佽鍒�");
+
+ if (!"1".equals(rule.getDeptRule()) && StringUtils.isNotEmpty(rule.getDeptRule())) {
+ log.info("銆愬熀浜庤鍒欍�戞墽琛岀瀹ゆ瑕佽鍒�");
+ addDeptSubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+
+ if (!active.equals("xh")) {
+ if (!"1".equals(rule.getWradRule()) && StringUtils.isNotEmpty(rule.getWradRule())) {
+ log.info("銆愬熀浜庤鍒欍�戞墽琛岀梾鍖烘瑕佽鍒�");
+ addWardSubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+
+ if (!"1".equals(rule.getDiagRule()) && StringUtils.isNotEmpty(rule.getDiagRule())) {
+ log.info("銆愬熀浜庤鍒欍�戞墽琛岀柧鐥呮瑕佽鍒�");
+ addIcd10SubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+ }
+ }
+ } else {
+ // 娌℃湁棣栬瑙勫垯锛堥兘鏄�"2"鎴栧叾浠栵級锛屽叏閮ㄧ敓鎴�
+ log.info("銆愬熀浜庤鍒欍�戞棤棣栬瑙勫垯锛屾墽琛屽叏閮ㄧ敓鎴愰�昏緫");
+ addDeptSubTaskForPatient(patMedInhosp1, patArchive, config);
+ if (!active.equals("xh")) {
+ addWardSubTaskForPatient(patMedInhosp1, patArchive, config);
+ addIcd10SubTaskForPatient(patMedInhosp1, patArchive, config);
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("銆愬熀浜庤鍒欍�戞偅鑰厈}澶勭悊寮傚父锛歿}", patMedInhosp1.getInhospid(), e.getMessage());
+ patMedInhosp1.setDeptcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("鍩轰簬瑙勫垯澶勭悊寮傚父锛�" + e.getMessage());
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ }
+ }
+ }
+
+ /**
+ * 涓哄崟涓偅鑰呯敓鎴愮瀹ょ淮搴︾殑瀛愪换鍔�
+ *
+ * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺
+ */
+ private int addDeptSubTaskForPatient(PatMedInhosp patMedInhosp1, PatArchive patArchive, String config) {
+ int generatedCount = 0;
+ try {
+ //鏍规嵁鎮h�呮墍鍦ㄧ瀹わ紝鑾峰彇璇ョ瀹ょ殑闀挎湡浠诲姟
+ ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
+ serviceTaskdept.setLongtask(1L);
+ serviceTaskdept.setDeptCode(patMedInhosp1.getLeaveldeptcode());
+ serviceTaskdept.setDeptType("1");
+ serviceTaskdept.setServiceType("2");
+ serviceTaskdept.setOrgid(patMedInhosp1.getOrgid());
+ List<ServiceTaskdept> serviceTaskdepts = serviceTaskdeptMapper.selectServiceTaskdeptList(serviceTaskdept);
+
+ if (CollectionUtils.isEmpty(serviceTaskdepts)) {
+ PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
+ patMedInhosp1.setDeptcheckFlag("2");
+ patMedInhosp1.setLongTaskReason(patMedInhosp.getLongTaskReason() + "璇ユ偅鑰呮墍鍦ㄧ瀹ゆ湭閰嶇疆绂婚櫌闀挎湡浠诲姟;");
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ } else {
+ for (ServiceTaskdept serviceTaskdept1 : serviceTaskdepts) {
+ writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedInhosp1, patArchive, 1, config);
+ generatedCount++;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("銆愮瀹や换鍔°�戞偅鑰厈}澶勭悊寮傚父锛歿}", patMedInhosp1.getInhospid(), e.getMessage());
+ patMedInhosp1.setDeptcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("绉戝浠诲姟澶勭悊寮傚父锛�" + e.getMessage());
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ }
+ return generatedCount;
+ }
+
+ /**
+ * 涓哄崟涓偅鑰呯敓鎴愮梾鍖虹淮搴︾殑瀛愪换鍔�
+ *
+ * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺
+ */
+ private int addWardSubTaskForPatient(PatMedInhosp patMedInhosp1, PatArchive patArchive, String config) {
+ int generatedCount = 0;
+ try {
+ String errorreason = null;
+ List<ServiceTaskdept> serviceTaskdeptList = null;
+ if (!StringUtils.isEmpty(patMedInhosp1.getLeavehospitaldistrictcode())) {
+ ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
+ serviceTaskdept.setLongtask(1L);
+ serviceTaskdept.setDeptCode(patMedInhosp1.getLeavehospitaldistrictcode());
+ serviceTaskdept.setDeptType("2");
+ serviceTaskdept.setServiceType("2");
+ serviceTaskdept.setOrgid(patMedInhosp1.getOrgid());
+ serviceTaskdeptList = serviceTaskdeptMapper.selectServiceTaskdeptList(serviceTaskdept);
+ if (CollectionUtils.isEmpty(serviceTaskdeptList)) {
+ errorreason = "璇ユ偅鑰呮墍鍦ㄧ梾鍖烘湭閰嶇疆闀挎湡浠诲姟;";
+ }
+ } else {
+ errorreason = "绂婚櫌鐥呭尯涓虹┖;";
+ }
+
+ if (StringUtils.isNotEmpty(errorreason)) {
+ PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
+ patMedInhosp1.setWardcheckFlag("2");
+ patMedInhosp1.setLongTaskReason(StringUtils.isNotEmpty(patMedInhosp.getLongTaskReason()) ? patMedInhosp.getLongTaskReason() + errorreason : errorreason);
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ } else {
+ for (ServiceTaskdept serviceTaskdept1 : serviceTaskdeptList) {
+ writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedInhosp1, patArchive, 2, config);
+ generatedCount++;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("銆愮梾鍖轰换鍔°�戞偅鑰厈}澶勭悊寮傚父锛歿}", patMedInhosp1.getInhospid(), e.getMessage());
+ patMedInhosp1.setWardcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("鐥呭尯浠诲姟澶勭悊寮傚父锛�" + e.getMessage());
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ }
+ return generatedCount;
+ }
+
+ /**
+ * 涓哄崟涓偅鑰呯敓鎴愮柧鐥呯淮搴︾殑瀛愪换鍔�
+ *
+ * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺
+ */
+ private int addIcd10SubTaskForPatient(PatMedInhosp patMedInhosp1, PatArchive patArchive, String config) {
+ int generatedCount = 0;
+ try {
+ if (StringUtils.isEmpty(patMedInhosp1.getLeaveicd10code())) {
+ return 0;
+ }
+
+ ServiceTaskdiag serviceTaskdiag = new ServiceTaskdiag();
+ serviceTaskdiag.setLongtask(1L);
+ serviceTaskdiag.setServiceType("2");
+ if (active.equals("nhfy")) {
+ serviceTaskdiag.setIcd10name(patMedInhosp1.getLeavediagname());
+ if (StringUtils.isEmpty(patMedInhosp1.getLeavediagname())) {
+ PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
+ patMedInhosp1.setDiagcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("璇ユ偅鑰呬富璇婃柇鍚嶇О涓虹┖;");
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ return 0;
+ }
+ } else {
+ serviceTaskdiag.setIcd10code(patMedInhosp1.getLeaveicd10code());
+ }
+ serviceTaskdiag.setOrgid(patMedInhosp1.getOrgid());
+ List<ServiceTaskdiag> serviceTaskdiags = serviceTaskdiagMapper.selectServiceTaskdiagListByIcdName(serviceTaskdiag);
+
+ if (CollectionUtils.isEmpty(serviceTaskdiags)) {
+ PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
+ patMedInhosp1.setDiagcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("璇ユ偅鑰呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟;");
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ } else {
+ int flag = 0;
+ for (ServiceTaskdiag serviceTaskdiag1 : serviceTaskdiags) {
+ if (StringUtils.isNotEmpty(serviceTaskdiag1.getDeptCode()) && serviceTaskdiag1.getDeptCode().equals(patMedInhosp1.getLeaveldeptcode())) {
+ writeInSubTask(serviceTaskdiag1.getTaskId(), true, patMedInhosp1, patArchive, 3, config);
+ generatedCount++;
+ flag = 1;
+ } else if (StringUtils.isNotEmpty(serviceTaskdiag1.getWardCode()) && serviceTaskdiag1.getWardCode().equals(patMedInhosp1.getLeavehospitaldistrictcode())) {
+ writeInSubTask(serviceTaskdiag1.getTaskId(), true, patMedInhosp1, patArchive, 3, config);
+ generatedCount++;
+ flag = 1;
+ }
+ }
+ if (flag == 0) {
+ log.error("璇ョ瀹ゆ垨鐥呭尯瀵逛簬鎮h�呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟,鎮h�咃細{}", patMedInhosp1.getInhospid());
+ PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(patMedInhosp1.getInhospid());
+ patMedInhosp1.setDiagcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("璇ョ瀹ゆ垨鐥呭尯瀵逛簬鎮h�呮墍鎮g柧鐥呮湭閰嶇疆闀挎湡浠诲姟;");
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("銆愮柧鐥呬换鍔°�戞偅鑰厈}澶勭悊寮傚父锛歿}", patMedInhosp1.getInhospid(), e.getMessage());
+ patMedInhosp1.setDiagcheckFlag("2");
+ patMedInhosp1.setLongTaskReason("鐤剧梾浠诲姟澶勭悊寮傚父锛�" + e.getMessage());
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+ }
+ return generatedCount;
+ }
+
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskRuleServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskRuleServiceImpl.java
new file mode 100644
index 0000000..b27cf79
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskRuleServiceImpl.java
@@ -0,0 +1,96 @@
+package com.smartor.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.smartor.mapper.ServiceTaskRuleMapper;
+import com.smartor.domain.ServiceTaskRule;
+import com.smartor.service.IServiceTaskRuleService;
+
+/**
+ * 浠诲姟鎵ц瑙勫垯Service涓氬姟灞傚鐞�
+ *
+ * @author lihu
+ * @date 2026-05-15
+ */
+@Service
+public class ServiceTaskRuleServiceImpl implements IServiceTaskRuleService
+{
+ @Autowired
+ private ServiceTaskRuleMapper serviceTaskRuleMapper;
+
+ /**
+ * 鏌ヨ浠诲姟鎵ц瑙勫垯
+ *
+ * @param id 浠诲姟鎵ц瑙勫垯涓婚敭
+ * @return 浠诲姟鎵ц瑙勫垯
+ */
+ @Override
+ public ServiceTaskRule selectServiceTaskRuleById(Long id)
+ {
+ return serviceTaskRuleMapper.selectServiceTaskRuleById(id);
+ }
+
+ /**
+ * 鏌ヨ浠诲姟鎵ц瑙勫垯鍒楄〃
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 浠诲姟鎵ц瑙勫垯
+ */
+ @Override
+ public List<ServiceTaskRule> selectServiceTaskRuleList(ServiceTaskRule serviceTaskRule)
+ {
+ return serviceTaskRuleMapper.selectServiceTaskRuleList(serviceTaskRule);
+ }
+
+ /**
+ * 鏂板浠诲姟鎵ц瑙勫垯
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertServiceTaskRule(ServiceTaskRule serviceTaskRule)
+ {
+ serviceTaskRule.setCreateTime(DateUtils.getNowDate());
+ return serviceTaskRuleMapper.insertServiceTaskRule(serviceTaskRule);
+ }
+
+ /**
+ * 淇敼浠诲姟鎵ц瑙勫垯
+ *
+ * @param serviceTaskRule 浠诲姟鎵ц瑙勫垯
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateServiceTaskRule(ServiceTaskRule serviceTaskRule)
+ {
+ serviceTaskRule.setUpdateTime(DateUtils.getNowDate());
+ return serviceTaskRuleMapper.updateServiceTaskRule(serviceTaskRule);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎浠诲姟鎵ц瑙勫垯
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑浠诲姟鎵ц瑙勫垯涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteServiceTaskRuleByIds(Long[] ids)
+ {
+ return serviceTaskRuleMapper.deleteServiceTaskRuleByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎浠诲姟鎵ц瑙勫垯淇℃伅
+ *
+ * @param id 浠诲姟鎵ц瑙勫垯涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteServiceTaskRuleById(Long id)
+ {
+ return serviceTaskRuleMapper.deleteServiceTaskRuleById(id);
+ }
+}
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceTaskRuleMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceTaskRuleMapper.xml
new file mode 100644
index 0000000..9f34346
--- /dev/null
+++ b/smartor/src/main/resources/mapper/smartor/ServiceTaskRuleMapper.xml
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.smartor.mapper.ServiceTaskRuleMapper">
+
+ <resultMap type="com.smartor.domain.ServiceTaskRule" id="ServiceTaskRuleResult">
+ <result property="id" column="id"/>
+ <result property="deptRule" column="dept_rule"/>
+ <result property="wradRule" column="wrad_rule"/>
+ <result property="diagRule" column="diag_rule"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="pguid" column="pguid"/>
+ <result property="guid" column="guid"/>
+ <result property="pid" column="pid"/>
+ <result property="orgid" column="orgid"/>
+ <result property="campusid" column="campusid"/>
+ <result property="uploadTime" column="upload_time"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="deptcode" column="deptcode"/>
+ <result property="deptname" column="deptname"/>
+ <result property="wardcode" column="wardcode"/>
+ <result property="wardname" column="wardname"/>
+ </resultMap>
+
+ <sql id="selectServiceTaskRuleVo">
+ select id, dept_rule, wrad_rule, diag_rule, del_flag, pguid, guid, pid, orgid, campusid, upload_time, create_by, create_time, update_by, update_time, deptcode, deptname, wardcode, wardname
+ from service_task_rule
+ </sql>
+
+ <select id="selectServiceTaskRuleList" parameterType="com.smartor.domain.ServiceTaskRule"
+ resultMap="ServiceTaskRuleResult">
+ <include refid="selectServiceTaskRuleVo"/>
+ where 1=1
+ and del_flag=0
+ <if test="deptRule != null and deptRule != ''">
+ and dept_rule = #{deptRule}
+ </if>
+ <if test="wradRule != null and wradRule != ''">
+ and wrad_rule = #{wradRule}
+ </if>
+ <if test="diagRule != null and diagRule != ''">
+ and diag_rule = #{diagRule}
+ </if>
+ <if test="pguid != null and pguid != ''">
+ and pguid = #{pguid}
+ </if>
+ <if test="guid != null and guid != ''">
+ and guid = #{guid}
+ </if>
+ <if test="pid != null ">
+ and pid = #{pid}
+ </if>
+ <if test="orgid != null and orgid != ''">
+ and orgid = #{orgid}
+ </if>
+ <if test="campusid != null and campusid != ''">
+ and campusid = #{campusid}
+ </if>
+ <if test="uploadTime != null ">
+ and upload_time = #{uploadTime}
+ </if>
+ <if test="deptcode != null and deptcode != ''">
+ and deptcode = #{deptcode}
+ </if>
+ <if test="deptname != null and deptname != ''">
+ and deptname like concat('%', #{deptname}, '%')
+ </if>
+ <if test="wardcode != null and wardcode != ''">
+ and wardcode = #{wardcode}
+ </if>
+ <if test="wardname != null and wardname != ''">
+ and wardname like concat('%', #{wardname}, '%')
+ </if>
+ </select>
+
+ <select id="selectServiceTaskRuleById" parameterType="Long"
+ resultMap="ServiceTaskRuleResult">
+ <include refid="selectServiceTaskRuleVo"/>
+ where id = #{id}
+ </select>
+
+ <select id="selectServiceTaskRuleByDeptOrWard" parameterType="com.smartor.domain.ServiceTaskRule"
+ resultMap="ServiceTaskRuleResult">
+ <include refid="selectServiceTaskRuleVo"/>
+ where del_flag = 0
+ and (
+ (deptcode = #{deptcode} and deptcode is not null and deptcode != '')
+ or
+ (wardcode = #{wardcode} and wardcode is not null and wardcode != '')
+ )
+ order by
+ case when deptcode = #{deptcode} then 0 else 1 end
+ limit 1
+ </select>
+
+ <insert id="insertServiceTaskRule" parameterType="com.smartor.domain.ServiceTaskRule" useGeneratedKeys="true" keyProperty="id">
+ insert into service_task_rule
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="deptRule != null">dept_rule,
+ </if>
+ <if test="wradRule != null">wrad_rule,
+ </if>
+ <if test="diagRule != null">diag_rule,
+ </if>
+ <if test="delFlag != null">del_flag,
+ </if>
+ <if test="pguid != null">pguid,
+ </if>
+ <if test="guid != null">guid,
+ </if>
+ <if test="pid != null">pid,
+ </if>
+ <if test="orgid != null">orgid,
+ </if>
+ <if test="campusid != null">campusid,
+ </if>
+ <if test="uploadTime != null">upload_time,
+ </if>
+ <if test="createBy != null">create_by,
+ </if>
+ <if test="createTime != null">create_time,
+ </if>
+ <if test="updateBy != null">update_by,
+ </if>
+ <if test="updateTime != null">update_time,
+ </if>
+ <if test="deptcode != null">deptcode,
+ </if>
+ <if test="deptname != null">deptname,
+ </if>
+ <if test="wardcode != null">wardcode,
+ </if>
+ <if test="wardname != null">wardname,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="deptRule != null">#{deptRule},
+ </if>
+ <if test="wradRule != null">#{wradRule},
+ </if>
+ <if test="diagRule != null">#{diagRule},
+ </if>
+ <if test="delFlag != null">#{delFlag},
+ </if>
+ <if test="pguid != null">#{pguid},
+ </if>
+ <if test="guid != null">#{guid},
+ </if>
+ <if test="pid != null">#{pid},
+ </if>
+ <if test="orgid != null">#{orgid},
+ </if>
+ <if test="campusid != null">#{campusid},
+ </if>
+ <if test="uploadTime != null">#{uploadTime},
+ </if>
+ <if test="createBy != null">#{createBy},
+ </if>
+ <if test="createTime != null">#{createTime},
+ </if>
+ <if test="updateBy != null">#{updateBy},
+ </if>
+ <if test="updateTime != null">#{updateTime},
+ </if>
+ <if test="deptcode != null">#{deptcode},
+ </if>
+ <if test="deptname != null">#{deptname},
+ </if>
+ <if test="wardcode != null">#{wardcode},
+ </if>
+ <if test="wardname != null">#{wardname},
+ </if>
+ </trim>
+ </insert>
+
+ <update id="updateServiceTaskRule" parameterType="com.smartor.domain.ServiceTaskRule">
+ update service_task_rule
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="deptRule != null">dept_rule =
+ #{deptRule},
+ </if>
+ <if test="wradRule != null">wrad_rule =
+ #{wradRule},
+ </if>
+ <if test="diagRule != null">diag_rule =
+ #{diagRule},
+ </if>
+ <if test="delFlag != null">del_flag =
+ #{delFlag},
+ </if>
+ <if test="pguid != null">pguid =
+ #{pguid},
+ </if>
+ <if test="guid != null">guid =
+ #{guid},
+ </if>
+ <if test="pid != null">pid =
+ #{pid},
+ </if>
+ <if test="orgid != null">orgid =
+ #{orgid},
+ </if>
+ <if test="campusid != null">campusid =
+ #{campusid},
+ </if>
+ <if test="uploadTime != null">upload_time =
+ #{uploadTime},
+ </if>
+ <if test="createBy != null">create_by =
+ #{createBy},
+ </if>
+ <if test="createTime != null">create_time =
+ #{createTime},
+ </if>
+ <if test="updateBy != null">update_by =
+ #{updateBy},
+ </if>
+ <if test="updateTime != null">update_time =
+ #{updateTime},
+ </if>
+ <if test="deptcode != null">deptcode =
+ #{deptcode},
+ </if>
+ <if test="deptname != null">deptname =
+ #{deptname},
+ </if>
+ <if test="wardcode != null">wardcode =
+ #{wardcode},
+ </if>
+ <if test="wardname != null">wardname =
+ #{wardname},
+ </if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <update id="deleteServiceTaskRuleById" parameterType="Long">
+ update service_task_rule
+ <trim prefix="SET" suffixOverrides=",">
+ del_flag =1
+ </trim>
+ where id = #{id}
+ </update>
+
+ <update id="deleteServiceTaskRuleByIds" parameterType="String">
+ update service_task_rule
+ <trim prefix="SET" suffixOverrides=",">
+ del_flag =1
+ </trim>
+ where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </update>
+
+
+
+
+</mapper>
--
Gitblit v1.9.3