Commit 8df2829bf802c12bf219292534448d7652b613c6
1 parent
ed625e1c0a
Exists in
master
and in
6 other branches
update
Showing 8 changed files with 881 additions and 0 deletions
- platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyDeathModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabayDeathController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyDeathListRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyDeathRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyDeathModelResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBabyDeathServer.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyDeathServerImpl.java
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
View file @
8df2829
... | ... | @@ -108,6 +108,7 @@ |
108 | 108 | MatdeliverFollowPushModel("MatdeliverFollowPushModel", -5956731779920504355L), |
109 | 109 | PreEugenicsBaseModel("PreEugenicsBaseModel", 7673224106500008116L), |
110 | 110 | PregnantDeathModel("PregnantDeathModel", 7244731601920572967L), |
111 | + BabyDeathModel("BabyDeathModel", 7244731601924572967L), | |
111 | 112 | CervicalCancerModel("CervicalCancerModel", 4302505773278441592L), |
112 | 113 | DefectiveChildModel("DefectiveChildModel", 1684816144240073408L) |
113 | 114 | ; |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyDeathModel.java
View file @
8df2829
1 | +package com.lyms.platform.pojo; | |
2 | + | |
3 | +import com.lyms.platform.beans.SerialIdEnum; | |
4 | +import com.lyms.platform.common.result.BaseModel; | |
5 | +import org.springframework.data.mongodb.core.mapping.Document; | |
6 | + | |
7 | +import java.util.Date; | |
8 | +import java.util.Map; | |
9 | + | |
10 | + | |
11 | +/** | |
12 | + * @author dongqin | |
13 | + * @description 儿童死亡报告单 | |
14 | + * @date 15:41 2019/11/29 | |
15 | + **/ | |
16 | +@Document(collection = "lyms_baby_death") | |
17 | +public class BabyDeathModel extends BaseModel { | |
18 | + | |
19 | + private static final long serialVersionUID = SerialIdEnum.BabyDeathModel.getCid(); | |
20 | + /** | |
21 | + * 主键 | |
22 | + */ | |
23 | + private String id; | |
24 | + | |
25 | + /** | |
26 | + * 死亡报告的的编号 | |
27 | + */ | |
28 | + private String number; | |
29 | + | |
30 | + private String phone; | |
31 | + | |
32 | + | |
33 | + /** | |
34 | + * 机构地址 | |
35 | + */ | |
36 | + private String orgProvince; | |
37 | + private String orgCity; | |
38 | + private String orgArea; | |
39 | + private String orgName; | |
40 | + | |
41 | + /** | |
42 | + * 居住地址 | |
43 | + */ | |
44 | + private String liveProvince; | |
45 | + private String liveCity; | |
46 | + private String liveArea; | |
47 | + private String liveStreet; | |
48 | + private String liveAddress; | |
49 | + | |
50 | + /** | |
51 | + * 父亲姓名 | |
52 | + */ | |
53 | + private String faterName; | |
54 | + | |
55 | + /** | |
56 | + * 母亲姓名 | |
57 | + */ | |
58 | + private String mommyName; | |
59 | + | |
60 | + /** | |
61 | + * 儿童姓名 | |
62 | + */ | |
63 | + private String babyName; | |
64 | + | |
65 | + /** | |
66 | + * 户籍 | |
67 | + */ | |
68 | + private String registerType; | |
69 | + | |
70 | + /** | |
71 | + * 性别 | |
72 | + */ | |
73 | + private Integer sex; | |
74 | + | |
75 | + /** | |
76 | + * 生日 | |
77 | + */ | |
78 | + private Date birth; | |
79 | + | |
80 | + /** | |
81 | + * 体重 | |
82 | + */ | |
83 | + private String weight; | |
84 | + | |
85 | + /** | |
86 | + * 体重测量类型 | |
87 | + */ | |
88 | + private String weightType; | |
89 | + | |
90 | + /** | |
91 | + * 孕周 | |
92 | + */ | |
93 | + private String week; | |
94 | + | |
95 | + /** | |
96 | + * 死亡日期 | |
97 | + */ | |
98 | + private Date deathDate; | |
99 | + | |
100 | + /** | |
101 | + * 表单数据,前端同事自定义 | |
102 | + */ | |
103 | + private Map<String, Object> formData; | |
104 | + | |
105 | + private String userId; | |
106 | + | |
107 | + private String hospitalId; | |
108 | + | |
109 | + private Date created; | |
110 | + | |
111 | + private Date modifed; | |
112 | + | |
113 | + public String getPhone() { | |
114 | + return phone; | |
115 | + } | |
116 | + | |
117 | + public void setPhone(String phone) { | |
118 | + this.phone = phone; | |
119 | + } | |
120 | + | |
121 | + public String getUserId() { | |
122 | + return userId; | |
123 | + } | |
124 | + | |
125 | + public void setUserId(String userId) { | |
126 | + this.userId = userId; | |
127 | + } | |
128 | + | |
129 | + public String getHospitalId() { | |
130 | + return hospitalId; | |
131 | + } | |
132 | + | |
133 | + public void setHospitalId(String hospitalId) { | |
134 | + this.hospitalId = hospitalId; | |
135 | + } | |
136 | + | |
137 | + public Date getCreated() { | |
138 | + return created; | |
139 | + } | |
140 | + | |
141 | + public void setCreated(Date created) { | |
142 | + this.created = created; | |
143 | + } | |
144 | + | |
145 | + public Date getModifed() { | |
146 | + return modifed; | |
147 | + } | |
148 | + | |
149 | + public void setModifed(Date modifed) { | |
150 | + this.modifed = modifed; | |
151 | + } | |
152 | + | |
153 | + public String getId() { | |
154 | + return id; | |
155 | + } | |
156 | + | |
157 | + public void setId(String id) { | |
158 | + this.id = id; | |
159 | + } | |
160 | + | |
161 | + public String getNumber() { | |
162 | + return number; | |
163 | + } | |
164 | + | |
165 | + public void setNumber(String number) { | |
166 | + this.number = number; | |
167 | + } | |
168 | + | |
169 | + public String getOrgProvince() { | |
170 | + return orgProvince; | |
171 | + } | |
172 | + | |
173 | + public void setOrgProvince(String orgProvince) { | |
174 | + this.orgProvince = orgProvince; | |
175 | + } | |
176 | + | |
177 | + public String getOrgCity() { | |
178 | + return orgCity; | |
179 | + } | |
180 | + | |
181 | + public void setOrgCity(String orgCity) { | |
182 | + this.orgCity = orgCity; | |
183 | + } | |
184 | + | |
185 | + public String getOrgArea() { | |
186 | + return orgArea; | |
187 | + } | |
188 | + | |
189 | + public void setOrgArea(String orgArea) { | |
190 | + this.orgArea = orgArea; | |
191 | + } | |
192 | + | |
193 | + public String getOrgName() { | |
194 | + return orgName; | |
195 | + } | |
196 | + | |
197 | + public void setOrgName(String orgName) { | |
198 | + this.orgName = orgName; | |
199 | + } | |
200 | + | |
201 | + public String getLiveProvince() { | |
202 | + return liveProvince; | |
203 | + } | |
204 | + | |
205 | + public void setLiveProvince(String liveProvince) { | |
206 | + this.liveProvince = liveProvince; | |
207 | + } | |
208 | + | |
209 | + public String getLiveCity() { | |
210 | + return liveCity; | |
211 | + } | |
212 | + | |
213 | + public void setLiveCity(String liveCity) { | |
214 | + this.liveCity = liveCity; | |
215 | + } | |
216 | + | |
217 | + public String getLiveArea() { | |
218 | + return liveArea; | |
219 | + } | |
220 | + | |
221 | + public void setLiveArea(String liveArea) { | |
222 | + this.liveArea = liveArea; | |
223 | + } | |
224 | + | |
225 | + public String getLiveStreet() { | |
226 | + return liveStreet; | |
227 | + } | |
228 | + | |
229 | + public void setLiveStreet(String liveStreet) { | |
230 | + this.liveStreet = liveStreet; | |
231 | + } | |
232 | + | |
233 | + public String getLiveAddress() { | |
234 | + return liveAddress; | |
235 | + } | |
236 | + | |
237 | + public void setLiveAddress(String liveAddress) { | |
238 | + this.liveAddress = liveAddress; | |
239 | + } | |
240 | + | |
241 | + public String getFaterName() { | |
242 | + return faterName; | |
243 | + } | |
244 | + | |
245 | + public void setFaterName(String faterName) { | |
246 | + this.faterName = faterName; | |
247 | + } | |
248 | + | |
249 | + public String getMommyName() { | |
250 | + return mommyName; | |
251 | + } | |
252 | + | |
253 | + public void setMommyName(String mommyName) { | |
254 | + this.mommyName = mommyName; | |
255 | + } | |
256 | + | |
257 | + public String getBabyName() { | |
258 | + return babyName; | |
259 | + } | |
260 | + | |
261 | + public void setBabyName(String babyName) { | |
262 | + this.babyName = babyName; | |
263 | + } | |
264 | + | |
265 | + public String getRegisterType() { | |
266 | + return registerType; | |
267 | + } | |
268 | + | |
269 | + public void setRegisterType(String registerType) { | |
270 | + this.registerType = registerType; | |
271 | + } | |
272 | + | |
273 | + public Integer getSex() { | |
274 | + return sex; | |
275 | + } | |
276 | + | |
277 | + public void setSex(Integer sex) { | |
278 | + this.sex = sex; | |
279 | + } | |
280 | + | |
281 | + public Date getBirth() { | |
282 | + return birth; | |
283 | + } | |
284 | + | |
285 | + public void setBirth(Date birth) { | |
286 | + this.birth = birth; | |
287 | + } | |
288 | + | |
289 | + public String getWeight() { | |
290 | + return weight; | |
291 | + } | |
292 | + | |
293 | + public void setWeight(String weight) { | |
294 | + this.weight = weight; | |
295 | + } | |
296 | + | |
297 | + public String getWeightType() { | |
298 | + return weightType; | |
299 | + } | |
300 | + | |
301 | + public void setWeightType(String weightType) { | |
302 | + this.weightType = weightType; | |
303 | + } | |
304 | + | |
305 | + public String getWeek() { | |
306 | + return week; | |
307 | + } | |
308 | + | |
309 | + public void setWeek(String week) { | |
310 | + this.week = week; | |
311 | + } | |
312 | + | |
313 | + public Date getDeathDate() { | |
314 | + return deathDate; | |
315 | + } | |
316 | + | |
317 | + public void setDeathDate(Date deathDate) { | |
318 | + this.deathDate = deathDate; | |
319 | + } | |
320 | + | |
321 | + public Map<String, Object> getFormData() { | |
322 | + return formData; | |
323 | + } | |
324 | + | |
325 | + public void setFormData(Map<String, Object> formData) { | |
326 | + this.formData = formData; | |
327 | + } | |
328 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabayDeathController.java
View file @
8df2829
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.fasterxml.jackson.annotation.JsonAlias; | |
4 | +import com.lyms.platform.common.annotation.TokenRequired; | |
5 | +import com.lyms.platform.common.base.BaseController; | |
6 | +import com.lyms.platform.common.result.BaseListResponse; | |
7 | +import com.lyms.platform.common.result.BaseResponse; | |
8 | +import com.lyms.platform.operate.web.request.*; | |
9 | +import com.lyms.platform.operate.web.service.IBabyDeathServer; | |
10 | +import com.lyms.platform.operate.web.service.IPregnantDeathServer; | |
11 | +import org.springframework.beans.factory.annotation.Autowired; | |
12 | +import org.springframework.stereotype.Controller; | |
13 | +import org.springframework.web.bind.annotation.RequestBody; | |
14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
15 | +import org.springframework.web.bind.annotation.RequestMethod; | |
16 | +import org.springframework.web.bind.annotation.ResponseBody; | |
17 | + | |
18 | +import javax.servlet.http.HttpServletRequest; | |
19 | + | |
20 | +/** | |
21 | + * @author dongqin | |
22 | + * @description 儿童死亡报告卡 | |
23 | + * @date 16:05 2019/11/29 | |
24 | + **/ | |
25 | +@Controller | |
26 | +@RequestMapping("/babyDeath") | |
27 | +public class BabayDeathController extends BaseController { | |
28 | + | |
29 | + @Autowired | |
30 | + private IBabyDeathServer babyDeathServer; | |
31 | + | |
32 | + /** | |
33 | + * | |
34 | + * 根据身份证号获取对应的建档信息 | |
35 | + * | |
36 | + * @param param | |
37 | + * @return | |
38 | + */ | |
39 | + @RequestMapping(method = RequestMethod.GET, value = "/getPatientInfoByIdCard") | |
40 | + @ResponseBody | |
41 | + @TokenRequired | |
42 | + public BaseResponse getPatientInfoByIdCard(@JsonAlias CommonParamRequest param,HttpServletRequest request) { | |
43 | + return babyDeathServer.getPatientInfoByIdCard(param,getUserId(request)); | |
44 | + } | |
45 | + | |
46 | + | |
47 | + /** | |
48 | + * 保存单个 | |
49 | + * | |
50 | + * @param param | |
51 | + * @return | |
52 | + */ | |
53 | + @RequestMapping(method = RequestMethod.POST, value = "/add") | |
54 | + @ResponseBody | |
55 | + @TokenRequired | |
56 | + public BaseResponse add(@RequestBody BabyDeathRequest param, HttpServletRequest request) { | |
57 | + param.setUserId(getUserId(request).toString()); | |
58 | + return babyDeathServer.add(param,getUserId(request)); | |
59 | + } | |
60 | + | |
61 | + /** | |
62 | + * 编辑单个 | |
63 | + * | |
64 | + * @param param | |
65 | + * @return | |
66 | + */ | |
67 | + @RequestMapping(method = RequestMethod.POST, value = "/edit") | |
68 | + @ResponseBody | |
69 | + @TokenRequired | |
70 | + public BaseResponse edit( @RequestBody BabyDeathRequest param) { | |
71 | + return babyDeathServer.edit(param); | |
72 | + } | |
73 | + | |
74 | + /** | |
75 | + * 列表 | |
76 | + * | |
77 | + * @param param | |
78 | + * @return | |
79 | + */ | |
80 | + @RequestMapping(method = RequestMethod.GET, value = "/listPage") | |
81 | + @ResponseBody | |
82 | + @TokenRequired | |
83 | + public BaseListResponse listPage(@JsonAlias BabyDeathListRequest param,HttpServletRequest request) { | |
84 | + return babyDeathServer.listPage(param,getUserId(request)); | |
85 | + } | |
86 | + | |
87 | + /** | |
88 | + * 单个查询 | |
89 | + * | |
90 | + * @param param | |
91 | + * @return | |
92 | + */ | |
93 | + @RequestMapping(method = RequestMethod.GET, value = "/detail") | |
94 | + @ResponseBody | |
95 | + @TokenRequired | |
96 | + public BaseResponse detail( @JsonAlias BabyDeathRequest param) { | |
97 | + return babyDeathServer.detail(param); | |
98 | + } | |
99 | + | |
100 | + | |
101 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyDeathListRequest.java
View file @
8df2829
1 | +package com.lyms.platform.operate.web.request; | |
2 | + | |
3 | +import com.lyms.platform.common.dao.BaseQuery; | |
4 | + | |
5 | +public class BabyDeathListRequest extends BaseQuery { | |
6 | + | |
7 | + /** | |
8 | + * 死亡报告卡的编号 | |
9 | + */ | |
10 | + private String number; | |
11 | + | |
12 | + /** | |
13 | + * 母亲 父亲 儿童姓名 | |
14 | + */ | |
15 | + private String name; | |
16 | + | |
17 | + /** | |
18 | + * 手机号 | |
19 | + */ | |
20 | + private String phone; | |
21 | + | |
22 | + | |
23 | + /** | |
24 | + * 创建时间 | |
25 | + */ | |
26 | + private String startCreated; | |
27 | + private String endCreated; | |
28 | + private String deathDateStart; | |
29 | + private String endCreatedEnd; | |
30 | + | |
31 | + /** | |
32 | + * 居住地址 省市区街道详细地址 | |
33 | + */ | |
34 | + private String liveProvince; | |
35 | + private String liveCity; | |
36 | + private String liveArea; | |
37 | + private String liveStreet; | |
38 | + | |
39 | + | |
40 | + public String getNumber() { | |
41 | + return number; | |
42 | + } | |
43 | + | |
44 | + public void setNumber(String number) { | |
45 | + this.number = number; | |
46 | + } | |
47 | + | |
48 | + public String getName() { | |
49 | + return name; | |
50 | + } | |
51 | + | |
52 | + public void setName(String name) { | |
53 | + this.name = name; | |
54 | + } | |
55 | + | |
56 | + public String getPhone() { | |
57 | + return phone; | |
58 | + } | |
59 | + | |
60 | + public void setPhone(String phone) { | |
61 | + this.phone = phone; | |
62 | + } | |
63 | + | |
64 | + public String getStartCreated() { | |
65 | + return startCreated; | |
66 | + } | |
67 | + | |
68 | + public void setStartCreated(String startCreated) { | |
69 | + this.startCreated = startCreated; | |
70 | + } | |
71 | + | |
72 | + public String getEndCreated() { | |
73 | + return endCreated; | |
74 | + } | |
75 | + | |
76 | + public void setEndCreated(String endCreated) { | |
77 | + this.endCreated = endCreated; | |
78 | + } | |
79 | + | |
80 | + public String getDeathDateStart() { | |
81 | + return deathDateStart; | |
82 | + } | |
83 | + | |
84 | + public void setDeathDateStart(String deathDateStart) { | |
85 | + this.deathDateStart = deathDateStart; | |
86 | + } | |
87 | + | |
88 | + public String getEndCreatedEnd() { | |
89 | + return endCreatedEnd; | |
90 | + } | |
91 | + | |
92 | + public void setEndCreatedEnd(String endCreatedEnd) { | |
93 | + this.endCreatedEnd = endCreatedEnd; | |
94 | + } | |
95 | + | |
96 | + public String getLiveProvince() { | |
97 | + return liveProvince; | |
98 | + } | |
99 | + | |
100 | + public void setLiveProvince(String liveProvince) { | |
101 | + this.liveProvince = liveProvince; | |
102 | + } | |
103 | + | |
104 | + public String getLiveCity() { | |
105 | + return liveCity; | |
106 | + } | |
107 | + | |
108 | + public void setLiveCity(String liveCity) { | |
109 | + this.liveCity = liveCity; | |
110 | + } | |
111 | + | |
112 | + public String getLiveStreet() { | |
113 | + return liveStreet; | |
114 | + } | |
115 | + | |
116 | + public void setLiveStreet(String liveStreet) { | |
117 | + this.liveStreet = liveStreet; | |
118 | + } | |
119 | + | |
120 | + public String getLiveArea() { | |
121 | + return liveArea; | |
122 | + } | |
123 | + | |
124 | + public void setLiveArea(String liveArea) { | |
125 | + this.liveArea = liveArea; | |
126 | + } | |
127 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyDeathRequest.java
View file @
8df2829
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyDeathModelResult.java
View file @
8df2829
1 | +package com.lyms.platform.operate.web.result; | |
2 | + | |
3 | +import com.lyms.platform.pojo.BabyDeathModel; | |
4 | + | |
5 | +public class BabyDeathModelResult extends BabyDeathModel { | |
6 | + /** | |
7 | + * 居住地址 省市区街道详细地址 | |
8 | + */ | |
9 | + private String liveAddressStr; | |
10 | + | |
11 | + /** | |
12 | + * 暂住地址 省市区街道详细地址 | |
13 | + */ | |
14 | + private String orgAddressStr; | |
15 | + | |
16 | + /** | |
17 | + * 填写单位 | |
18 | + */ | |
19 | + private String hospitalStr; | |
20 | + | |
21 | + /** | |
22 | + * 填写人 | |
23 | + */ | |
24 | + private String createUserStr; | |
25 | + | |
26 | + public String getLiveAddressStr() { | |
27 | + return liveAddressStr; | |
28 | + } | |
29 | + | |
30 | + public void setLiveAddressStr(String liveAddressStr) { | |
31 | + this.liveAddressStr = liveAddressStr; | |
32 | + } | |
33 | + | |
34 | + public String getOrgAddressStr() { | |
35 | + return orgAddressStr; | |
36 | + } | |
37 | + | |
38 | + public void setOrgAddressStr(String orgAddressStr) { | |
39 | + this.orgAddressStr = orgAddressStr; | |
40 | + } | |
41 | + | |
42 | + public String getHospitalStr() { | |
43 | + return hospitalStr; | |
44 | + } | |
45 | + | |
46 | + public void setHospitalStr(String hospitalStr) { | |
47 | + this.hospitalStr = hospitalStr; | |
48 | + } | |
49 | + | |
50 | + public String getCreateUserStr() { | |
51 | + return createUserStr; | |
52 | + } | |
53 | + | |
54 | + public void setCreateUserStr(String createUserStr) { | |
55 | + this.createUserStr = createUserStr; | |
56 | + } | |
57 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBabyDeathServer.java
View file @
8df2829
1 | +package com.lyms.platform.operate.web.service; | |
2 | + | |
3 | +import com.lyms.platform.operate.web.request.BabyDeathListRequest; | |
4 | +import com.lyms.platform.operate.web.request.BabyDeathRequest; | |
5 | + | |
6 | +public interface IBabyDeathServer extends IFormReportService<BabyDeathRequest, BabyDeathListRequest> { | |
7 | + | |
8 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyDeathServerImpl.java
View file @
8df2829
1 | +package com.lyms.platform.operate.web.service.impl; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
4 | +import com.lyms.platform.common.result.BaseListResponse; | |
5 | +import com.lyms.platform.common.result.BaseResponse; | |
6 | +import com.lyms.platform.common.utils.DateUtil; | |
7 | +import com.lyms.platform.common.utils.MongoConvertHelper; | |
8 | +import com.lyms.platform.common.utils.ReflectionUtils; | |
9 | +import com.lyms.platform.common.utils.StringUtils; | |
10 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
11 | +import com.lyms.platform.operate.web.request.*; | |
12 | +import com.lyms.platform.operate.web.result.BabyDeathModelResult; | |
13 | +import com.lyms.platform.operate.web.service.IBabyDeathServer; | |
14 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
15 | +import com.lyms.platform.permission.model.Organization; | |
16 | +import com.lyms.platform.permission.model.Users; | |
17 | +import com.lyms.platform.permission.service.OrganizationService; | |
18 | +import com.lyms.platform.permission.service.UsersService; | |
19 | +import com.lyms.platform.pojo.*; | |
20 | +import org.springframework.beans.BeanUtils; | |
21 | +import org.springframework.beans.factory.annotation.Autowired; | |
22 | +import org.springframework.data.domain.Sort; | |
23 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
24 | +import org.springframework.data.mongodb.core.query.Criteria; | |
25 | +import org.springframework.data.mongodb.core.query.Query; | |
26 | +import org.springframework.data.mongodb.core.query.Update; | |
27 | +import org.springframework.stereotype.Service; | |
28 | + | |
29 | +import java.util.Date; | |
30 | +import java.util.LinkedList; | |
31 | +import java.util.List; | |
32 | + | |
33 | +@Service | |
34 | +public class BabyDeathServerImpl implements IBabyDeathServer { | |
35 | + | |
36 | + @Autowired | |
37 | + private MongoTemplate mongoTemplate; | |
38 | + | |
39 | + @Autowired | |
40 | + private BasicConfigService basicConfigService; | |
41 | + | |
42 | + @Autowired | |
43 | + private OrganizationService organizationService; | |
44 | + | |
45 | + @Autowired | |
46 | + private UsersService usersService; | |
47 | + | |
48 | + | |
49 | + @Autowired | |
50 | + private AutoMatchFacade autoMatchFacade; | |
51 | + | |
52 | + | |
53 | + /** | |
54 | + * 保存单个 | |
55 | + * | |
56 | + * @param param | |
57 | + * @return | |
58 | + */ | |
59 | + @Override | |
60 | + public BaseResponse add(BabyDeathRequest param,Integer userId) { | |
61 | + param.setCreated(new Date()); | |
62 | + param.setHospitalId(autoMatchFacade.getHospitalId(userId)); | |
63 | + mongoTemplate.insert(param); | |
64 | + return new BaseResponse(); | |
65 | + } | |
66 | + | |
67 | + /** | |
68 | + * 编辑单个 | |
69 | + * | |
70 | + * @param param | |
71 | + * @return | |
72 | + */ | |
73 | + @Override | |
74 | + public BaseResponse edit(BabyDeathRequest param) { | |
75 | + Query query = Query.query(Criteria.where("id").is(param.getId())); | |
76 | + Update update = MongoConvertHelper | |
77 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(param)); | |
78 | + mongoTemplate.updateFirst(query, update, PregnantDeathModel.class); | |
79 | + return new BaseResponse(); | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * 列表 | |
84 | + * | |
85 | + * @param param | |
86 | + * @return | |
87 | + */ | |
88 | + @Override | |
89 | + public BaseListResponse listPage(BabyDeathListRequest param,Integer userId) { | |
90 | + | |
91 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
92 | + | |
93 | + Query query = new Query(); | |
94 | + // 编号 | |
95 | + String number = param.getNumber(); | |
96 | + if (StringUtils.isNotEmpty(number)) { | |
97 | + query.addCriteria(Criteria.where("number").is(number)); | |
98 | + } | |
99 | + // 姓名 | |
100 | + String name = param.getName(); | |
101 | + if (StringUtils.isNotEmpty(name)) { | |
102 | + query.addCriteria(new Criteria().orOperator(Criteria.where("fatherName").is(name), Criteria.where("mommyName").is(name), Criteria.where("babyName").is(name))); | |
103 | + } | |
104 | + // 手机号 | |
105 | + String phone = param.getPhone(); | |
106 | + if (StringUtils.isNotEmpty(phone)) { | |
107 | + query.addCriteria(Criteria.where("phone").is(phone)); | |
108 | + } | |
109 | + | |
110 | + // 填写单位 | |
111 | + query.addCriteria(Criteria.where("hospitalId").is(hospitalId)); | |
112 | + // 填写时间 | |
113 | + String startCreated = param.getStartCreated(); | |
114 | + String endCreated = param.getEndCreated(); | |
115 | + if (StringUtils.isNotEmpty(startCreated) && StringUtils.isNotEmpty(endCreated)) { | |
116 | + Date startDate = DateUtil.parseYMD(startCreated); | |
117 | + Date dayFirstSecond = DateUtil.getDayFirstSecond(startDate); | |
118 | + Date endDate = DateUtil.parseYMD(endCreated); | |
119 | + Date dayLastSecond = DateUtil.getDayLastSecond(endDate); | |
120 | + query.addCriteria(Criteria.where("created").gte(dayFirstSecond).lte(dayLastSecond)); | |
121 | + } | |
122 | + | |
123 | + | |
124 | + // 死亡时间 | |
125 | + String deathDateStart = param.getDeathDateStart(); | |
126 | + String deathDateEnd = param.getDeathDateStart(); | |
127 | + if (StringUtils.isNotEmpty(deathDateStart) && StringUtils.isNotEmpty(deathDateEnd)) { | |
128 | + Date startDate = DateUtil.parseYMD(deathDateStart); | |
129 | + Date dayFirstSecond = DateUtil.getDayFirstSecond(startDate); | |
130 | + Date endDate = DateUtil.parseYMD(deathDateEnd); | |
131 | + Date dayLastSecond = DateUtil.getDayLastSecond(endDate); | |
132 | + query.addCriteria(Criteria.where("deathDate").gte(dayFirstSecond).lte(dayLastSecond)); | |
133 | + } | |
134 | + | |
135 | + | |
136 | + // 居住地址 | |
137 | + String liveProvince = param.getLiveProvince(); | |
138 | + if (StringUtils.isNotEmpty(liveProvince)) { | |
139 | + query.addCriteria(Criteria.where("liveProvince").is(liveProvince)); | |
140 | + String liveCity = param.getLiveCity(); | |
141 | + if (StringUtils.isNotEmpty(liveCity)) { | |
142 | + query.addCriteria(Criteria.where("liveCity").is(liveCity)); | |
143 | + String liveArea = param.getLiveArea(); | |
144 | + if (StringUtils.isNotEmpty(liveArea)) { | |
145 | + query.addCriteria(Criteria.where("liveArea").is(liveArea)); | |
146 | + String liveStreet = param.getLiveStreet(); | |
147 | + if (StringUtils.isNotEmpty(liveStreet)) { | |
148 | + query.addCriteria(Criteria.where("liveStreet").is(liveStreet)); | |
149 | + } | |
150 | + } | |
151 | + } | |
152 | + } | |
153 | + | |
154 | + query.with(new Sort(Sort.Direction.DESC, "created")); | |
155 | + long count = mongoTemplate.count(query, BabyDeathModel.class); | |
156 | + param.mysqlBuild((int) count); | |
157 | + query.skip(param.getOffset()).limit(param.getLimit()); | |
158 | + List<BabyDeathModelResult> results = new LinkedList<>(); | |
159 | + List<BabyDeathModel> models = mongoTemplate.find(query, BabyDeathModel.class); | |
160 | + for (BabyDeathModel model : models) { | |
161 | + BabyDeathModelResult result = new BabyDeathModelResult(); | |
162 | + getOtherStr(result, model); | |
163 | + results.add(result); | |
164 | + } | |
165 | + | |
166 | + BaseListResponse baseListResponse = new BaseListResponse(); | |
167 | + baseListResponse.setData(results); | |
168 | + baseListResponse.setPageInfo(param.getPageInfo()); | |
169 | + return baseListResponse; | |
170 | + } | |
171 | + | |
172 | + /** | |
173 | + * 单个查询 | |
174 | + * | |
175 | + * @param param | |
176 | + * @return | |
177 | + */ | |
178 | + @Override | |
179 | + public BaseResponse detail(BabyDeathRequest param) { | |
180 | + String id = param.getId(); | |
181 | + if (StringUtils.isEmpty(id)) { | |
182 | + return new BaseResponse(); | |
183 | + } | |
184 | + BabyDeathModelResult result = new BabyDeathModelResult(); | |
185 | + BabyDeathModel model = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), BabyDeathModel.class); | |
186 | + if (model != null) { | |
187 | + getOtherStr(result, model); | |
188 | + } | |
189 | + BaseResponse baseResponse = new BaseResponse(); | |
190 | + baseResponse.setObject(result); | |
191 | + return baseResponse; | |
192 | + } | |
193 | + | |
194 | + private void getOtherStr(BabyDeathModelResult result,BabyDeathModel model) { | |
195 | + BeanUtils.copyProperties(model, result); | |
196 | + result.setLiveAddressStr(CommonsHelper.getResidence( | |
197 | + result.getLiveProvince(), | |
198 | + result.getLiveCity(), | |
199 | + result.getLiveArea(), | |
200 | + result.getLiveStreet(), | |
201 | + result.getLiveAddress(), | |
202 | + basicConfigService)); | |
203 | + result.setOrgAddressStr(CommonsHelper.getResidence( | |
204 | + result.getOrgProvince(), | |
205 | + result.getOrgCity(), | |
206 | + result.getOrgArea(), | |
207 | + null, | |
208 | + null, | |
209 | + basicConfigService | |
210 | + )); | |
211 | + String createUser = result.getUserId(); | |
212 | + if (StringUtils.isNotEmpty(createUser)) { | |
213 | + Users users = usersService.getUsers(Integer.parseInt(createUser)); | |
214 | + if (users != null) { | |
215 | + result.setCreateUserStr(users.getName()); | |
216 | + } | |
217 | + } | |
218 | + String hospitalId = result.getHospitalId(); | |
219 | + if (StringUtils.isNotEmpty(hospitalId)) { | |
220 | + Organization organization = organizationService.getOrganization(Integer.parseInt(hospitalId)); | |
221 | + if (organization != null) { | |
222 | + result.setHospitalStr(organization.getName()); | |
223 | + } | |
224 | + } | |
225 | + } | |
226 | + | |
227 | + /** | |
228 | + * 根据身份证号获取对应的信息 | |
229 | + * | |
230 | + * @param param | |
231 | + * @return | |
232 | + */ | |
233 | + @Override | |
234 | + public BaseResponse getPatientInfoByIdCard(CommonParamRequest param,Integer userId) { | |
235 | + Query query = new Query(); | |
236 | + String code = param.getCode(); | |
237 | + if (StringUtils.isNotEmpty(code)) { | |
238 | + query.addCriteria(Criteria.where("code").is(code)); | |
239 | + } | |
240 | + BabyDeathModel model = mongoTemplate.findOne(query.with(new Sort(Sort.Direction.DESC, "created")), BabyDeathModel.class); | |
241 | + BabyDeathModelResult result = new BabyDeathModelResult(); | |
242 | + if (model != null) { | |
243 | + getOtherStr(result, model); | |
244 | + BaseResponse baseResponse = new BaseResponse(); | |
245 | + baseResponse.setObject(result); | |
246 | + return baseResponse; | |
247 | + } | |
248 | + BaseResponse baseResponse = new BaseResponse(); | |
249 | + baseResponse.setObject(result); | |
250 | + return baseResponse; | |
251 | + } | |
252 | +} |