Commit 877a0bac8d3828314e0d9dd6d5c00fa9a5bbeba0
1 parent
6733799555
Exists in
master
and in
2 other branches
威县增加必检和备检项配置
Showing 7 changed files with 663 additions and 0 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/HospitalCheckItemConfMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/HospitalCheckItemConfService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/HospitalCheckItemConfServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/HospitalCheckItemConf.xml
- platform-dal/src/main/java/com/lyms/platform/pojo/HospitalCheckItemConf.java
- platform-dal/src/main/java/com/lyms/platform/query/HospitalCheckItemConfQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HospitalCheckItemConfController.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/HospitalCheckItemConfMapper.java
View file @
877a0ba
1 | +package com.lyms.platform.permission.dao.master; | |
2 | + | |
3 | + | |
4 | + | |
5 | +import com.lyms.platform.pojo.HospitalCheckItemConf; | |
6 | +import com.lyms.platform.query.HospitalCheckItemConfQuery; | |
7 | + | |
8 | +import java.util.List; | |
9 | + | |
10 | +public interface HospitalCheckItemConfMapper { | |
11 | + void updateHospitalCheckItemConf(HospitalCheckItemConf record); | |
12 | + void addHospitalCheckItemConf(HospitalCheckItemConf record); | |
13 | + List<HospitalCheckItemConf> selectHospitalCheckItemConfList(HospitalCheckItemConfQuery query); | |
14 | + | |
15 | +} |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/HospitalCheckItemConfService.java
View file @
877a0ba
1 | +package com.lyms.platform.permission.service; | |
2 | + | |
3 | + | |
4 | +import com.lyms.platform.pojo.HospitalCheckItemConf; | |
5 | +import com.lyms.platform.pojo.TServiceTimeRecord; | |
6 | +import com.lyms.platform.query.HospitalCheckItemConfQuery; | |
7 | +import com.lyms.platform.query.TServiceTimeRecordQuery; | |
8 | + | |
9 | +import java.util.List; | |
10 | + | |
11 | +public interface HospitalCheckItemConfService { | |
12 | + void updateHospitalCheckItemConf(HospitalCheckItemConf record); | |
13 | + void addHospitalCheckItemConf(HospitalCheckItemConf record); | |
14 | + List<HospitalCheckItemConf> selectHospitalCheckItemConfList(HospitalCheckItemConfQuery query); | |
15 | + | |
16 | +} |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/HospitalCheckItemConfServiceImpl.java
View file @
877a0ba
1 | +package com.lyms.platform.permission.service.impl; | |
2 | + | |
3 | +import com.lyms.platform.permission.dao.master.HospitalCheckItemConfMapper; | |
4 | +import com.lyms.platform.permission.service.HospitalCheckItemConfService; | |
5 | +import com.lyms.platform.pojo.HospitalCheckItemConf; | |
6 | +import com.lyms.platform.query.HospitalCheckItemConfQuery; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import javax.annotation.Resource; | |
10 | +import java.util.List; | |
11 | + | |
12 | +@Service | |
13 | +public class HospitalCheckItemConfServiceImpl implements HospitalCheckItemConfService { | |
14 | + | |
15 | + @Resource | |
16 | + private HospitalCheckItemConfMapper hospitalCheckItemConfMapper; | |
17 | + @Override | |
18 | + public void updateHospitalCheckItemConf(HospitalCheckItemConf record) { | |
19 | + hospitalCheckItemConfMapper.updateHospitalCheckItemConf(record); | |
20 | + } | |
21 | + | |
22 | + @Override | |
23 | + public void addHospitalCheckItemConf(HospitalCheckItemConf record) { | |
24 | + hospitalCheckItemConfMapper.addHospitalCheckItemConf(record); | |
25 | + } | |
26 | + | |
27 | + @Override | |
28 | + public List<HospitalCheckItemConf> selectHospitalCheckItemConfList(HospitalCheckItemConfQuery query) { | |
29 | + return hospitalCheckItemConfMapper.selectHospitalCheckItemConfList(query); | |
30 | + } | |
31 | +} |
platform-biz-service/src/main/resources/mainOrm/master/HospitalCheckItemConf.xml
View file @
877a0ba
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.lyms.platform.permission.dao.master.HospitalCheckItemConfMapper"> | |
4 | + | |
5 | + <resultMap id="HospitalCheckItemConfMap" type="com.lyms.platform.pojo.HospitalCheckItemConf"> | |
6 | + <id column="id" property="id" jdbcType="INTEGER"/> | |
7 | + <result column="hospital_id" property="hospitalId" jdbcType="INTEGER"/> | |
8 | + <result column="start_week" property="startWeek" jdbcType="INTEGER"/> | |
9 | + <result column="end_week" property="endWeek" jdbcType="INTEGER"/> | |
10 | + <result column="need_check_item" property="needCheckItem" jdbcType="VARCHAR"/> | |
11 | + <result column="backup_check_item" property="backupCheckItem" jdbcType="VARCHAR"/> | |
12 | + <result column="yn" property="yn" jdbcType="INTEGER"/> | |
13 | + <result column="type" property="type" jdbcType="INTEGER"/> | |
14 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> | |
15 | + <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> | |
16 | + </resultMap> | |
17 | + | |
18 | + | |
19 | + <insert id="addHospitalCheckItemConf" parameterType="com.lyms.platform.pojo.HospitalCheckItemConf"> | |
20 | + insert into hosptial_check_itme_conf | |
21 | + (hospital_id,start_week,end_week,need_check_item,backup_check_item,yn,type | |
22 | + ,create_time,update_time) values | |
23 | + (#{hospitalId},#{startWeek},#{endWeek}, | |
24 | + #{needCheckItem},#{backupCheckItem},#{yn},#{type},#{createTime},#{updateTime}) | |
25 | + </insert> | |
26 | + | |
27 | + <select id="selectHospitalCheckItemConfList" parameterType="com.lyms.platform.query.HospitalCheckItemConfQuery" | |
28 | + resultMap="HospitalCheckItemConfMap"> | |
29 | + SELECT id,hospital_id,start_week,end_week,need_check_item,backup_check_item,yn,type | |
30 | + ,create_time,update_time from hosptial_check_itme_conf | |
31 | + <include refid="HospitalCheckItemConfCondition"/> | |
32 | + <include refid="orderAndLimit"/> | |
33 | + </select> | |
34 | + | |
35 | + | |
36 | + <update id="updateHospitalCheckItemConf" parameterType="com.lyms.platform.pojo.HospitalCheckItemConf"> | |
37 | + update hosptial_check_itme_conf | |
38 | + <set> | |
39 | + <if test="startWeek != null"> | |
40 | + start_week = #{startWeek,jdbcType=INTEGER}, | |
41 | + </if> | |
42 | + <if test="endWeek != null"> | |
43 | + end_week = #{endWeek,jdbcType=INTEGER}, | |
44 | + </if> | |
45 | + <if test="needCheckItem != null and needCheckItem != '' "> | |
46 | + need_check_item = #{needCheckItem,jdbcType=VARCHAR}, | |
47 | + </if> | |
48 | + <if test="backupCheckItem != null and needCheckItem != '' "> | |
49 | + backup_check_item = #{backupCheckItem,jdbcType=VARCHAR}, | |
50 | + </if> | |
51 | + <if test="yn != null "> | |
52 | + yn = #{yn,jdbcType=INTEGER}, | |
53 | + </if> | |
54 | + <if test="type != null "> | |
55 | + type = #{type,jdbcType=INTEGER}, | |
56 | + </if> | |
57 | + <if test="updateTime != null "> | |
58 | + update_time = #{updateTime,jdbcType=TIMESTAMP}, | |
59 | + </if> | |
60 | + | |
61 | + </set> | |
62 | + where id = #{id,jdbcType=INTEGER} | |
63 | + </update> | |
64 | + | |
65 | + | |
66 | + <sql id="HospitalCheckItemConfCondition"> | |
67 | + <where> | |
68 | + 1 = 1 | |
69 | + <if test="id != null and id >= 0"> | |
70 | + and id = #{id,jdbcType=INTEGER} | |
71 | + </if> | |
72 | + <if test="hospitalId != null"> | |
73 | + and hospital_id = #{hospitalId,jdbcType=INTEGER} | |
74 | + </if> | |
75 | + <if test="yn != null and yn >= 0"> | |
76 | + and yn = #{yn,jdbcType=INTEGER} | |
77 | + </if> | |
78 | + <if test="type != null "> | |
79 | + and type = #{type,jdbcType=INTEGER} | |
80 | + </if> | |
81 | + | |
82 | + <if test="startWeek != null and startWeek >= 0"> | |
83 | + <![CDATA[ and start_week >= #{startWeek,jdbcType=INTEGER} ]]> | |
84 | + </if> | |
85 | + <if test="endWeek != null and endWeek >= 0"> | |
86 | + <![CDATA[ and end_week <= #{endWeek,jdbcType=INTEGER} ]]> | |
87 | + </if> | |
88 | + | |
89 | + | |
90 | + </where> | |
91 | + </sql> | |
92 | + | |
93 | + <sql id="orderAndLimit"> | |
94 | + <if test="sort != null and sort != '' "> | |
95 | + order by ${sort} | |
96 | + <if test="need != null"> | |
97 | + limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER} | |
98 | + </if> | |
99 | + </if> | |
100 | + </sql> | |
101 | + | |
102 | +</mapper> |
platform-dal/src/main/java/com/lyms/platform/pojo/HospitalCheckItemConf.java
View file @
877a0ba
1 | +package com.lyms.platform.pojo; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * 服务周期表 | |
7 | + */ | |
8 | +public class HospitalCheckItemConf { | |
9 | + private Integer id; | |
10 | + /** | |
11 | + * 医院ID | |
12 | + */ | |
13 | + private Integer hospitalId; | |
14 | + | |
15 | + /** | |
16 | + * 开始孕周 | |
17 | + */ | |
18 | + private Integer startWeek; | |
19 | + | |
20 | + /** | |
21 | + * 结束孕周 | |
22 | + */ | |
23 | + private Integer endWeek; | |
24 | + | |
25 | + /** | |
26 | + * 必检项目,多个逗号隔开 | |
27 | + */ | |
28 | + private String needCheckItem; | |
29 | + | |
30 | + /** | |
31 | + * 必检项目名称,多个逗号隔开 | |
32 | + */ | |
33 | + private String needCheckItemName; | |
34 | + | |
35 | + /** | |
36 | + * 备检项目,多个逗号隔开 | |
37 | + */ | |
38 | + private String backupCheckItem; | |
39 | + | |
40 | + /** | |
41 | + * 备检项目,多个逗号隔开 | |
42 | + */ | |
43 | + private String backupCheckItemName; | |
44 | + | |
45 | + /** | |
46 | + * 类型 1孕妇 2 儿童 | |
47 | + */ | |
48 | + private Integer type; | |
49 | + | |
50 | + /** | |
51 | + * 有效标识 | |
52 | + */ | |
53 | + private Integer yn; | |
54 | + | |
55 | + /** | |
56 | + * 创建时间 | |
57 | + */ | |
58 | + private Date createTime; | |
59 | + /** | |
60 | + * 更新时间 | |
61 | + */ | |
62 | + private Date updateTime; | |
63 | + | |
64 | + public Integer getId() { | |
65 | + return id; | |
66 | + } | |
67 | + | |
68 | + public void setId(Integer id) { | |
69 | + this.id = id; | |
70 | + } | |
71 | + | |
72 | + public Integer getHospitalId() { | |
73 | + return hospitalId; | |
74 | + } | |
75 | + | |
76 | + public void setHospitalId(Integer hospitalId) { | |
77 | + this.hospitalId = hospitalId; | |
78 | + } | |
79 | + | |
80 | + public Integer getStartWeek() { | |
81 | + return startWeek; | |
82 | + } | |
83 | + | |
84 | + public void setStartWeek(Integer startWeek) { | |
85 | + this.startWeek = startWeek; | |
86 | + } | |
87 | + | |
88 | + public Integer getEndWeek() { | |
89 | + return endWeek; | |
90 | + } | |
91 | + | |
92 | + public void setEndWeek(Integer endWeek) { | |
93 | + this.endWeek = endWeek; | |
94 | + } | |
95 | + | |
96 | + public String getNeedCheckItem() { | |
97 | + return needCheckItem; | |
98 | + } | |
99 | + | |
100 | + public void setNeedCheckItem(String needCheckItem) { | |
101 | + this.needCheckItem = needCheckItem; | |
102 | + } | |
103 | + | |
104 | + public String getBackupCheckItem() { | |
105 | + return backupCheckItem; | |
106 | + } | |
107 | + | |
108 | + public void setBackupCheckItem(String backupCheckItem) { | |
109 | + this.backupCheckItem = backupCheckItem; | |
110 | + } | |
111 | + | |
112 | + public Integer getYn() { | |
113 | + return yn; | |
114 | + } | |
115 | + | |
116 | + public void setYn(Integer yn) { | |
117 | + this.yn = yn; | |
118 | + } | |
119 | + | |
120 | + public Date getCreateTime() { | |
121 | + return createTime; | |
122 | + } | |
123 | + | |
124 | + public void setCreateTime(Date createTime) { | |
125 | + this.createTime = createTime; | |
126 | + } | |
127 | + | |
128 | + public Date getUpdateTime() { | |
129 | + return updateTime; | |
130 | + } | |
131 | + | |
132 | + public void setUpdateTime(Date updateTime) { | |
133 | + this.updateTime = updateTime; | |
134 | + } | |
135 | + | |
136 | + public String getNeedCheckItemName() { | |
137 | + return needCheckItemName; | |
138 | + } | |
139 | + | |
140 | + public void setNeedCheckItemName(String needCheckItemName) { | |
141 | + this.needCheckItemName = needCheckItemName; | |
142 | + } | |
143 | + | |
144 | + public String getBackupCheckItemName() { | |
145 | + return backupCheckItemName; | |
146 | + } | |
147 | + | |
148 | + public void setBackupCheckItemName(String backupCheckItemName) { | |
149 | + this.backupCheckItemName = backupCheckItemName; | |
150 | + } | |
151 | + | |
152 | + public Integer getType() { | |
153 | + return type; | |
154 | + } | |
155 | + | |
156 | + public void setType(Integer type) { | |
157 | + this.type = type; | |
158 | + } | |
159 | + | |
160 | + | |
161 | + @Override | |
162 | + public String toString() { | |
163 | + return "HospitalCheckItemConf{" + | |
164 | + "id=" + id + | |
165 | + ", hospitalId=" + hospitalId + | |
166 | + ", startWeek=" + startWeek + | |
167 | + ", endWeek=" + endWeek + | |
168 | + ", needCheckItem='" + needCheckItem + '\'' + | |
169 | + ", needCheckItemName='" + needCheckItemName + '\'' + | |
170 | + ", backupCheckItem='" + backupCheckItem + '\'' + | |
171 | + ", backupCheckItemName='" + backupCheckItemName + '\'' + | |
172 | + ", type=" + type + | |
173 | + ", yn=" + yn + | |
174 | + ", createTime=" + createTime + | |
175 | + ", updateTime=" + updateTime + | |
176 | + '}'; | |
177 | + } | |
178 | +} |
platform-dal/src/main/java/com/lyms/platform/query/HospitalCheckItemConfQuery.java
View file @
877a0ba
1 | +package com.lyms.platform.query; | |
2 | + | |
3 | + | |
4 | + | |
5 | +import com.lyms.platform.common.dao.BaseQuery; | |
6 | + | |
7 | +import java.util.Date; | |
8 | + | |
9 | + | |
10 | +public class HospitalCheckItemConfQuery extends BaseQuery { | |
11 | + | |
12 | + private Integer id; | |
13 | + /** | |
14 | + * 医院ID | |
15 | + */ | |
16 | + private Integer hospitalId; | |
17 | + | |
18 | + /** | |
19 | + * 开始孕周 | |
20 | + */ | |
21 | + private Integer startWeek; | |
22 | + | |
23 | + /** | |
24 | + * 结束孕周 | |
25 | + */ | |
26 | + private Integer endWeek; | |
27 | + | |
28 | + /** | |
29 | + * 必检项目 | |
30 | + */ | |
31 | + private String needCheckItem; | |
32 | + | |
33 | + /** | |
34 | + * 备检项目 | |
35 | + */ | |
36 | + private String backupCheckItem; | |
37 | + | |
38 | + /** | |
39 | + * 有效标识 | |
40 | + */ | |
41 | + private Integer yn; | |
42 | + | |
43 | + private Integer type; | |
44 | + | |
45 | + | |
46 | + public Integer getId() { | |
47 | + return id; | |
48 | + } | |
49 | + | |
50 | + public void setId(Integer id) { | |
51 | + this.id = id; | |
52 | + } | |
53 | + | |
54 | + public Integer getHospitalId() { | |
55 | + return hospitalId; | |
56 | + } | |
57 | + | |
58 | + public void setHospitalId(Integer hospitalId) { | |
59 | + this.hospitalId = hospitalId; | |
60 | + } | |
61 | + | |
62 | + public Integer getStartWeek() { | |
63 | + return startWeek; | |
64 | + } | |
65 | + | |
66 | + public void setStartWeek(Integer startWeek) { | |
67 | + this.startWeek = startWeek; | |
68 | + } | |
69 | + | |
70 | + public Integer getEndWeek() { | |
71 | + return endWeek; | |
72 | + } | |
73 | + | |
74 | + public void setEndWeek(Integer endWeek) { | |
75 | + this.endWeek = endWeek; | |
76 | + } | |
77 | + | |
78 | + public String getNeedCheckItem() { | |
79 | + return needCheckItem; | |
80 | + } | |
81 | + | |
82 | + public void setNeedCheckItem(String needCheckItem) { | |
83 | + this.needCheckItem = needCheckItem; | |
84 | + } | |
85 | + | |
86 | + public String getBackupCheckItem() { | |
87 | + return backupCheckItem; | |
88 | + } | |
89 | + | |
90 | + public void setBackupCheckItem(String backupCheckItem) { | |
91 | + this.backupCheckItem = backupCheckItem; | |
92 | + } | |
93 | + | |
94 | + public Integer getYn() { | |
95 | + return yn; | |
96 | + } | |
97 | + | |
98 | + public void setYn(Integer yn) { | |
99 | + this.yn = yn; | |
100 | + } | |
101 | + | |
102 | + public Integer getType() { | |
103 | + return type; | |
104 | + } | |
105 | + | |
106 | + public void setType(Integer type) { | |
107 | + this.type = type; | |
108 | + } | |
109 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HospitalCheckItemConfController.java
View file @
877a0ba
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.platform.common.base.BaseController; | |
4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
5 | +import com.lyms.platform.common.enums.YnEnums; | |
6 | +import com.lyms.platform.common.utils.ResultUtils; | |
7 | +import com.lyms.platform.common.utils.StringUtils; | |
8 | +import com.lyms.platform.operate.web.result.FrontEndResult; | |
9 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
10 | +import com.lyms.platform.permission.model.CheckItem; | |
11 | +import com.lyms.platform.permission.service.CheckItemService; | |
12 | +import com.lyms.platform.permission.service.HospitalCheckItemConfService; | |
13 | +import com.lyms.platform.pojo.HospitalCheckItemConf; | |
14 | +import com.lyms.platform.query.HospitalCheckItemConfQuery; | |
15 | +import org.springframework.beans.factory.annotation.Autowired; | |
16 | +import org.springframework.beans.factory.annotation.Qualifier; | |
17 | +import org.springframework.stereotype.Controller; | |
18 | +import org.springframework.web.bind.annotation.*; | |
19 | + | |
20 | +import javax.servlet.http.HttpServletResponse; | |
21 | +import java.util.*; | |
22 | + | |
23 | +@Controller | |
24 | +@RequestMapping("/hospitalCheckItemConf") | |
25 | +public class HospitalCheckItemConfController extends BaseController { | |
26 | + | |
27 | + @Autowired | |
28 | + private HospitalCheckItemConfService hospitalCheckItemConfService; | |
29 | + | |
30 | + @Autowired | |
31 | + @Qualifier("cfCheckItemService") | |
32 | + private CheckItemService checkItemService; | |
33 | + | |
34 | + @RequestMapping(value = "/list", method = RequestMethod.GET) | |
35 | + @ResponseBody | |
36 | + public FrontEndResult queryHospitalCheckItemConfList(@RequestParam(value = "hospitalId") Integer hospitalId, | |
37 | + @RequestParam(value = "type") Integer type) { | |
38 | + FrontEndResult frontEndResult = new FrontEndResult(); | |
39 | + frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS); | |
40 | + if(hospitalId == null){ | |
41 | + frontEndResult.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
42 | + frontEndResult.setErrormsg("机构信息必须填写"); | |
43 | + return frontEndResult; | |
44 | + } | |
45 | + HospitalCheckItemConfQuery checkItemConfQuery = new HospitalCheckItemConfQuery(); | |
46 | + checkItemConfQuery.setSort("start_week asc"); | |
47 | + checkItemConfQuery.setHospitalId(hospitalId); | |
48 | + checkItemConfQuery.setType(type); | |
49 | + checkItemConfQuery.setYn(YnEnums.YES.getId()); | |
50 | + List<HospitalCheckItemConf> hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(checkItemConfQuery); | |
51 | + //查询医院的孕妇类型的所有产检项目 | |
52 | + Map param = new HashMap(); | |
53 | + param.put("type",1); | |
54 | + param.put("hospitalId",hospitalId); | |
55 | + List<CheckItem> checkItems = checkItemService.getCheckItemList(param); | |
56 | + | |
57 | + StringBuffer needCheckItemNames = new StringBuffer(); | |
58 | + StringBuffer backupCheckItemNames = new StringBuffer(); | |
59 | + for(HospitalCheckItemConf checkItemConf: hospitalCheckItemConfs){ | |
60 | + needCheckItemNames.setLength(0); | |
61 | + backupCheckItemNames.setLength(0); | |
62 | + String needCheckItem = checkItemConf.getNeedCheckItem(); | |
63 | + if(StringUtils.isNotEmpty(needCheckItem)){ | |
64 | + String[] needCheckItemIds = needCheckItem.split(","); | |
65 | + for(String id: needCheckItemIds){ | |
66 | + if(StringUtils.isEmpty(id)){ | |
67 | + continue; | |
68 | + } | |
69 | + for(CheckItem checkItem: checkItems){ | |
70 | + if(checkItem.getId() == Integer.parseInt(id)){ | |
71 | + needCheckItemNames.append(checkItem.getProject()+","); | |
72 | + } | |
73 | + } | |
74 | + } | |
75 | + | |
76 | + | |
77 | + } | |
78 | + String backupCheckItems= checkItemConf.getBackupCheckItem(); | |
79 | + if(StringUtils.isNotEmpty(backupCheckItems)){ | |
80 | + String[] backupCheckItemIds = backupCheckItems.split(","); | |
81 | + for(String id: backupCheckItemIds){ | |
82 | + if(StringUtils.isEmpty(id)){ | |
83 | + continue; | |
84 | + } | |
85 | + for(CheckItem checkItem: checkItems){ | |
86 | + if(checkItem.getId() == Integer.parseInt(id)){ | |
87 | + backupCheckItemNames.append(checkItem.getProject()+","); | |
88 | + } | |
89 | + } | |
90 | + } | |
91 | + | |
92 | + | |
93 | + } | |
94 | + if(needCheckItemNames.length() > 0){ | |
95 | + checkItemConf.setNeedCheckItemName(needCheckItemNames.deleteCharAt(needCheckItemNames.length() - 1).toString()); | |
96 | + } | |
97 | + if(backupCheckItemNames.length() > 0){ | |
98 | + checkItemConf.setBackupCheckItemName(backupCheckItemNames.deleteCharAt(backupCheckItemNames.length()-1).toString()); | |
99 | + } | |
100 | + | |
101 | + } | |
102 | + frontEndResult.setData(hospitalCheckItemConfs); | |
103 | + return frontEndResult; | |
104 | + } | |
105 | + | |
106 | + @RequestMapping(method = RequestMethod.POST, value = "/add") | |
107 | + //@TokenRequired | |
108 | + public void addHospitalCheckItemConf(@RequestBody HospitalCheckItemConf checkItemConf, HttpServletResponse response){ | |
109 | + | |
110 | + if(checkItemConf.getHospitalId()== null || | |
111 | + checkItemConf.getStartWeek() == null|| | |
112 | + checkItemConf.getEndWeek() == null){ | |
113 | + ResultUtils.buildParameterErrorResultAndWrite(response, "请填写必须项!"); | |
114 | + return; | |
115 | + } | |
116 | + | |
117 | + if(checkItemConf.getStartWeek() > checkItemConf.getEndWeek()){ | |
118 | + ResultUtils.buildParameterErrorResultAndWrite(response, "起始周不能大于结束周!"); | |
119 | + return; | |
120 | + } | |
121 | + HospitalCheckItemConfQuery query = new HospitalCheckItemConfQuery(); | |
122 | + query.setHospitalId(checkItemConf.getHospitalId()); | |
123 | + query.setYn(YnEnums.YES.getId()); | |
124 | + List<HospitalCheckItemConf> hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(query); | |
125 | + | |
126 | + boolean noRepeat = true; | |
127 | + if (CollectionUtils.isNotEmpty(hospitalCheckItemConfs)) { | |
128 | + for (HospitalCheckItemConf hospitalCheckItemConf : hospitalCheckItemConfs) { | |
129 | + if(!(checkItemConf.getStartWeek() > hospitalCheckItemConf.getEndWeek() | |
130 | + || checkItemConf.getEndWeek() < hospitalCheckItemConf.getStartWeek())){ | |
131 | + noRepeat = false; | |
132 | + } | |
133 | + } | |
134 | + } | |
135 | + | |
136 | + if(noRepeat){ | |
137 | + checkItemConf.setYn(YnEnums.YES.getId()); | |
138 | + checkItemConf.setCreateTime(new Date()); | |
139 | + checkItemConf.setUpdateTime(new Date()); | |
140 | + hospitalCheckItemConfService.addHospitalCheckItemConf(checkItemConf); | |
141 | + ResultUtils.buildSuccessResultAndWrite(response); | |
142 | + }else{ | |
143 | + ResultUtils.buildParameterErrorResultAndWrite(response, "此范围孕周与已有数据有重合,请确认!"); | |
144 | + } | |
145 | + | |
146 | + } | |
147 | + | |
148 | + @RequestMapping(method = RequestMethod.POST, value = "/update") | |
149 | + //@TokenRequired | |
150 | + public void updateHospitalCheckItemConf(@RequestBody HospitalCheckItemConf checkItemConf, HttpServletResponse response){ | |
151 | + | |
152 | + if (null == checkItemConf.getId()) { | |
153 | + ResultUtils.buildParameterErrorResultAndWrite(response, "请选择要修改的数据"); | |
154 | + return; | |
155 | + } | |
156 | + if (checkItemConf.getStartWeek() > checkItemConf.getEndWeek()) { | |
157 | + ResultUtils.buildParameterErrorResultAndWrite(response, "起始周不能大于结束周!"); | |
158 | + return; | |
159 | + } | |
160 | + | |
161 | + HospitalCheckItemConfQuery query = new HospitalCheckItemConfQuery(); | |
162 | + query.setHospitalId(checkItemConf.getHospitalId()); | |
163 | + query.setYn(YnEnums.YES.getId()); | |
164 | + List<HospitalCheckItemConf> hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(query); | |
165 | + | |
166 | + boolean noRepeat = true; | |
167 | + if (CollectionUtils.isNotEmpty(hospitalCheckItemConfs)) { | |
168 | + for (HospitalCheckItemConf hospitalCheckItemConf : hospitalCheckItemConfs) { | |
169 | + if(hospitalCheckItemConf.getId() != checkItemConf.getId() && | |
170 | + !(checkItemConf.getStartWeek() > hospitalCheckItemConf.getEndWeek() | |
171 | + || checkItemConf.getEndWeek() < hospitalCheckItemConf.getStartWeek())){ | |
172 | + noRepeat = false; | |
173 | + } | |
174 | + } | |
175 | + } | |
176 | + | |
177 | + if(noRepeat){ | |
178 | + checkItemConf.setYn(YnEnums.YES.getId()); | |
179 | + checkItemConf.setUpdateTime(new Date()); | |
180 | + hospitalCheckItemConfService.updateHospitalCheckItemConf(checkItemConf); | |
181 | + ResultUtils.buildSuccessResultAndWrite(response); | |
182 | + }else{ | |
183 | + ResultUtils.buildParameterErrorResultAndWrite(response, "此范围孕周与已有数据有重合,请确认!"); | |
184 | + } | |
185 | + | |
186 | + } | |
187 | + | |
188 | + @RequestMapping(value = "/delete", method = RequestMethod.POST) | |
189 | + public void deleteHospitalCheckItemConf(HttpServletResponse response, @RequestParam("id") Integer id) { | |
190 | + if (null == id) { | |
191 | + ResultUtils.buildParameterErrorResultAndWrite(response, "请选择需要删除的数据"); | |
192 | + return; | |
193 | + } | |
194 | + | |
195 | + HospitalCheckItemConfQuery query = new HospitalCheckItemConfQuery(); | |
196 | + query.setId(id); | |
197 | + List<HospitalCheckItemConf> hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(query); | |
198 | + | |
199 | + if (CollectionUtils.isNotEmpty(hospitalCheckItemConfs)) { | |
200 | + HospitalCheckItemConf checkItemConf = hospitalCheckItemConfs.get(0); | |
201 | + checkItemConf.setYn(YnEnums.NO.getId()); | |
202 | + checkItemConf.setUpdateTime(new Date()); | |
203 | + hospitalCheckItemConfService.updateHospitalCheckItemConf(checkItemConf); | |
204 | + ResultUtils.buildSuccessResultAndWrite(response, "删除成功!"); | |
205 | + | |
206 | + } else { | |
207 | + ResultUtils.buildParameterErrorResultAndWrite(response, "删除数据失败!!"); | |
208 | + } | |
209 | + } | |
210 | + | |
211 | + | |
212 | +} |