Commit 73b7d99bc8e0d0849df1f41fc7e92f8aa07c78fb

Authored by liquanyu
1 parent bcbadb9243

微量元素

Showing 4 changed files with 261 additions and 20 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 73b7d99
... ... @@ -6422,19 +6422,16 @@
6422 6422 if (cells.length > 0) {
6423 6423 for (int j = 0; j < cells.length; j++) {
6424 6424 String str = cells[j].getContents().trim();
6425   - if (!StringUtils.isNotEmpty(str))
6426   - {
6427   - continue;
6428   - }
6429   - if (j == 0)
6430   - {
6431   - diet.setMonthAge(Integer.parseInt(str));
6432   - }
6433   - else
6434   - {
6435   - List<String> list2 = Arrays.asList(str.split("\n"));
6436   - list.add(list2);
6437   - }
  6425 +// case 0:
  6426 +// diet.setTitle(str);
  6427 +// continue;
  6428 +// case 1:
  6429 +// List<String> list2 = Arrays.asList(str.split("\n"));
  6430 +// diet.setSuggests(list2);
  6431 +// continue;
  6432 +// case 2:
  6433 +// diet.setLevel(Integer.parseInt(str));
  6434 +// continue;
6438 6435 }
6439 6436 diet.setDoctorSuggests(list);
6440 6437 }
... ... @@ -6447,6 +6444,69 @@
6447 6444 }
6448 6445  
6449 6446  
  6447 +
  6448 + /**
  6449 + * 微量元素
  6450 + *
  6451 + * @param fileName
  6452 + */
  6453 + public static void saveMicroelements(String fileName) {
  6454 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  6455 + MongoTemplate mongoTemplate
  6456 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  6457 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  6458 + File file = new File(fileName);
  6459 + Workbook wb = null;
  6460 + try {
  6461 + wb = Workbook.getWorkbook(file);
  6462 +
  6463 + Sheet s = wb.getSheet(0);
  6464 + System.out.println(s.getName() + " : ");
  6465 + int rows = s.getRows();
  6466 + if (rows > 0) {
  6467 + //遍历每行
  6468 + for (int i = 1; i < rows; i++) {
  6469 + System.out.println("rows=" + i);
  6470 + MicroelementConfigModel model = new MicroelementConfigModel();
  6471 +
  6472 + Cell[] cells = s.getRow(i);
  6473 + List<List<String>> list = new ArrayList<>();
  6474 + if (cells.length > 0) {
  6475 + for (int j = 0; j < cells.length; j++) {
  6476 + String str = cells[j].getContents().trim();
  6477 + switch (j) {
  6478 + case 0:
  6479 + model.setEleName(str);
  6480 + continue;
  6481 + case 1:
  6482 + List<String> list2 = Arrays.asList(str.split("\n"));
  6483 + model.setEarlys(list2);
  6484 + continue;
  6485 + case 2:
  6486 + List<String> list1 = Arrays.asList(str.split("\n"));
  6487 + model.setMiddles(list1);
  6488 + continue;
  6489 + case 3:
  6490 + List<String> list3 = Arrays.asList(str.split("\n"));
  6491 + model.setLaters(list3);
  6492 + continue;
  6493 + case 4:
  6494 + model.setStatus(Integer.parseInt(str));
  6495 + continue;
  6496 + case 5:
  6497 + model.setType(Integer.parseInt(str));
  6498 + continue;
  6499 + }
  6500 + }
  6501 + }
  6502 + mongoTemplate.save(model);
  6503 + }
  6504 + }
  6505 + } catch (Exception e) {
  6506 + e.printStackTrace();
  6507 + }
  6508 + }
  6509 +
6450 6510 public static void main(String[] args) {
6451 6511 // getData();
6452 6512 //weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
... ... @@ -6491,8 +6551,9 @@
6491 6551 // baby12to35ReportNomal("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\秦皇岛定制12-35月龄正常体型一周食谱(1).xls");
6492 6552  
6493 6553  
6494   - saveDiteSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\每类食物不爱吃的指导建议.xls");
6495   - saveDiteDoctorSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\医生建议内容.xls");
  6554 + //saveDiteSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\每类食物不爱吃的指导建议.xls");
  6555 + //saveDiteDoctorSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\医生建议内容.xls");
  6556 + saveMicroelements("E:\\dev\\微量元素指导报告模板.xls");
6496 6557  
6497 6558 }
6498 6559  
platform-dal/src/main/java/com/lyms/platform/pojo/MicroelementConfigModel.java View file @ 73b7d99
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 微量元素
  10 + *
  11 + */
  12 +@Document(collection = "lyms_microelement_config")
  13 +public class MicroelementConfigModel extends BaseModel {
  14 +
  15 +
  16 + private String id;
  17 +
  18 + private String eleName;
  19 +
  20 + private List<String> earlys;//早期建议
  21 + private List<String> middles;//中期建议
  22 + private List<String> laters;//晚期建议
  23 +
  24 + //0过量 1不足
  25 + private Integer status;
  26 +
  27 + //0 孕妇 1儿童
  28 + private Integer type;
  29 +
  30 + public String getId() {
  31 + return id;
  32 + }
  33 +
  34 + public void setId(String id) {
  35 + this.id = id;
  36 + }
  37 +
  38 + public String getEleName() {
  39 + return eleName;
  40 + }
  41 +
  42 + public void setEleName(String eleName) {
  43 + this.eleName = eleName;
  44 + }
  45 +
  46 + public List<String> getEarlys() {
  47 + return earlys;
  48 + }
  49 +
  50 + public void setEarlys(List<String> earlys) {
  51 + this.earlys = earlys;
  52 + }
  53 +
  54 + public List<String> getMiddles() {
  55 + return middles;
  56 + }
  57 +
  58 + public void setMiddles(List<String> middles) {
  59 + this.middles = middles;
  60 + }
  61 +
  62 + public List<String> getLaters() {
  63 + return laters;
  64 + }
  65 +
  66 + public void setLaters(List<String> laters) {
  67 + this.laters = laters;
  68 + }
  69 +
  70 + public Integer getStatus() {
  71 + return status;
  72 + }
  73 +
  74 + public void setStatus(Integer status) {
  75 + this.status = status;
  76 + }
  77 +
  78 + public Integer getType() {
  79 + return type;
  80 + }
  81 +
  82 + public void setType(Integer type) {
  83 + this.type = type;
  84 + }
  85 +}
platform-dal/src/main/java/com/lyms/platform/pojo/MicroelementModel.java View file @ 73b7d99
... ... @@ -57,8 +57,8 @@
57 57 private String result;
58 58 //单位
59 59 private String unit;
60   - //状态
61   - private String status;
  60 + //状态 0 过量 1 不足 2正常
  61 + private Integer status;
62 62  
63 63 //参考值
64 64 private String refValue;
65 65  
... ... @@ -95,11 +95,11 @@
95 95 this.unit = unit;
96 96 }
97 97  
98   - public String getStatus() {
  98 + public Integer getStatus() {
99 99 return status;
100 100 }
101 101  
102   - public void setStatus(String status) {
  102 + public void setStatus(Integer status) {
103 103 this.status = status;
104 104 }
105 105  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MicroelementFacade.java View file @ 73b7d99
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3 3  
  4 +import com.lyms.platform.biz.service.BasicConfigService;
4 5 import com.lyms.platform.biz.service.MicroelementService;
5 6 import com.lyms.platform.biz.service.PatientsService;
6 7 import com.lyms.platform.common.constants.ErrorCodeConstants;
7 8  
8 9  
9 10  
... ... @@ -10,14 +11,20 @@
10 11 import com.lyms.platform.common.result.BaseObjectResponse;
11 12 import com.lyms.platform.common.result.BaseResponse;
12 13 import com.lyms.platform.common.utils.DateUtil;
  14 +import com.lyms.platform.operate.web.utils.FunvCommonUtil;
13 15 import com.lyms.platform.permission.model.PatientService;
  16 +import com.lyms.platform.pojo.MicroelementConfigModel;
14 17 import com.lyms.platform.pojo.MicroelementModel;
  18 +import com.lyms.platform.pojo.PatientWeight;
15 19 import com.lyms.platform.pojo.Patients;
16 20 import com.lyms.platform.query.MicroelementQuery;
17 21 import com.lyms.platform.query.PatientsQuery;
18 22 import org.apache.commons.collections.CollectionUtils;
19 23 import org.apache.commons.lang.StringUtils;
20 24 import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.data.mongodb.core.MongoTemplate;
  26 +import org.springframework.data.mongodb.core.query.Criteria;
  27 +import org.springframework.data.mongodb.core.query.Query;
21 28 import org.springframework.stereotype.Component;
22 29  
23 30 import java.util.*;
... ... @@ -35,6 +42,8 @@
35 42 @Autowired
36 43 private MicroelementService microelementService;
37 44  
  45 + @Autowired
  46 + private BasicConfigService basicConfigService;
38 47  
39 48 @Autowired
40 49 private HealthChargeFacade healthChargeFacade;
... ... @@ -42,6 +51,9 @@
42 51 @Autowired
43 52 private PatientsService patientsService;
44 53  
  54 + @Autowired
  55 + private MongoTemplate mongoTemplate;
  56 +
45 57 public BaseResponse querymicroelementList(String queryNo, Integer weekStart, Integer weekEnd, Integer age, String vcCardNo,Integer type ,Integer page, Integer limit, Integer userId) {
46 58  
47 59  
... ... @@ -118,7 +130,6 @@
118 130  
119 131 public BaseResponse queryMicroelementReport(Integer type,String doctorId, String id, Integer userId) {
120 132 Map data = new HashMap();
121   -
122 133 String hospitalId = autoMatchFacade.getHospitalId(userId);
123 134  
124 135 MicroelementQuery query = new MicroelementQuery();
125 136  
126 137  
... ... @@ -128,17 +139,101 @@
128 139 if (model != null)
129 140 {
130 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));
131 144 data.put("userName",pat.getUsername());
132 145 data.put("age", DateUtil.getAge(pat.getBirth(), model.getCreated()));
133 146 data.put("week", DateUtil.getWeekDesc(pat.getLastMenses(), model.getCreated()));
134 147 data.put("microelements", model.getMicroelements());
135 148 data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
  149 +
  150 + int week = DateUtil.getWeek(pat.getLastMenses(),model.getCreated());
  151 + Map<String,List<String>> contents = new HashMap<>();
  152 + boolean isNormal = false;
  153 +
  154 + if (CollectionUtils.isNotEmpty(model.getMicroelements()))
  155 + {
  156 + for (MicroelementModel.Microelement ele : model.getMicroelements())
  157 + {
  158 + if (2 == ele.getStatus() || "铅".equals(ele.getEleName()))
  159 + {
  160 + isNormal = true;
  161 + continue;
  162 + }
  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);
  165 +
  166 + List<String> datas = new ArrayList<>();
  167 + if (week < 13)
  168 + {
  169 + datas.addAll(configModel.getEarlys());
  170 + }
  171 + else if (week < 28)
  172 + {
  173 + datas.addAll(configModel.getMiddles());
  174 + }
  175 + else
  176 + {
  177 + datas.addAll(configModel.getLaters());
  178 + }
  179 + contents.put(configModel.getEleName(),datas);
  180 + }
  181 + }
  182 +
  183 + String nextCheckDate = "";
  184 + String nextCheckWeek = "";
  185 + if (isNormal) {
  186 + if (week < 13)
  187 + {
  188 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),13));
  189 + nextCheckWeek = "孕13周前后";
  190 + }
  191 + else if (week < 28)
  192 + {
  193 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),28));
  194 + nextCheckWeek = "孕28周前后";
  195 + }
  196 + }
  197 + else
  198 + {
  199 + if (week < 8)
  200 + {
  201 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),8));
  202 + nextCheckWeek = "孕8周前后";
  203 + }
  204 + else if (week < 13)
  205 + {
  206 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),13));
  207 + nextCheckDate = "孕13周前后";
  208 + }
  209 + else if (week < 20)
  210 + {
  211 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),20));
  212 + nextCheckWeek = "孕20周前后";
  213 + }
  214 + else if (week < 28)
  215 + {
  216 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),28));
  217 + nextCheckWeek = "孕28周前后";
  218 + }
  219 + else if (week < 36)
  220 + {
  221 + nextCheckDate = DateUtil.getyyyy_MM_dd1(DateUtil.addWeek(pat.getLastMenses(),36));
  222 + nextCheckWeek = "孕36周前后";
  223 + }
  224 + }
  225 +
  226 + data.put("nextCheckDate", nextCheckDate);
  227 + data.put("nextCheckWeek", nextCheckWeek);
  228 + data.put("contents", contents);
  229 + data.put("isNormal", isNormal);
136 230 }
137 231  
138 232 healthChargeFacade.addHealthCharge(hospitalId, 7, model.getPatientId(), 1, 1, userId, doctorId, false);
139 233 return new BaseObjectResponse().setData(data).
140 234 setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
141 235 }
  236 +
142 237  
143 238 public BaseResponse saveMicroelement(MicroelementModel microelementModel, Integer userId) {
144 239 String hospitalId = autoMatchFacade.getHospitalId(userId);