Commit 300a541bdadcda2e96391ebbc70cb296cb28db8c

Authored by liquanyu
1 parent af3b6e8309
Exists in master and in 1 other branch dev

妇女建档打印、儿童微量元素

Showing 16 changed files with 718 additions and 216 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 300a541
... ... @@ -6507,6 +6507,59 @@
6507 6507 }
6508 6508 }
6509 6509  
  6510 +
  6511 +
  6512 + public static void saveBabyMicroelements(String fileName) {
  6513 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  6514 + MongoTemplate mongoTemplate
  6515 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  6516 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  6517 + File file = new File(fileName);
  6518 + Workbook wb = null;
  6519 + try {
  6520 + wb = Workbook.getWorkbook(file);
  6521 +
  6522 + Sheet s = wb.getSheet(0);
  6523 + System.out.println(s.getName() + " : ");
  6524 + int rows = s.getRows();
  6525 + if (rows > 0) {
  6526 + //遍历每行
  6527 + for (int i = 1; i < rows; i++) {
  6528 + System.out.println("rows=" + i);
  6529 + MicroelementConfigModel model = new MicroelementConfigModel();
  6530 + model.setType(1);
  6531 + Cell[] cells = s.getRow(i);
  6532 + if (cells.length > 0) {
  6533 + for (int j = 0; j < cells.length; j++) {
  6534 + String str = cells[j].getContents().trim();
  6535 + switch (j) {
  6536 + case 0:
  6537 + model.setStartWeek(Integer.parseInt(str));
  6538 + continue;
  6539 + case 1:
  6540 + model.setEndWeek(Integer.parseInt(str));
  6541 + continue;
  6542 + case 2:
  6543 + model.setStatus(Integer.parseInt(str));
  6544 + continue;
  6545 + case 3:
  6546 + model.setEleName(str);
  6547 + continue;
  6548 + case 4:
  6549 + List<String> list2 = Arrays.asList(str.split("\n"));
  6550 + model.setContents(list2);
  6551 + continue;
  6552 + }
  6553 + }
  6554 + }
  6555 + mongoTemplate.save(model);
  6556 + }
  6557 + }
  6558 + } catch (Exception e) {
  6559 + e.printStackTrace();
  6560 + }
  6561 + }
  6562 +
6510 6563 public static void main(String[] args) {
6511 6564 // getData();
6512 6565 //weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
... ... @@ -6553,7 +6606,8 @@
6553 6606  
6554 6607 //saveDiteSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\每类食物不爱吃的指导建议.xls");
6555 6608 //saveDiteDoctorSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\医生建议内容.xls");
6556   - saveMicroelements("E:\\dev\\微量元素指导报告模板.xls");
  6609 + //saveMicroelements("E:\\dev\\微量元素指导报告模板.xls");
  6610 + saveBabyMicroelements("F:\\技术文档\\儿童微量元素\\儿童微量元素指导报告模板.xls");
6557 6611  
6558 6612 }
6559 6613  
platform-dal/src/main/java/com/lyms/platform/pojo/MicroelementConfigModel.java View file @ 300a541
... ... @@ -21,11 +21,40 @@
21 21 private List<String> middles;//中期建议
22 22 private List<String> laters;//晚期建议
23 23  
  24 + private List<String> contents;//儿童内容
  25 +
  26 + private Integer startWeek;
  27 + private Integer endWeek;
  28 +
24 29 //0过量 1不足
25 30 private Integer status;
26 31  
27 32 //0 孕妇 1儿童
28 33 private Integer type;
  34 +
  35 + public List<String> getContents() {
  36 + return contents;
  37 + }
  38 +
  39 + public void setContents(List<String> contents) {
  40 + this.contents = contents;
  41 + }
  42 +
  43 + public Integer getStartWeek() {
  44 + return startWeek;
  45 + }
  46 +
  47 + public void setStartWeek(Integer startWeek) {
  48 + this.startWeek = startWeek;
  49 + }
  50 +
  51 + public Integer getEndWeek() {
  52 + return endWeek;
  53 + }
  54 +
  55 + public void setEndWeek(Integer endWeek) {
  56 + this.endWeek = endWeek;
  57 + }
29 58  
30 59 public String getId() {
31 60 return id;
platform-dal/src/main/java/com/lyms/platform/pojo/MicroelementModel.java View file @ 300a541
... ... @@ -35,6 +35,7 @@
35 35  
36 36 private Date modified;
37 37  
  38 +
38 39 //0 孕前 1 儿童
39 40 private Integer type;
40 41  
... ... @@ -42,8 +43,6 @@
42 43  
43 44 private String numberCode;
44 45  
45   -
46   -
47 46 public static class Microelement implements Serializable {
48 47  
49 48 private static final long serialVersionUID = SerialIdEnum.Microelement.getCid();
... ... @@ -111,6 +110,8 @@
111 110 this.refValue = refValue;
112 111 }
113 112 }
  113 +
  114 +
114 115  
115 116 public String getNumberCode() {
116 117 return numberCode;
platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java View file @ 300a541
... ... @@ -87,10 +87,8 @@
87 87  
88 88 /************配偶信息*************/
89 89  
90   - //配偶姓名
91   - private String spouseName;
92   - //配偶证件号
93   - private String spouseCardNo;
  90 +
  91 +
94 92 //配偶手机
95 93 private String spousePhone;
96 94  
... ... @@ -98,6 +96,14 @@
98 96 private String spouseCertTypeId;
99 97  
100 98  
  99 + //配偶姓名
  100 + private String spouseName;
  101 + //配偶证件号
  102 + private String spouseCardNo;
  103 +
  104 +
  105 +
  106 +
101 107 /************配偶信息*************/
102 108  
103 109 //就诊卡号
... ... @@ -180,6 +186,7 @@
180 186  
181 187  
182 188 private String trackHospitalId;
  189 +
183 190  
184 191 public String getTrackHospitalId() {
185 192 return trackHospitalId;
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java View file @ 300a541
... ... @@ -236,6 +236,16 @@
236 236 private Date endAge;
237 237  
238 238  
  239 + private String numberCode;
  240 +
  241 + public String getNumberCode() {
  242 + return numberCode;
  243 + }
  244 +
  245 + public void setNumberCode(String numberCode) {
  246 + this.numberCode = numberCode;
  247 + }
  248 +
239 249 public String getAddress() {
240 250 return address;
241 251 }
... ... @@ -873,6 +883,9 @@
873 883  
874 884 if (null != hasBlno) {
875 885 condition = condition.and("blNo", hasBlno, MongoOper.EXISTS);
  886 + }
  887 + if (null != numberCode) {
  888 + condition = condition.and("mcertNo", "^" + numberCode, MongoOper.LIKE);
876 889 }
877 890  
878 891 if (-1 != visitstatus) {
platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java View file @ 300a541
... ... @@ -136,70 +136,9 @@
136 136 //历史数据是否同步
137 137 private boolean isHistory;
138 138  
139   - public String getTrackHospitalId() {
140   - return trackHospitalId;
141   - }
  139 + //配偶证件号
  140 + private String spouseCardNo;
142 141  
143   - public void setTrackHospitalId(String trackHospitalId) {
144   - this.trackHospitalId = trackHospitalId;
145   - }
146   -
147   - public boolean isHistory() {
148   - return isHistory;
149   - }
150   -
151   - public void setHistory(boolean history) {
152   - isHistory = history;
153   - }
154   -
155   - public Date getCreatedStart() {
156   - return createdStart;
157   - }
158   -
159   - public void setCreatedStart(Date createdStart) {
160   - this.createdStart = createdStart;
161   - }
162   -
163   - public Date getCreatedEnd() {
164   - return createdEnd;
165   - }
166   -
167   - public void setCreatedEnd(Date createdEnd) {
168   - this.createdEnd = createdEnd;
169   - }
170   -
171   - public Integer getFollowupStatus() {
172   - return followupStatus;
173   - }
174   -
175   - public void setFollowupStatus(Integer followupStatus) {
176   - this.followupStatus = followupStatus;
177   - }
178   -
179   - public String getPregnantBuild() {
180   - return pregnantBuild;
181   - }
182   -
183   - public void setPregnantBuild(String pregnantBuild) {
184   - this.pregnantBuild = pregnantBuild;
185   - }
186   -
187   - public String getCheckup() {
188   - return checkup;
189   - }
190   -
191   - public void setCheckup(String checkup) {
192   - this.checkup = checkup;
193   - }
194   -
195   - public String getQueryNo() {
196   - return queryNo;
197   - }
198   -
199   - public void setQueryNo(String queryNo) {
200   - this.queryNo = queryNo;
201   - }
202   -
203 142 @Override
204 143 public MongoQuery convertToQuery() {
205 144 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -286,6 +225,11 @@
286 225 if (created != null) {
287 226 condition = condition.and("created", created, MongoOper.IS);
288 227 }
  228 +
  229 + if (spouseCardNo != null) {
  230 + condition = condition.and("spouseCardNo", spouseCardNo, MongoOper.IS);
  231 + }
  232 +
289 233 if (marriageId != null) {
290 234 condition = condition.and("marriageId", marriageId, MongoOper.IS);
291 235 }
... ... @@ -382,6 +326,80 @@
382 326 }
383 327 return condition.toMongoQuery();
384 328 }
  329 +
  330 +
  331 + public String getSpouseCardNo() {
  332 + return spouseCardNo;
  333 + }
  334 +
  335 + public void setSpouseCardNo(String spouseCardNo) {
  336 + this.spouseCardNo = spouseCardNo;
  337 + }
  338 +
  339 + public String getTrackHospitalId() {
  340 + return trackHospitalId;
  341 + }
  342 +
  343 + public void setTrackHospitalId(String trackHospitalId) {
  344 + this.trackHospitalId = trackHospitalId;
  345 + }
  346 +
  347 + public boolean isHistory() {
  348 + return isHistory;
  349 + }
  350 +
  351 + public void setHistory(boolean history) {
  352 + isHistory = history;
  353 + }
  354 +
  355 + public Date getCreatedStart() {
  356 + return createdStart;
  357 + }
  358 +
  359 + public void setCreatedStart(Date createdStart) {
  360 + this.createdStart = createdStart;
  361 + }
  362 +
  363 + public Date getCreatedEnd() {
  364 + return createdEnd;
  365 + }
  366 +
  367 + public void setCreatedEnd(Date createdEnd) {
  368 + this.createdEnd = createdEnd;
  369 + }
  370 +
  371 + public Integer getFollowupStatus() {
  372 + return followupStatus;
  373 + }
  374 +
  375 + public void setFollowupStatus(Integer followupStatus) {
  376 + this.followupStatus = followupStatus;
  377 + }
  378 +
  379 + public String getPregnantBuild() {
  380 + return pregnantBuild;
  381 + }
  382 +
  383 + public void setPregnantBuild(String pregnantBuild) {
  384 + this.pregnantBuild = pregnantBuild;
  385 + }
  386 +
  387 + public String getCheckup() {
  388 + return checkup;
  389 + }
  390 +
  391 + public void setCheckup(String checkup) {
  392 + this.checkup = checkup;
  393 + }
  394 +
  395 + public String getQueryNo() {
  396 + return queryNo;
  397 + }
  398 +
  399 + public void setQueryNo(String queryNo) {
  400 + this.queryNo = queryNo;
  401 + }
  402 +
385 403  
386 404 public String getSpouseName() {
387 405 return spouseName;
platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java View file @ 300a541
... ... @@ -95,7 +95,16 @@
95 95 //
96 96 private boolean isHistory;
97 97  
  98 + private String trackHospitalId;
98 99  
  100 + public String getTrackHospitalId() {
  101 + return trackHospitalId;
  102 + }
  103 +
  104 + public void setTrackHospitalId(String trackHospitalId) {
  105 + this.trackHospitalId = trackHospitalId;
  106 + }
  107 +
99 108 public List<String> getHospitalIdList() {
100 109 return hospitalIdList;
101 110 }
... ... @@ -490,6 +499,19 @@
490 499 c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria());
491 500 } else {
492 501 c1 = c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria();
  502 + }
  503 + }
  504 +
  505 +
  506 +
  507 + if (org.apache.commons.lang.StringUtils.isNotBlank(trackHospitalId)) {
  508 + MongoCondition c = MongoCondition.newInstance();
  509 + MongoCondition con1 = MongoCondition.newInstance("trackHospitalId", trackHospitalId, MongoOper.IS);
  510 + MongoCondition con2 = MongoCondition.newInstance("hospitalId", trackHospitalId, MongoOper.IS);
  511 + if (c1 != null) {
  512 + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con2}).getCriteria());
  513 + } else {
  514 + c1 = c.orCondition(new MongoCondition[]{con1, con2}).getCriteria();
493 515 }
494 516 }
495 517  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java View file @ 300a541
... ... @@ -159,6 +159,14 @@
159 159 @RequestParam(value = "hospitalId", required = true) String hospitalId,
160 160 HttpServletRequest request
161 161 ) {
  162 + if ("216".equals(hospitalId))
  163 + {
  164 + try {
  165 + Thread.sleep(4000);
  166 + } catch (InterruptedException e) {
  167 + e.printStackTrace();
  168 + }
  169 + }
162 170 return measureInfoFacade.getNutritionPatientInfo(certType, certNo, hospitalId);
163 171 }
164 172  
... ... @@ -174,6 +182,14 @@
174 182 public BaseObjectResponse addNutritionInfo(@RequestBody NutritionInfoRequest nutritionInfoRequest,
175 183 HttpServletRequest request
176 184 ) {
  185 + if ("216".equals(nutritionInfoRequest.getHospitalId()))
  186 + {
  187 + try {
  188 + Thread.sleep(4000);
  189 + } catch (InterruptedException e) {
  190 + e.printStackTrace();
  191 + }
  192 + }
177 193 return measureInfoFacade.addNutritionInfo(nutritionInfoRequest);
178 194 }
179 195  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java View file @ 300a541
... ... @@ -57,7 +57,7 @@
57 57 * 新增字段:报表解读人 孕妇/儿童
58 58 *
59 59 * @param hospitalId 医院id
60   - * @param healthType 打印类型 1体重 2 血糖 3 血压 4妊高症 4-儿童膳食 6体成分分析 7 孕期微量元素 8孕期骨密度
  60 + * @param healthType 打印类型 1体重 2 血糖 3 血压 4妊高症 4-儿童膳食 6体成分分析 7 孕期微量元素 8孕期骨密度 9儿童微量元素 10 儿童骨密度
61 61 * @param foreignId 档案id (院内建档或者临时档案id)孕妇/儿童
62 62 * @param type 打印报告类别 1普通报告 2高危报告(暂时不用)
63 63 * @param source 档案来源类型 1院内建档 2零时建档 (暂时不用)
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MicroelementFacade.java View file @ 300a541
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3 3  
  4 +import com.lyms.platform.biz.service.BabyBookbuildingService;
4 5 import com.lyms.platform.biz.service.BasicConfigService;
5 6 import com.lyms.platform.biz.service.MicroelementService;
6 7 import com.lyms.platform.biz.service.PatientsService;
7 8 import com.lyms.platform.common.constants.ErrorCodeConstants;
8 9 import com.lyms.platform.common.dao.BaseQuery;
  10 +import com.lyms.platform.common.enums.SexEnum;
9 11 import com.lyms.platform.common.enums.YnEnums;
10 12 import com.lyms.platform.common.result.BaseListResponse;
11 13 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -13,10 +15,8 @@
13 15 import com.lyms.platform.common.utils.DateUtil;
14 16 import com.lyms.platform.operate.web.utils.FunvCommonUtil;
15 17 import com.lyms.platform.permission.model.PatientService;
16   -import com.lyms.platform.pojo.MicroelementConfigModel;
17   -import com.lyms.platform.pojo.MicroelementModel;
18   -import com.lyms.platform.pojo.PatientWeight;
19   -import com.lyms.platform.pojo.Patients;
  18 +import com.lyms.platform.pojo.*;
  19 +import com.lyms.platform.query.BabyModelQuery;
20 20 import com.lyms.platform.query.MicroelementQuery;
21 21 import com.lyms.platform.query.PatientsQuery;
22 22 import org.apache.commons.collections.CollectionUtils;
23 23  
24 24  
25 25  
26 26  
27 27  
28 28  
29 29  
30 30  
31 31  
32 32  
33 33  
34 34  
... ... @@ -54,74 +54,146 @@
54 54 @Autowired
55 55 private MongoTemplate mongoTemplate;
56 56  
  57 +
  58 + @Autowired
  59 + private BabyBookbuildingService babyBookbuildingService;
  60 +
57 61 public BaseResponse querymicroelementList(String queryNo, Integer weekStart, Integer weekEnd, Integer age, String vcCardNo,Integer type ,Integer page, Integer limit, Integer userId) {
58 62  
59 63  
60 64 List dataList = new ArrayList();
61 65 String hospitalId = autoMatchFacade.getHospitalId(userId);
62   - PatientsQuery patientsQuery = new PatientsQuery();
63   - List<Patients> patientses = null;
64   - List<String> patientIds = new ArrayList<>();
65   - if (StringUtils.isNotEmpty(queryNo) ||StringUtils.isNotEmpty(vcCardNo) ) {
66   - patientsQuery.setQueryNo(queryNo);
67   - patientsQuery.setHospitalId(hospitalId);
68   - patientsQuery.setVcCardNo(vcCardNo);
69   - patientses = patientsService.queryPatient1(patientsQuery, "created");
70   - if (CollectionUtils.isEmpty(patientses))
  66 + MicroelementQuery query = new MicroelementQuery();
  67 +
  68 + //孕前
  69 + if (type == 0)
  70 + {
  71 + PatientsQuery patientsQuery = new PatientsQuery();
  72 + List<Patients> patientses = null;
  73 + List<String> patientIds = new ArrayList<>();
  74 + if (StringUtils.isNotEmpty(queryNo) ||StringUtils.isNotEmpty(vcCardNo) ) {
  75 + patientsQuery.setQueryNo(queryNo);
  76 + patientsQuery.setHospitalId(hospitalId);
  77 + patientsQuery.setVcCardNo(vcCardNo);
  78 + patientses = patientsService.queryPatient1(patientsQuery, "created");
  79 + if (CollectionUtils.isEmpty(patientses))
  80 + {
  81 + return new BaseListResponse().setData(dataList).
  82 + setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(new BaseQuery().getPageInfo());
  83 + }
  84 + else
  85 + {
  86 + for (Patients pat : patientses)
  87 + {
  88 + patientIds.add(pat.getId());
  89 + }
  90 + }
  91 + }
  92 + query.setLimit(limit);
  93 + query.setPage(page);
  94 + query.setHospitalId(hospitalId);
  95 + query.setPatientIds(patientIds);
  96 + query.setType(0);
  97 + query.setSort(" created ");
  98 +
  99 + if (age != null)
71 100 {
72   - return new BaseListResponse().setData(dataList).
73   - setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(new BaseQuery().getPageInfo());
  101 + Date start = DateUtil.getBeforeAge(age);
  102 + Date end = DateUtil.getBeforeAge(age + 1);
  103 + query.setBirthStart(start);
  104 + query.setBirthEnd(end);
74 105 }
75   - else
  106 +
  107 + if (weekStart != null && weekEnd != null) {
  108 + Date start = DateUtil.getWeekStart(weekStart);
  109 + Date end = DateUtil.getWeekEnd(weekEnd);
  110 + query.setLastMensesStart(start);
  111 + query.setLastMensesEnd(end);
  112 + }
  113 +
  114 +
  115 + List<MicroelementModel> models = microelementService.queryMicroelementList(query);
  116 + if (CollectionUtils.isNotEmpty(models))
76 117 {
77   - for (Patients pat : patientses)
  118 + for (MicroelementModel model : models)
78 119 {
79   - patientIds.add(pat.getId());
  120 + Map data = new HashMap();
  121 + Patients patients = patientsService.findOnePatientById(model.getPatientId());
  122 + data.put("id",model.getId());
  123 + data.put("userName",patients.getUsername());
  124 + data.put("phone",patients.getPhone());
  125 + data.put("vcCardNo",patients.getVcCardNo());
  126 + data.put("cardNo",patients.getCardNo());
  127 + data.put("microelements", model.getMicroelements());
  128 + data.put("age", DateUtil.getAge(patients.getBirth(), model.getCreated()));
  129 + data.put("week", DateUtil.getWeekDesc(patients.getLastMenses(), model.getCreated()));
  130 + data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
  131 + dataList.add(data);
  132 +
80 133 }
81 134 }
82 135 }
83   - MicroelementQuery query = new MicroelementQuery();
84   - query.setLimit(limit);
85   - query.setPage(page);
86   - query.setHospitalId(hospitalId);
87   - query.setPatientIds(patientIds);
88   - query.setType(0);
89   - query.setSort(" created ");
90   -
91   - if (age != null)
  136 + //儿童
  137 + else
92 138 {
93   - Date start = DateUtil.getBeforeAge(age);
94   - Date end = DateUtil.getBeforeAge(age + 1);
95   - query.setBirthStart(start);
96   - query.setBirthEnd(end);
97   - }
98 139  
99   - if (weekStart != null && weekEnd != null) {
100   - Date start = DateUtil.getWeekStart(weekStart);
101   - Date end = DateUtil.getWeekEnd(weekEnd);
102   - query.setLastMensesStart(start);
103   - query.setLastMensesEnd(end);
104   - }
  140 + BabyModelQuery babyModelQuery = new BabyModelQuery();
  141 + List<String> babayIds = new ArrayList<>();
  142 + List<BabyModel> babyModels = null;
  143 + if (StringUtils.isNotEmpty(queryNo) ||StringUtils.isNotEmpty(vcCardNo) ) {
  144 + babyModelQuery.setQueryNo(queryNo);
  145 + babyModelQuery.setHospitalId(hospitalId);
  146 + babyModelQuery.setVcCardNo(vcCardNo);
  147 + babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  148 + if (CollectionUtils.isEmpty(babyModels))
  149 + {
  150 + return new BaseListResponse().setData(dataList).
  151 + setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(new BaseQuery().getPageInfo());
  152 + }
  153 + else
  154 + {
  155 + for (BabyModel model : babyModels)
  156 + {
  157 + babayIds.add(model.getId());
  158 + }
  159 + }
  160 + }
105 161  
  162 + query.setLimit(limit);
  163 + query.setPage(page);
  164 + query.setHospitalId(hospitalId);
  165 + query.setPatientIds(babayIds);
  166 + query.setType(1);
  167 + query.setSort(" created ");
106 168  
107   - List<MicroelementModel> models = microelementService.queryMicroelementList(query);
108   - if (CollectionUtils.isNotEmpty(models))
109   - {
110   - for (MicroelementModel model : models)
  169 + if (weekStart != null && weekEnd != null)
111 170 {
112   - Map data = new HashMap();
113   - Patients patients = patientsService.findOnePatientById(model.getPatientId());
114   - data.put("id",model.getId());
115   - data.put("userName",patients.getUsername());
116   - data.put("phone",patients.getPhone());
117   - data.put("vcCardNo",patients.getVcCardNo());
118   - data.put("cardNo",patients.getCardNo());
119   - data.put("microelements", model.getMicroelements());
120   - data.put("age", DateUtil.getAge(patients.getBirth(), model.getCreated()));
121   - data.put("week", DateUtil.getWeekDesc(patients.getLastMenses(), model.getCreated()));
122   - data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
123   - dataList.add(data);
  171 + Date currentDate = new Date();
  172 + Date start = DateUtil.addMonth(currentDate, -weekStart);
  173 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -weekEnd - 1), 1);
  174 + query.setBirthStart(start);
  175 + query.setBirthEnd(end);
  176 + }
124 177  
  178 + List<MicroelementModel> models = microelementService.queryMicroelementList(query);
  179 + if (CollectionUtils.isNotEmpty(models))
  180 + {
  181 + for (MicroelementModel model : models)
  182 + {
  183 + Map data = new HashMap();
  184 + BabyModel babyModel = babyBookbuildingService.queryBabyBuildById(model.getPatientId());
  185 + data.put("id",model.getId());
  186 + data.put("userName",babyModel.getName());
  187 + data.put("phone",babyModel.getMphone());
  188 + data.put("vcCardNo",babyModel.getVcCardNo());
  189 + data.put("mcardNo",babyModel.getMcertNo());
  190 + data.put("microelements", model.getMicroelements());
  191 + data.put("age", DateUtil.getBabyMonthAge(babyModel.getBirth(), model.getCreated()));
  192 + data.put("mname", babyModel.getMname());
  193 + data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
  194 + dataList.add(data);
  195 +
  196 + }
125 197 }
126 198 }
127 199 return new BaseListResponse().setData(dataList).
128 200  
129 201  
130 202  
131 203  
132 204  
133 205  
134 206  
135 207  
136 208  
137 209  
138 210  
139 211  
140 212  
141 213  
142 214  
143 215  
144 216  
145 217  
146 218  
147 219  
... ... @@ -138,124 +210,183 @@
138 210 MicroelementModel model = microelementService.queryOneMicroelement(query);
139 211 if (model != null)
140 212 {
141   - Patients pat = patientsService.findOnePatientById(model.getPatientId());
142   - data.put("city", FunvCommonUtil.getBaseicConfigByid(pat.getCityRegisterId(), basicConfigService));
143   - data.put("area", FunvCommonUtil.getBaseicConfigByid(pat.getAreaRegisterId(), basicConfigService));
144   - data.put("userName",pat.getUsername());
145   - data.put("age", DateUtil.getAge(pat.getBirth(), model.getCreated()));
146   - data.put("week", DateUtil.getWeekDesc(pat.getLastMenses(), model.getCreated()));
147   - data.put("microelements", model.getMicroelements());
148   - data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
149   - Date lastMenses = DateUtil.addDay(pat.getLastMenses(),1);
150   - int week = DateUtil.getWeek(lastMenses,model.getCreated());
151   - Map<String,List<String>> contents = new HashMap<>();
152   - boolean isNormal = false;
153   -
154   - if (CollectionUtils.isNotEmpty(model.getMicroelements()))
  213 + if (type == 0)
155 214 {
156   - for (MicroelementModel.Microelement ele : model.getMicroelements())
  215 + Patients pat = patientsService.findOnePatientById(model.getPatientId());
  216 + data.put("city", FunvCommonUtil.getBaseicConfigByid(pat.getCityRegisterId(), basicConfigService));
  217 + data.put("area", FunvCommonUtil.getBaseicConfigByid(pat.getAreaRegisterId(), basicConfigService));
  218 + data.put("userName",pat.getUsername());
  219 + data.put("age", DateUtil.getAge(pat.getBirth(), model.getCreated()));
  220 + data.put("week", DateUtil.getWeekDesc(pat.getLastMenses(), model.getCreated()));
  221 + data.put("microelements", model.getMicroelements());
  222 + data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
  223 + Date lastMenses = DateUtil.addDay(pat.getLastMenses(),1);
  224 + int week = DateUtil.getWeek(lastMenses,model.getCreated());
  225 + Map<String,List<String>> contents = new HashMap<>();
  226 + boolean isNormal = false;
  227 +
  228 + if (CollectionUtils.isNotEmpty(model.getMicroelements()))
157 229 {
158   - if (2 == ele.getStatus() || "铅".equals(ele.getEleName()))
  230 + for (MicroelementModel.Microelement ele : model.getMicroelements())
159 231 {
160   - isNormal = true;
161   - continue;
  232 + if (2 == ele.getStatus() || "铅".equals(ele.getEleName()))
  233 + {
  234 + isNormal = true;
  235 + continue;
  236 + }
  237 + MicroelementConfigModel configModel = mongoTemplate.findOne(
  238 + Query.query(Criteria.where("eleName").is(ele.getEleName()).and("status").is(ele.getStatus()).and("type").is(0)), MicroelementConfigModel.class);
  239 +
  240 + List<String> datas = new ArrayList<>();
  241 + if (week < 13)
  242 + {
  243 + datas.addAll(configModel.getEarlys());
  244 + }
  245 + else if (week >= 13 && week < 28)
  246 + {
  247 + datas.addAll(configModel.getMiddles());
  248 + }
  249 + else
  250 + {
  251 + datas.addAll(configModel.getLaters());
  252 + }
  253 + contents.put(configModel.getEleName(),datas);
162 254 }
163   - MicroelementConfigModel configModel = mongoTemplate.findOne(
164   - Query.query(Criteria.where("eleName").is(ele.getEleName()).and("status").is(ele.getStatus()).and("type").is(0)), MicroelementConfigModel.class);
  255 + }
165 256  
166   - List<String> datas = new ArrayList<>();
  257 + String nextCheckDate = "";
  258 + String nextCheckWeek = "";
  259 +
  260 + if (isNormal) {
167 261 if (week < 13)
168 262 {
169   - datas.addAll(configModel.getEarlys());
  263 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),13));
  264 + nextCheckWeek = "孕13周前后";
170 265 }
171 266 else if (week >= 13 && week < 28)
172 267 {
173   - datas.addAll(configModel.getMiddles());
  268 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),28));
  269 + nextCheckWeek = "孕28周前后";
174 270 }
175   - else
  271 + }
  272 + else
  273 + {
  274 + if (week < 8)
176 275 {
177   - datas.addAll(configModel.getLaters());
  276 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),8));
  277 + nextCheckWeek = "孕8周前后";
178 278 }
179   - contents.put(configModel.getEleName(),datas);
  279 + else if (week >= 8 && week < 13)
  280 + {
  281 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),13));
  282 + nextCheckWeek = "孕13周前后";
  283 + }
  284 + else if (week >= 13 && week < 20)
  285 + {
  286 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),20));
  287 + nextCheckWeek = "孕20周前后";
  288 + }
  289 + else if (week >= 20 && week < 28)
  290 + {
  291 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),28));
  292 + nextCheckWeek = "孕28周前后";
  293 + }
  294 + else if (week >= 28 && week < 36)
  295 + {
  296 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),36));
  297 + nextCheckWeek = "孕36周前后";
  298 + }
180 299 }
  300 + data.put("nextCheckDate", nextCheckDate);
  301 + data.put("nextCheckWeek", nextCheckWeek);
  302 + data.put("contents", contents);
  303 + data.put("isNormal", isNormal);
  304 + healthChargeFacade.addHealthCharge(hospitalId, 7, model.getPatientId(), 1, 1, userId, doctorId, false);
181 305 }
182   -
183   - String nextCheckDate = "";
184   - String nextCheckWeek = "";
185   -
186   - if (isNormal) {
187   - if (week < 13)
188   - {
189   - nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),13));
190   - nextCheckWeek = "孕13周前后";
191   - }
192   - else if (week >= 13 && week < 28)
193   - {
194   - nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),28));
195   - nextCheckWeek = "孕28周前后";
196   - }
197   - }
  306 + //儿童微量元素报告
198 307 else
199 308 {
200   - if (week < 8)
  309 + BabyModel babyModel = babyBookbuildingService.queryBabyBuildById(model.getPatientId());
  310 + data.put("city", FunvCommonUtil.getBaseicConfigByid(babyModel.getCityId(), basicConfigService));
  311 + data.put("area", FunvCommonUtil.getBaseicConfigByid(babyModel.getAreaId(), basicConfigService));
  312 + data.put("userName",babyModel.getName());
  313 + data.put("age", DateUtil.getBabyMonthAge(babyModel.getBirth(), model.getCreated()));
  314 + data.put("sex", babyModel.getSex() == null ? "" : SexEnum.getTextById(babyModel.getSex()));
  315 + data.put("microelements", model.getMicroelements());
  316 + data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
  317 + Map<String,List<String>> contents = new HashMap<>();
  318 + boolean isNormal = false;
  319 + if (CollectionUtils.isNotEmpty(model.getMicroelements()))
201 320 {
202   - nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),8));
203   - nextCheckWeek = "孕8周前后";
  321 + for (MicroelementModel.Microelement ele : model.getMicroelements())
  322 + {
  323 + if (2 == ele.getStatus() || "铅".equals(ele.getEleName()))
  324 + {
  325 + isNormal = true;
  326 + continue;
  327 + }
  328 + MicroelementConfigModel configModel = mongoTemplate.findOne(
  329 + Query.query(Criteria.where("eleName").is(ele.getEleName()).and("status").is(ele.getStatus()).and("type").is(1)), MicroelementConfigModel.class);
  330 + contents.put(configModel.getEleName(),configModel.getContents());
  331 + }
204 332 }
205   - else if (week >= 8 && week < 13)
206   - {
207   - nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),13));
208   - nextCheckWeek = "孕13周前后";
209   - }
210   - else if (week >= 13 && week < 20)
211   - {
212   - nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),20));
213   - nextCheckWeek = "孕20周前后";
214   - }
215   - else if (week >= 20 && week < 28)
216   - {
217   - nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),28));
218   - nextCheckWeek = "孕28周前后";
219   - }
220   - else if (week >= 28 && week < 36)
221   - {
222   - nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),36));
223   - nextCheckWeek = "孕36周前后";
224   - }
  333 +
  334 + data.put("contents", contents);
  335 + data.put("isNormal", isNormal);
  336 + healthChargeFacade.addHealthCharge(hospitalId, 9, model.getPatientId(), 1, 1, userId, doctorId, true);
225 337 }
226 338  
227   - data.put("nextCheckDate", nextCheckDate);
228   - data.put("nextCheckWeek", nextCheckWeek);
229   - data.put("contents", contents);
230   - data.put("isNormal", isNormal);
231 339 }
232 340  
233   - healthChargeFacade.addHealthCharge(hospitalId, 7, model.getPatientId(), 1, 1, userId, doctorId, false);
  341 +
234 342 return new BaseObjectResponse().setData(data).
235 343 setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
236 344 }
237 345  
238 346  
239 347 public BaseResponse saveMicroelement(MicroelementModel microelementModel) {
240   - PatientsQuery patientsQuery = new PatientsQuery();
241   - patientsQuery.setYn(YnEnums.YES.getId());
242   - patientsQuery.setType(1);
243   - patientsQuery.setNumberCode(microelementModel.getNumberCode());
244   - List<Patients> patients = patientsService.queryPatient(patientsQuery);
245   - if (CollectionUtils.isNotEmpty(patients))
  348 +
  349 + if (microelementModel.getType() == 1)
246 350 {
247   - Patients pat = patients.get(0);
248   - microelementModel.setHospitalId(pat.getHospitalId());
249   - microelementModel.setPatientId(pat.getId());
250   - microelementModel.setPid(pat.getPid());
251   - microelementModel.setBirthday(pat.getBirth());
252   - microelementModel.setLastMenses(pat.getLastMenses());
253   - microelementModel.setType(0);
254   - microelementModel.setCreated(new Date());
255   - microelementModel.setModified(new Date());
256   - microelementService.add(microelementModel);
257   - }
  351 + BabyModelQuery babyModelQuery = new BabyModelQuery();
  352 + babyModelQuery.setYn(YnEnums.YES.getId());
  353 + babyModelQuery.setNumberCode(microelementModel.getNumberCode());
  354 + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
258 355  
  356 + if (CollectionUtils.isNotEmpty(babyModels))
  357 + {
  358 + BabyModel babyModel = babyModels.get(0);
  359 + microelementModel.setHospitalId(babyModel.getHospitalId());
  360 + microelementModel.setPatientId(babyModel.getId());
  361 + microelementModel.setPid(babyModel.getPid());
  362 + microelementModel.setBirthday(babyModel.getBirth());
  363 + microelementModel.setType(0);
  364 + microelementModel.setCreated(new Date());
  365 + microelementModel.setModified(new Date());
  366 + microelementService.add(microelementModel);
  367 + }
  368 + }
  369 + else
  370 + {
  371 + PatientsQuery patientsQuery = new PatientsQuery();
  372 + patientsQuery.setYn(YnEnums.YES.getId());
  373 + patientsQuery.setType(1);
  374 + patientsQuery.setNumberCode(microelementModel.getNumberCode());
  375 + List<Patients> patients = patientsService.queryPatient(patientsQuery);
  376 + if (CollectionUtils.isNotEmpty(patients))
  377 + {
  378 + Patients pat = patients.get(0);
  379 + microelementModel.setHospitalId(pat.getHospitalId());
  380 + microelementModel.setPatientId(pat.getId());
  381 + microelementModel.setPid(pat.getPid());
  382 + microelementModel.setBirthday(pat.getBirth());
  383 + microelementModel.setLastMenses(pat.getLastMenses());
  384 + microelementModel.setType(0);
  385 + microelementModel.setCreated(new Date());
  386 + microelementModel.setModified(new Date());
  387 + microelementService.add(microelementModel);
  388 + }
  389 + }
259 390 return new BaseResponse().
260 391 setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
261 392 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java View file @ 300a541
... ... @@ -582,6 +582,16 @@
582 582 downRecordQuery.setLimit(downQueryRequest.getLimit());
583 583 downRecordQuery.setNeed("1");
584 584 // downRecordQuery.setSort("modified desc");
  585 +
  586 + if (downQueryRequest.isArea())
  587 + {
  588 + downRecordQuery.setTrackHospitalId(hospitalId);
  589 + }
  590 + else
  591 + {
  592 + downRecordQuery.setHospitalId(hospitalId);
  593 + }
  594 +
585 595 downRecordQuery.setHospitalId(hospitalId);
586 596  
587 597 System.out.println("====>" + downRecordQuery.convertToQuery().convertToMongoQuery());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 300a541
... ... @@ -4951,8 +4951,31 @@
4951 4951 ResidentsArchiveModel model = modelList.get(0);
4952 4952 //建档详情
4953 4953 result = getResidentsPageResult(model);
  4954 + if (StringUtils.isNotEmpty(model.getSpouseCardNo()))
  4955 + {
  4956 + query.setYn(YnEnums.YES.getId());
  4957 + query.setId(null);
  4958 + query.setSpouseCardNo(model.getSpouseCardNo());
  4959 + modelList = residentsArchiveService.queryResident(query);
  4960 + if (CollectionUtils.isNotEmpty(modelList))
  4961 + {
  4962 + //是否显示打印指引单
  4963 + result.setIsPrint(true);
  4964 + ResidentsArchiveModel model1 = modelList.get(0);
  4965 + result.setSpouseName(model1.getUsername());
  4966 + result.setSpouseCardNo(model1.getCertificateNum());
  4967 + result.setSpouseSex(getBasicConfig(model.getSex()));
  4968 + if (model1.getBirthday() != null) {
  4969 + result.setSpouseAge(com.lyms.platform.common.utils.StringUtils.unitHandle(DateUtil.getAge(model1.getBirthday(), new Date()).toString(), UnitConstants.SUI));
  4970 + }
  4971 + //居住地
  4972 + String liveAddress = CommonsHelper.getResidence(model.getProvinceId(), model.getCityId(),
  4973 + model.getAreaId(), model.getStreetId(), model.getAddress(), basicConfigService);
  4974 + result.setSpouseAddress(liveAddress);
  4975 + result.setSpouseCreated(DateUtil.getyyyy_MM_dd(model.getBuildDay()));
  4976 + }
  4977 + }
4954 4978 }
4955   -
4956 4979 br.setData(result);
4957 4980 br.setErrorcode(ErrorCodeConstants.SUCCESS);
4958 4981 br.setErrormsg("成功");
... ... @@ -5013,6 +5036,7 @@
5013 5036  
5014 5037 String title = getBasicConfig(key.toString());
5015 5038 pastHistory.append(title);
  5039 + pastHistory.append(",");
5016 5040 String item = obj.toString().substring(1).substring(0, obj.toString().length() - 2);
5017 5041 if (StringUtils.isNotEmpty(item)) {
5018 5042 if (item.contains("selected=[") && item.contains("]")) {
... ... @@ -5050,7 +5074,7 @@
5050 5074 }
5051 5075 }
5052 5076 }
5053   - result.setPastHistory(pastHistory.toString());
  5077 + result.setPastHistory(FunvCommonUtil.spitd(pastHistory.toString()));
5054 5078  
5055 5079 //家族史
5056 5080 String familyHistory = "";
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TrackDownQueryRequest.java View file @ 300a541
... ... @@ -90,6 +90,16 @@
90 90 // 不为空表示只查询高危 0
91 91 private Integer isRisk;
92 92  
  93 + private boolean isArea;
  94 +
  95 + public boolean isArea() {
  96 + return isArea;
  97 + }
  98 +
  99 + public void setIsArea(boolean isArea) {
  100 + this.isArea = isArea;
  101 + }
  102 +
93 103 public Integer getIsRisk() {
94 104 return isRisk;
95 105 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ResidentsPageResult.java View file @ 300a541
... ... @@ -51,6 +51,15 @@
51 51 private String spouseName;
52 52 //配偶证件号
53 53 private String spouseCardNo;
  54 + //配偶性别
  55 + private String spouseSex;
  56 + //配偶年龄
  57 + private String spouseAge;
  58 + //配偶家庭住址
  59 + private String spouseAddress;
  60 + //配偶建档时间
  61 + private String spouseCreated;
  62 +
54 63 //配偶手机
55 64 private String spousePhone;
56 65  
... ... @@ -121,6 +130,51 @@
121 130 private String znstzk;//子女身体状况(0:健康;1:疾病)
122 131 private String jtbm;//注明具体病名
123 132 private String photo;
  133 +
  134 +
  135 + //是否打印指引单 陵城区妇幼
  136 + private boolean isPrint;
  137 +
  138 +
  139 + public String getSpouseSex() {
  140 + return spouseSex;
  141 + }
  142 +
  143 + public void setSpouseSex(String spouseSex) {
  144 + this.spouseSex = spouseSex;
  145 + }
  146 +
  147 + public String getSpouseAge() {
  148 + return spouseAge;
  149 + }
  150 +
  151 + public void setSpouseAge(String spouseAge) {
  152 + this.spouseAge = spouseAge;
  153 + }
  154 +
  155 + public String getSpouseAddress() {
  156 + return spouseAddress;
  157 + }
  158 +
  159 + public void setSpouseAddress(String spouseAddress) {
  160 + this.spouseAddress = spouseAddress;
  161 + }
  162 +
  163 + public String getSpouseCreated() {
  164 + return spouseCreated;
  165 + }
  166 +
  167 + public void setSpouseCreated(String spouseCreated) {
  168 + this.spouseCreated = spouseCreated;
  169 + }
  170 +
  171 + public boolean isPrint() {
  172 + return isPrint;
  173 + }
  174 +
  175 + public void setIsPrint(boolean isPrint) {
  176 + this.isPrint = isPrint;
  177 + }
124 178  
125 179 public String getPhoto() {
126 180 return photo;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/HospitalCouponPrintUtils.java View file @ 300a541
... ... @@ -71,8 +71,8 @@
71 71 */
72 72 public static String qhdCouponUse(QhdDjq model){
73 73 String json = JsonUtil.obj2Str(model);
74   - //String result = HttpClientUtil.doPost("http://localhost:9090/his/insertQhdfycjDjq", json, "utf-8");
75   - String result = "0";
  74 + String result = HttpClientUtil.doPost("http://localhost:9090/his/insertQhdfycjDjq", json, "utf-8");
  75 + //String result = "0";
76 76 return result;
77 77 }
78 78  
platform-transfer/src/main/java/com/lyms/platform/Bone/BoneWorker.java View file @ 300a541
  1 +package com.lyms.platform.Bone;
  2 +
  3 +import com.lyms.platform.common.utils.HttpClientUtil;
  4 +import com.lyms.platform.common.utils.JsonUtil;
  5 +import com.lyms.platform.common.utils.PropertiesUtils;
  6 +import com.lyms.platform.common.utils.StringUtils;
  7 +import com.lyms.platform.conn.MicroelementConnection;
  8 +
  9 +import java.sql.Connection;
  10 +import java.sql.ResultSet;
  11 +import java.sql.SQLException;
  12 +import java.sql.Statement;
  13 +import java.util.ArrayList;
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +public class BoneWorker {
  19 +
  20 + public static final String url = PropertiesUtils.getPropertyValue("url");
  21 +
  22 + public static void getMicroelementRecords()
  23 + {
  24 + System.out.println("getMicroelementRecords start");
  25 + Connection conn = null;
  26 + Statement sta = null;
  27 + ResultSet rst = null;
  28 + try {
  29 + conn = MicroelementConnection.getConnection();
  30 + sta = conn.createStatement();
  31 + rst = sta.executeQuery("select * from BaseInfo where status is null ");
  32 + while (rst.next()){
  33 + Map<String,Object> data = new HashMap<>();
  34 + String numberCode = rst.getString("编号");
  35 + String autoId = rst.getString("AUTOID");
  36 + data.put("numberCode",numberCode);
  37 + data.put("autoId",autoId);
  38 + getMicroelementRecords(data);
  39 + }
  40 + }
  41 + catch (SQLException e) {
  42 + }
  43 + finally {
  44 + MicroelementConnection.close(conn, sta,rst);
  45 + }
  46 + }
  47 +
  48 +
  49 + public static void getMicroelementRecords(Map<String,Object> data)
  50 + {
  51 + Connection conn = null;
  52 + Statement sta = null;
  53 + ResultSet rst = null;
  54 + try {
  55 + conn = MicroelementConnection.getConnection();
  56 + String autoId = data.get("autoId").toString();
  57 + sta = conn.createStatement();
  58 + rst = sta.executeQuery("select * from ItemsInfo where BaseAutoId = "+autoId);
  59 +
  60 + List<Map> microelements = new ArrayList<>();
  61 + while (rst.next()) {
  62 + Map map = new HashMap();
  63 + String eleName = rst.getString("元素名称");
  64 + String value = rst.getString("测量值");
  65 + String result = StringUtils.checkNum(value);
  66 + map.put("result",result);
  67 + map.put("unit",value.contains("mmol") ? "mmol/l" : (value.contains("umol") ? "umol/l" : "ug/l"));
  68 + map.put("eleName",eleName);
  69 + map.put("refValue","");//TODO
  70 + microelements.add(map);
  71 + }
  72 + data.put("microelements", microelements);
  73 + data.remove("autoId");
  74 + if (microelements.size() > 0)
  75 + {
  76 + String response = autoTransfer(data);
  77 + if (response.contains("0"))
  78 + {
  79 + sta.executeUpdate("update BaseInfo set status='1' where AUTOID="+autoId);
  80 + conn.commit();
  81 + }
  82 + }
  83 +
  84 + }
  85 + catch (Exception e) {
  86 + try {
  87 + conn.rollback();
  88 + } catch (SQLException e1) {
  89 + e1.printStackTrace();
  90 + }
  91 + }
  92 + finally {
  93 + MicroelementConnection.close(conn, sta,rst);
  94 + }
  95 + }
  96 +
  97 + public static String autoTransfer( Map<String,Object> data)
  98 + {
  99 + if (data != null && data.size() > 0)
  100 + {
  101 + String json = JsonUtil.obj2Str(data);
  102 + System.out.println(json);
  103 + String result = HttpClientUtil.doPostSSL(url,json);
  104 + System.out.println("http result= "+result);
  105 + return result;
  106 + }
  107 + return "";
  108 + }
  109 +
  110 +// public static void main(String[] args) {
  111 +// getMicroelementRecords();
  112 +// }
  113 +}