Commit e79b591a3019e77f26ec968de2fc3fa1176eb122
1 parent
faba85d900
Exists in
master
and in
6 other branches
公卫2.0-新增儿童健康检查-上传接口
Showing 5 changed files with 629 additions and 1 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveChildInfo.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/UploadResult_Public2.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/Public2PathController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/Public2PathFacade.java
platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
View file @
e79b591
... | ... | @@ -727,7 +727,7 @@ |
727 | 727 | private Integer csDay; //出生孕周: (天) |
728 | 728 | private String mqrsqhb; //母亲妊娠期患病情况: 无、糖尿病、妊娠期高血压 |
729 | 729 | private String csqk; //出生情况:顺产、胎头吸引、产钳、剖宫、多双胎、臀位、其他 |
730 | - private String babySc; //是否建立儿童保健手册:是、否 | |
730 | + private String babySc; //是否建立儿童保健手册:是1、否0 | |
731 | 731 | |
732 | 732 | private String yfCode; //预防接种证条码号 |
733 | 733 | private String reason; //原因 |
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveChildInfo.java
View file @
e79b591
1 | +package com.lyms.hospitalapi.lhxfy.model; | |
2 | + | |
3 | +import com.lyms.platform.common.utils.DateUtil; | |
4 | +import com.lyms.platform.common.utils.StringUtils; | |
5 | +import com.lyms.platform.pojo.BabyModel; | |
6 | + | |
7 | +import java.util.HashMap; | |
8 | +import java.util.List; | |
9 | +import java.util.Map; | |
10 | + | |
11 | +/** | |
12 | + * 公卫2.0-新增儿童花名册 | |
13 | + */ | |
14 | +public class SaveChildInfo { | |
15 | + private List<Object> recordChoice; //类型:Array 可有字段 备注:选项指标记录 | |
16 | + private Integer isAppCreate; //类型:Number 必有字段 备注:各厂商对接时,再确定具体的值 | |
17 | + private Integer childrenBookIsBuild; //类型:Number 必有字段 备注:是否建立儿童保健手册 | |
18 | + private String childrenBookBuildDate; //类型:String 必有字段 备注:建立儿童保健手册时间 | |
19 | + private String closeCaseCode; //类型:String 必有字段 备注:手工结案代码:0否1是 | |
20 | + private String closeCaseReason; //类型:String 必有字段 备注:手工结案原因 | |
21 | + private String malformCode; //类型:String 可有字段 备注:新生儿畸形标志 | |
22 | + private String fatherTelNo; //类型:String 可有字段 备注:父亲电话号码 | |
23 | + private String fatherWorkUnit; //类型:String 可有字段 备注:父亲工作单位 | |
24 | + private String motherTelNo; //类型:String 可有字段 备注:母亲电话号码 | |
25 | + private String motherWorkUnit; //类型:String 可有字段 备注:母亲工作单位 | |
26 | + private String newbornName; //类型:String 可有字段 备注:新生儿姓名 | |
27 | + private String childInfoNo; //类型:String 可有字段 备注:档案编号 | |
28 | + private String newbornSexCode; //类型:String 可有字段 备注:新生儿性别代码 | |
29 | + private String newbornBirthDate; //类型:String 可有字段 备注:新生儿出生日期 | |
30 | + private String newbornIdNo; //类型:String 可有字段 备注:新生儿身份证号码 | |
31 | + private String presentAddrProvince; //东胜区公园街道办事处育才社区育才社区辖组富丽宫西区3-1-301", //类型:String 可有字段 备注:家庭住址 | |
32 | + private Integer isWeakChildren; //类型:Number 可有字段 备注:是否体弱儿(1是,2否) | |
33 | + private Integer birthGestWeeks; //类型:Number 可有字段 备注:出生孕周 | |
34 | + private Integer birthGestDays; //类型:Number 可有字段 备注:出生孕天 | |
35 | + private String deliveryOrgName; //类型:String 可有字段 备注:助产机构名称 | |
36 | + private String asphyxiaCode; //类型:String 可有字段 备注:新生儿窒息标志 | |
37 | + private String suffocationType; //类型:String 可有字段 备注:窒息严重情况 | |
38 | + private String fatherName; //类型:String 可有字段 备注:父亲姓名 | |
39 | + private String fatherId; //类型:String 可有字段 备注:父亲档案ID | |
40 | + private String fatherBirthDate; //类型:String 可有字段 备注:父亲出生日期 | |
41 | + private String fatherOccupCode; //类型:String 可有字段 备注:父亲职业类别代码 | |
42 | + private String fatherIdno; //类型:String 可有字段 备注:父亲身份证号 | |
43 | + private String motherName; //类型:String 可有字段 备注:母亲姓名 | |
44 | + private String motherId; //类型:String 可有字段 备注:母亲档案ID | |
45 | + private String motherBirthDate; //类型:String 可有字段 备注:母亲出生日期 | |
46 | + private String motherIdno; //类型:String 可有字段 备注:母亲身份证号 | |
47 | + private String motherOccupCode; //类型:String 可有字段 备注:母亲职业类别代码 | |
48 | + private String guardian; //类型:String 可有字段 备注:其他监护人 | |
49 | + private String guardianRelation; //类型:String 可有字段 备注:监护人关系 | |
50 | + private String guardianTelNo; //类型:String 可有字段 备注:监护人电话 | |
51 | + private String guardianWorkUnit; //类型:String 可有字段 备注:监护人工作单位 | |
52 | + private String guardianAddress; //类型:String 可有字段 备注:监护人联系地址 | |
53 | + private String respondent; //类型:String 可有字段 备注:被调查人 | |
54 | + private String investigateDate; //类型:String 可有字段 备注:调查时间 | |
55 | + private String personInfoId; //类型:String 必有字段 备注:个人档案ID | |
56 | + | |
57 | + | |
58 | + public void convertToDataModel(BabyModel babyModel){ | |
59 | + | |
60 | + setRecordChoice(babyModel.getRecordChoice()); | |
61 | + setIsAppCreate(babyModel.getIsAppCreate()); | |
62 | + int babaySc=Integer.valueOf(StringUtils.isEmpty(babyModel.getBabySc())?"0":babyModel.getBabySc()); | |
63 | + setChildrenBookIsBuild(babaySc); | |
64 | + setChildrenBookBuildDate(StringUtils.isEmpty(babyModel.getChildrenBookBuildDate())? DateUtil.getyyyy_MM_dd(babyModel.getCreated()):babyModel.getChildrenBookBuildDate()); | |
65 | + setCloseCaseCode(null==babyModel.getEndCase()?"0":babyModel.getEndCase().toString()); | |
66 | + setCloseCaseReason(StringUtils.isEmpty(babyModel.getReason())?"无":babyModel.getReason()); | |
67 | + setCloseCaseReason(null); | |
68 | + setMalformCode(null); | |
69 | + setFatherTelNo(null); | |
70 | + setFatherWorkUnit(null); | |
71 | + setMotherTelNo(null); | |
72 | + setMotherWorkUnit(null); | |
73 | + setNewbornName(null); | |
74 | + setChildInfoNo(null); | |
75 | + setNewbornSexCode(null); | |
76 | + setNewbornBirthDate(null); | |
77 | + setNewbornIdNo(null); | |
78 | + setPresentAddrProvince(null); | |
79 | + setIsWeakChildren(null); | |
80 | + setBirthGestWeeks(null); | |
81 | + setBirthGestDays(null); | |
82 | + setDeliveryOrgName(null); | |
83 | + setAsphyxiaCode(null); | |
84 | + setSuffocationType(null); | |
85 | + setFatherName(null); | |
86 | + setFatherId(null); | |
87 | + setFatherBirthDate(null); | |
88 | + setFatherOccupCode(null); | |
89 | + setFatherIdno(null); | |
90 | + setMotherName(null); | |
91 | + setMotherId(null); | |
92 | + setMotherBirthDate(null); | |
93 | + setMotherIdno(null); | |
94 | + setMotherOccupCode(null); | |
95 | + setGuardian(null); | |
96 | + setGuardianRelation(null); | |
97 | + setGuardianTelNo(null); | |
98 | + setGuardianWorkUnit(null); | |
99 | + setGuardianAddress(null); | |
100 | + setRespondent(null); | |
101 | + setInvestigateDate(null); | |
102 | + setPersonInfoId(babyModel.getId()); | |
103 | + } | |
104 | + | |
105 | + public List<Object> getRecordChoice() { | |
106 | + return recordChoice; | |
107 | + } | |
108 | + | |
109 | + public void setRecordChoice(List<Object> recordChoice) { | |
110 | + this.recordChoice = recordChoice; | |
111 | + } | |
112 | + | |
113 | + public Integer getIsAppCreate() { | |
114 | + return isAppCreate; | |
115 | + } | |
116 | + | |
117 | + public void setIsAppCreate(Integer isAppCreate) { | |
118 | + this.isAppCreate = isAppCreate; | |
119 | + } | |
120 | + | |
121 | + public Integer getChildrenBookIsBuild() { | |
122 | + return childrenBookIsBuild; | |
123 | + } | |
124 | + | |
125 | + public void setChildrenBookIsBuild(Integer childrenBookIsBuild) { | |
126 | + this.childrenBookIsBuild = childrenBookIsBuild; | |
127 | + } | |
128 | + | |
129 | + public String getChildrenBookBuildDate() { | |
130 | + return childrenBookBuildDate; | |
131 | + } | |
132 | + | |
133 | + public void setChildrenBookBuildDate(String childrenBookBuildDate) { | |
134 | + this.childrenBookBuildDate = childrenBookBuildDate; | |
135 | + } | |
136 | + | |
137 | + public String getCloseCaseCode() { | |
138 | + return closeCaseCode; | |
139 | + } | |
140 | + | |
141 | + public void setCloseCaseCode(String closeCaseCode) { | |
142 | + this.closeCaseCode = closeCaseCode; | |
143 | + } | |
144 | + | |
145 | + public String getCloseCaseReason() { | |
146 | + return closeCaseReason; | |
147 | + } | |
148 | + | |
149 | + public void setCloseCaseReason(String closeCaseReason) { | |
150 | + this.closeCaseReason = closeCaseReason; | |
151 | + } | |
152 | + | |
153 | + public String getMalformCode() { | |
154 | + return malformCode; | |
155 | + } | |
156 | + | |
157 | + public void setMalformCode(String malformCode) { | |
158 | + this.malformCode = malformCode; | |
159 | + } | |
160 | + | |
161 | + public String getFatherTelNo() { | |
162 | + return fatherTelNo; | |
163 | + } | |
164 | + | |
165 | + public void setFatherTelNo(String fatherTelNo) { | |
166 | + this.fatherTelNo = fatherTelNo; | |
167 | + } | |
168 | + | |
169 | + public String getFatherWorkUnit() { | |
170 | + return fatherWorkUnit; | |
171 | + } | |
172 | + | |
173 | + public void setFatherWorkUnit(String fatherWorkUnit) { | |
174 | + this.fatherWorkUnit = fatherWorkUnit; | |
175 | + } | |
176 | + | |
177 | + public String getMotherTelNo() { | |
178 | + return motherTelNo; | |
179 | + } | |
180 | + | |
181 | + public void setMotherTelNo(String motherTelNo) { | |
182 | + this.motherTelNo = motherTelNo; | |
183 | + } | |
184 | + | |
185 | + public String getMotherWorkUnit() { | |
186 | + return motherWorkUnit; | |
187 | + } | |
188 | + | |
189 | + public void setMotherWorkUnit(String motherWorkUnit) { | |
190 | + this.motherWorkUnit = motherWorkUnit; | |
191 | + } | |
192 | + | |
193 | + public String getNewbornName() { | |
194 | + return newbornName; | |
195 | + } | |
196 | + | |
197 | + public void setNewbornName(String newbornName) { | |
198 | + this.newbornName = newbornName; | |
199 | + } | |
200 | + | |
201 | + public String getChildInfoNo() { | |
202 | + return childInfoNo; | |
203 | + } | |
204 | + | |
205 | + public void setChildInfoNo(String childInfoNo) { | |
206 | + this.childInfoNo = childInfoNo; | |
207 | + } | |
208 | + | |
209 | + public String getNewbornSexCode() { | |
210 | + return newbornSexCode; | |
211 | + } | |
212 | + | |
213 | + public void setNewbornSexCode(String newbornSexCode) { | |
214 | + this.newbornSexCode = newbornSexCode; | |
215 | + } | |
216 | + | |
217 | + public String getNewbornBirthDate() { | |
218 | + return newbornBirthDate; | |
219 | + } | |
220 | + | |
221 | + public void setNewbornBirthDate(String newbornBirthDate) { | |
222 | + this.newbornBirthDate = newbornBirthDate; | |
223 | + } | |
224 | + | |
225 | + public String getNewbornIdNo() { | |
226 | + return newbornIdNo; | |
227 | + } | |
228 | + | |
229 | + public void setNewbornIdNo(String newbornIdNo) { | |
230 | + this.newbornIdNo = newbornIdNo; | |
231 | + } | |
232 | + | |
233 | + public String getPresentAddrProvince() { | |
234 | + return presentAddrProvince; | |
235 | + } | |
236 | + | |
237 | + public void setPresentAddrProvince(String presentAddrProvince) { | |
238 | + this.presentAddrProvince = presentAddrProvince; | |
239 | + } | |
240 | + | |
241 | + public Integer getIsWeakChildren() { | |
242 | + return isWeakChildren; | |
243 | + } | |
244 | + | |
245 | + public void setIsWeakChildren(Integer isWeakChildren) { | |
246 | + this.isWeakChildren = isWeakChildren; | |
247 | + } | |
248 | + | |
249 | + public Integer getBirthGestWeeks() { | |
250 | + return birthGestWeeks; | |
251 | + } | |
252 | + | |
253 | + public void setBirthGestWeeks(Integer birthGestWeeks) { | |
254 | + this.birthGestWeeks = birthGestWeeks; | |
255 | + } | |
256 | + | |
257 | + public Integer getBirthGestDays() { | |
258 | + return birthGestDays; | |
259 | + } | |
260 | + | |
261 | + public void setBirthGestDays(Integer birthGestDays) { | |
262 | + this.birthGestDays = birthGestDays; | |
263 | + } | |
264 | + | |
265 | + public String getDeliveryOrgName() { | |
266 | + return deliveryOrgName; | |
267 | + } | |
268 | + | |
269 | + public void setDeliveryOrgName(String deliveryOrgName) { | |
270 | + this.deliveryOrgName = deliveryOrgName; | |
271 | + } | |
272 | + | |
273 | + public String getAsphyxiaCode() { | |
274 | + return asphyxiaCode; | |
275 | + } | |
276 | + | |
277 | + public void setAsphyxiaCode(String asphyxiaCode) { | |
278 | + this.asphyxiaCode = asphyxiaCode; | |
279 | + } | |
280 | + | |
281 | + public String getSuffocationType() { | |
282 | + return suffocationType; | |
283 | + } | |
284 | + | |
285 | + public void setSuffocationType(String suffocationType) { | |
286 | + this.suffocationType = suffocationType; | |
287 | + } | |
288 | + | |
289 | + public String getFatherName() { | |
290 | + return fatherName; | |
291 | + } | |
292 | + | |
293 | + public void setFatherName(String fatherName) { | |
294 | + this.fatherName = fatherName; | |
295 | + } | |
296 | + | |
297 | + public String getFatherId() { | |
298 | + return fatherId; | |
299 | + } | |
300 | + | |
301 | + public void setFatherId(String fatherId) { | |
302 | + this.fatherId = fatherId; | |
303 | + } | |
304 | + | |
305 | + public String getFatherBirthDate() { | |
306 | + return fatherBirthDate; | |
307 | + } | |
308 | + | |
309 | + public void setFatherBirthDate(String fatherBirthDate) { | |
310 | + this.fatherBirthDate = fatherBirthDate; | |
311 | + } | |
312 | + | |
313 | + public String getFatherOccupCode() { | |
314 | + return fatherOccupCode; | |
315 | + } | |
316 | + | |
317 | + public void setFatherOccupCode(String fatherOccupCode) { | |
318 | + this.fatherOccupCode = fatherOccupCode; | |
319 | + } | |
320 | + | |
321 | + public String getFatherIdno() { | |
322 | + return fatherIdno; | |
323 | + } | |
324 | + | |
325 | + public void setFatherIdno(String fatherIdno) { | |
326 | + this.fatherIdno = fatherIdno; | |
327 | + } | |
328 | + | |
329 | + public String getMotherName() { | |
330 | + return motherName; | |
331 | + } | |
332 | + | |
333 | + public void setMotherName(String motherName) { | |
334 | + this.motherName = motherName; | |
335 | + } | |
336 | + | |
337 | + public String getMotherId() { | |
338 | + return motherId; | |
339 | + } | |
340 | + | |
341 | + public void setMotherId(String motherId) { | |
342 | + this.motherId = motherId; | |
343 | + } | |
344 | + | |
345 | + public String getMotherBirthDate() { | |
346 | + return motherBirthDate; | |
347 | + } | |
348 | + | |
349 | + public void setMotherBirthDate(String motherBirthDate) { | |
350 | + this.motherBirthDate = motherBirthDate; | |
351 | + } | |
352 | + | |
353 | + public String getMotherIdno() { | |
354 | + return motherIdno; | |
355 | + } | |
356 | + | |
357 | + public void setMotherIdno(String motherIdno) { | |
358 | + this.motherIdno = motherIdno; | |
359 | + } | |
360 | + | |
361 | + public String getMotherOccupCode() { | |
362 | + return motherOccupCode; | |
363 | + } | |
364 | + | |
365 | + public void setMotherOccupCode(String motherOccupCode) { | |
366 | + this.motherOccupCode = motherOccupCode; | |
367 | + } | |
368 | + | |
369 | + public String getGuardian() { | |
370 | + return guardian; | |
371 | + } | |
372 | + | |
373 | + public void setGuardian(String guardian) { | |
374 | + this.guardian = guardian; | |
375 | + } | |
376 | + | |
377 | + public String getGuardianRelation() { | |
378 | + return guardianRelation; | |
379 | + } | |
380 | + | |
381 | + public void setGuardianRelation(String guardianRelation) { | |
382 | + this.guardianRelation = guardianRelation; | |
383 | + } | |
384 | + | |
385 | + public String getGuardianTelNo() { | |
386 | + return guardianTelNo; | |
387 | + } | |
388 | + | |
389 | + public void setGuardianTelNo(String guardianTelNo) { | |
390 | + this.guardianTelNo = guardianTelNo; | |
391 | + } | |
392 | + | |
393 | + public String getGuardianWorkUnit() { | |
394 | + return guardianWorkUnit; | |
395 | + } | |
396 | + | |
397 | + public void setGuardianWorkUnit(String guardianWorkUnit) { | |
398 | + this.guardianWorkUnit = guardianWorkUnit; | |
399 | + } | |
400 | + | |
401 | + public String getGuardianAddress() { | |
402 | + return guardianAddress; | |
403 | + } | |
404 | + | |
405 | + public void setGuardianAddress(String guardianAddress) { | |
406 | + this.guardianAddress = guardianAddress; | |
407 | + } | |
408 | + | |
409 | + public String getRespondent() { | |
410 | + return respondent; | |
411 | + } | |
412 | + | |
413 | + public void setRespondent(String respondent) { | |
414 | + this.respondent = respondent; | |
415 | + } | |
416 | + | |
417 | + public String getInvestigateDate() { | |
418 | + return investigateDate; | |
419 | + } | |
420 | + | |
421 | + public void setInvestigateDate(String investigateDate) { | |
422 | + this.investigateDate = investigateDate; | |
423 | + } | |
424 | + | |
425 | + public String getPersonInfoId() { | |
426 | + return personInfoId; | |
427 | + } | |
428 | + | |
429 | + public void setPersonInfoId(String personInfoId) { | |
430 | + this.personInfoId = personInfoId; | |
431 | + } | |
432 | +} |
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/UploadResult_Public2.java
View file @
e79b591
1 | +package com.lyms.hospitalapi.lhxfy.model; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +/** | |
6 | + * 公卫2.0 返回结果 | |
7 | + * 2021-12-04 | |
8 | + */ | |
9 | +public class UploadResult_Public2 { | |
10 | + //0:上传成功 其他:上传失败 | |
11 | + private String code; | |
12 | + //上传成功/失败的提示信息 | |
13 | + private String message; | |
14 | + //上传成功之后返回的档案 | |
15 | + private List<String> result; | |
16 | + | |
17 | + public String getCode() { | |
18 | + return code; | |
19 | + } | |
20 | + | |
21 | + public void setCode(String code) { | |
22 | + this.code = code; | |
23 | + } | |
24 | + | |
25 | + public String getMessage() { | |
26 | + return message; | |
27 | + } | |
28 | + | |
29 | + public void setMessage(String message) { | |
30 | + this.message = message; | |
31 | + } | |
32 | + | |
33 | + public List<String> getResult() { | |
34 | + return result; | |
35 | + } | |
36 | + | |
37 | + public void setResult(List<String> result) { | |
38 | + this.result = result; | |
39 | + } | |
40 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/Public2PathController.java
View file @
e79b591
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.fasterxml.jackson.annotation.JsonAlias; | |
4 | +import com.lyms.hospitalapi.lcfy.LcTyInterface; | |
5 | +import com.lyms.hospitalapi.lhxfy.LhxfyService; | |
6 | +import com.lyms.platform.common.annotation.TokenRequired; | |
7 | +import com.lyms.platform.common.base.BaseController; | |
8 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
9 | +import com.lyms.platform.common.result.BaseListResponse; | |
10 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
11 | +import com.lyms.platform.common.result.BaseResponse; | |
12 | +import com.lyms.platform.operate.web.facade.Public2PathFacade; | |
13 | +import com.lyms.platform.operate.web.request.*; | |
14 | +import com.lyms.platform.operate.web.service.IPreEugenicsService; | |
15 | +import com.lyms.platform.operate.web.service.impl.PreEugebicsServiceImpl; | |
16 | +import com.lyms.platform.pojo.BasicConfig; | |
17 | +import com.lyms.platform.pojo.PreEugenicsBaseModel; | |
18 | +import org.springframework.beans.factory.annotation.Autowired; | |
19 | +import org.springframework.stereotype.Controller; | |
20 | +import org.springframework.web.bind.annotation.*; | |
21 | + | |
22 | +import javax.servlet.http.HttpServletRequest; | |
23 | +import javax.servlet.http.HttpServletResponse; | |
24 | + | |
25 | + | |
26 | +/** | |
27 | + * 公卫2.0 | |
28 | + */ | |
29 | +@Controller | |
30 | +@RequestMapping("/public2Path") | |
31 | +public class Public2PathController extends BaseController { | |
32 | + | |
33 | + @Autowired | |
34 | + Public2PathFacade public2PathFacade; | |
35 | + | |
36 | + /** | |
37 | + * 公卫2.0-新增儿童健康检查 | |
38 | + * @param startDate | |
39 | + * @param endDate | |
40 | + * @param hospitalId | |
41 | + */ | |
42 | + @ResponseBody | |
43 | + @TokenRequired | |
44 | + @RequestMapping(value = "/saveChildHealthExam", method = RequestMethod.GET) | |
45 | + public BaseResponse saveChildHealthExam(@RequestParam String startDate, | |
46 | + @RequestParam String endDate, | |
47 | + @RequestParam String hospitalId) { | |
48 | + BaseResponse baseResponse=public2PathFacade.saveChildHealthExam(startDate,endDate,hospitalId); | |
49 | + return baseResponse; | |
50 | + } | |
51 | + | |
52 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/Public2PathFacade.java
View file @
e79b591
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.alibaba.fastjson.JSON; | |
4 | +import com.lyms.hospitalapi.lhxfy.model.SaveChildInfo; | |
5 | +import com.lyms.hospitalapi.lhxfy.model.UploadResult; | |
6 | +import com.lyms.hospitalapi.lhxfy.model.UploadResult_Public2; | |
7 | +import com.lyms.platform.biz.service.BabyBookbuildingService; | |
8 | +import com.lyms.platform.biz.service.BabyService; | |
9 | +import com.lyms.platform.common.enums.YnEnums; | |
10 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
11 | +import com.lyms.platform.common.result.BaseResponse; | |
12 | +import com.lyms.platform.common.utils.*; | |
13 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
14 | +import com.lyms.platform.pojo.BabyModel; | |
15 | +import com.lyms.platform.query.BabyModelQuery; | |
16 | +import org.springframework.beans.factory.annotation.Autowired; | |
17 | +import org.springframework.stereotype.Component; | |
18 | + | |
19 | +import java.util.*; | |
20 | +import java.util.concurrent.Callable; | |
21 | +import java.util.concurrent.Future; | |
22 | + | |
23 | +/** | |
24 | + * 公卫2.0-逻辑 | |
25 | + */ | |
26 | +@Component | |
27 | +public class Public2PathFacade { | |
28 | + | |
29 | + @Autowired | |
30 | + BabyBookbuildingService babyBookbuildingService; | |
31 | + | |
32 | + private static final String URL = "http://222.223.187.132:7076/ph-s-report/"; | |
33 | + public BaseResponse saveChildHealthExam(String startDate, String endDate,String hospitalId) { | |
34 | + BaseResponse baseResponse=new BaseResponse(); | |
35 | + BabyModelQuery babyModelQuery=new BabyModelQuery(); | |
36 | + List<String> baseResponseList=new ArrayList<>();//记录错误信息 | |
37 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
38 | + babyModelQuery.setHospitalId(hospitalId); | |
39 | + babyModelQuery.setBuildDateStart(DateUtil.getDayFirstSecond(DateUtil.parseYMD(startDate))); | |
40 | + babyModelQuery.setBuildDateEnd(DateUtil.getDayLastSecond(DateUtil.parseYMD(endDate))); | |
41 | + List<BabyModel> babyModelList = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
42 | + String urladd=URL+"thirdApi/saveChildHealthExam/v1";//新增上传 | |
43 | + for (BabyModel babyModel : babyModelList) { | |
44 | + try { | |
45 | + //数据转换 | |
46 | + String model = buildData(babyModel); | |
47 | + //上传数据 | |
48 | + String result=repeatPost(urladd,model); | |
49 | + if(StringUtils.isNotEmpty(result)){ | |
50 | + List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); | |
51 | + if("0".equals(results.get(0).getCode())){ | |
52 | + baseResponseList.add(babyModel.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
53 | + LogUtil.taskInfo(babyModel.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
54 | + }else { | |
55 | + baseResponseList.add(babyModel.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
56 | + LogUtil.error(babyModel.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage(),null); | |
57 | + } | |
58 | + }else { | |
59 | + baseResponseList.add(babyModel.getId()+"---新增儿童健康检查上传返回结果为null"); | |
60 | + LogUtil.error(babyModel.getId()+"---新增儿童健康检查上传返回结果为null",null); | |
61 | + } | |
62 | + } catch (Exception e) { | |
63 | + e.printStackTrace(); | |
64 | + LogUtil.error(babyModel.getId()+"---"+e.getMessage(),null); | |
65 | + baseResponse.setErrormsg(babyModel.getId()+"---"+e.getMessage()); | |
66 | + } | |
67 | + } | |
68 | + baseResponse.setObject(baseResponseList); | |
69 | + return baseResponse; | |
70 | + } | |
71 | + public String buildData(BabyModel babyModel){ | |
72 | + SaveChildInfo saveChildInfo=new SaveChildInfo(); | |
73 | + saveChildInfo.convertToDataModel(babyModel); | |
74 | + Map<String,Object> mapjson= JSON.parseObject(JSON.toJSONString(saveChildInfo),Map.class); | |
75 | + return JsonUtil.obj2Str(mapjson); | |
76 | + } | |
77 | + /** | |
78 | + * 重试三次 | |
79 | + * @param apiUrl | |
80 | + * @param json | |
81 | + * @return | |
82 | + */ | |
83 | + private String repeatPost(String apiUrl, Object json) | |
84 | + { | |
85 | + for (int i = 0; i <= 2; i++) | |
86 | + { | |
87 | + String result = HttpClientUtil.doPostSSL(apiUrl,json); | |
88 | + if (result == null) | |
89 | + { | |
90 | + try{ | |
91 | + Thread.sleep(1000); | |
92 | + } | |
93 | + catch (Exception e){ | |
94 | + } | |
95 | + continue; | |
96 | + } | |
97 | + else | |
98 | + { | |
99 | + return result; | |
100 | + } | |
101 | + } | |
102 | + return null; | |
103 | + } | |
104 | +} |