Commit 5d15c4c337ee89edabdd28b0e88e814b791b3791

Authored by yangfei

Merge remote-tracking branch 'origin/master'

Showing 10 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java View file @ 5d15c4c
... ... @@ -137,28 +137,17 @@
137 137  
138 138 @Override
139 139 public int queryWeekPointCount(int startWeek, int endWeek, String hospitalId, Date startTime, Date endTime,Integer pointType) {
140   -// String map = "function(){ " +
141   -// " if (this.hospitalId == '"+hospitalId+"' && this.checkTime != null && this.lastMenses != null) { " +
142   -// " var start = this.lastMenses; " +
143   -// " var end = this.checkTime; " +
144   -// " var iDays = parseInt(Math.abs(end - start ) / 86400000); " +
145   -// " var week = parseInt(iDays/7)+1; " +
146   -// " if (week >= "+startWeek+" && week <= "+endWeek+")" +
147   -// " { " +
148   -// " emit(this._id,{checkTime:end,parentId:this.parentId}); " +
149   -// " } " +
150   -// " } " +
151   -// "}";
152   - String map = "function(){ " +
153   - " if (this.hospitalId == '"+hospitalId+"' && this.checkTime != null && this.lastMenses != null) { " +
154   - " var end = this.checkTime; " +
155   - " var week = parseInt(this.cDay/7); " +
156   - " if (week >= "+startWeek+" && week <= "+endWeek+")" +
157   - " { " +
158   - " emit(this._id,{checkTime:end,parentId:this.parentId}); " +
159   - " } " +
160   - " } " +
161   - "}";
  140 + String map = "function(){ " +
  141 + " if (this.hospitalId == '"+hospitalId+"' && this.checkTime != null && this.lastMenses != null) { " +
  142 + " var end = this.checkTime; " +
  143 + " var week = parseInt(this.cDay/7); " +
  144 + " if (week >= "+startWeek+" && week <= "+endWeek+")" +
  145 + " { " +
  146 + " emit(this._id,{checkTime:end,parentId:this.parentId}); " +
  147 + " } " +
  148 + " } " +
  149 + "}";
  150 +
162 151 String reduce = "function(key, values) { return values.toString(); }";
163 152  
164 153 DBCollection collections =this.mongoTemplate.getCollection("lyms_antexrecord");
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java View file @ 5d15c4c
... ... @@ -58,13 +58,13 @@
58 58 * @param antExRecordQuery
59 59 * @return
60 60 */
61   - public List<AntExPRecordModel> queryAntExRecords1(AntExRecordQuery antExRecordQuery) {
  61 + public List<AntExPRecordModel> queryAntExRecords(AntExRecordQuery antExRecordQuery,String sortField) {
62 62 MongoQuery query = antExRecordQuery.convertToQuery();
63 63 if (StringUtils.isNotEmpty(antExRecordQuery.getNeed())) {
64 64 antExRecordQuery.mysqlBuild(iAntExRecordMDao.count(query));
65 65 query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit());
66 66 }
67   - return iAntExRecordMDao.queryRecord(query.addOrder(Sort.Direction.DESC, "checkTime"));
  67 + return iAntExRecordMDao.queryRecord(query.addOrder(Sort.Direction.DESC, sortField));
68 68 }
69 69  
70 70  
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java View file @ 5d15c4c
... ... @@ -6,6 +6,7 @@
6 6 public enum SerialIdEnum {
7 7 AntenatalExaminationModel("AntenatalExaminationModel", 97531000010L),
8 8 AntExChuModel("AntExChuModel", 97531000020L),
  9 + OperateLogModel("OperateLogModel", 97531000121L),
9 10 AntExRecordModel("AntExRecordModel", 97531000030L),
10 11 ArchiveData("ArchiveData", 97531000040L),
11 12 AssayConfig("AssayConfig", 97531000050L),
platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java View file @ 5d15c4c
... ... @@ -81,7 +81,7 @@
81 81 private String streetId;
82 82  
83 83 // 0~12 孕周 16~20 孕周 21~24 孕周 28~36 孕周 37~ 分娩
84   - // 1 表示在上面各个孕周范围内的第一次检查,2 不是
  84 + // 1 表示在上面各个孕周范围内的第一次检查,2或者空表示 不是
85 85 private Integer isFirst;
86 86  
87 87 public Integer getIsFirst() {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java View file @ 5d15c4c
... ... @@ -119,5 +119,11 @@
119 119 return patientWeightService.wxAddOrUpdateSync(patientWeight);
120 120 }
121 121  
  122 + @ResponseBody
  123 + @RequestMapping(value = "/update", method = RequestMethod.POST)
  124 + public BaseResponse update(String id, String beforeWeight, String beforeHeight) {
  125 + return patientWeightService.update(id, beforeWeight, beforeHeight);
  126 + }
  127 +
122 128 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 5d15c4c
... ... @@ -93,6 +93,10 @@
93 93 @Autowired
94 94 private GenSequenceIdService genIdService;
95 95  
  96 +
  97 + @Autowired
  98 + private AntExRecordService recordService;
  99 +
96 100 /**
97 101 * 获取科室
98 102 */
... ... @@ -341,6 +345,103 @@
341 345  
342 346 return "update finish";
343 347 }
  348 +
  349 +
  350 + /**
  351 + * 计算产检是不是对应孕周断中的第一次
  352 + * @param hospitalId
  353 + * @return
  354 + */
  355 + @RequestMapping(value = "/updateCheckRecord", method = RequestMethod.GET)
  356 + @ResponseBody
  357 + public String updateCheckRecord(@RequestParam(required = false) String hospitalId)
  358 + {
  359 +
  360 + OrganizationQuery organizationQuery = new OrganizationQuery();
  361 + organizationQuery.setYn(YnEnums.YES.getId());
  362 + if (StringUtils.isNotEmpty(hospitalId))
  363 + {
  364 + organizationQuery.setId(Integer.parseInt(hospitalId));
  365 + }
  366 + List<Organization> organizationList = organizationService.queryOrganization(organizationQuery);
  367 +
  368 + PatientsQuery patientsQuery1 = new PatientsQuery();
  369 + patientsQuery1.setYn(YnEnums.YES.getId());
  370 +
  371 + if (CollectionUtils.isNotEmpty(organizationList))
  372 + {
  373 + for (Organization organization : organizationList) {
  374 +
  375 + patientsQuery1.setHospitalId(organization.getId()+"");
  376 + List<Patients> pats = patientsService.queryPatient(patientsQuery1);
  377 +
  378 + int batchSize = 1000;
  379 + int end = 0;
  380 + for (int i = 0; i < pats.size(); i += batchSize) {
  381 + end = (end + batchSize);
  382 + if (end > pats.size()) {
  383 + end = pats.size();
  384 + }
  385 + System.out.println("start:" + i + ",end:" + end);
  386 + final List<Patients> tempList = pats.subList(i, end);
  387 +
  388 + new Thread(new Runnable() {
  389 + @Override
  390 + public void run() {
  391 + if (CollectionUtils.isNotEmpty(tempList)) {
  392 + AntExRecordQuery antExRecordQuery = new AntExRecordQuery();
  393 + for (Patients pat : tempList) {
  394 + antExRecordQuery.setParentId(pat.getId());
  395 + if (StringUtils.isNotEmpty(pat.getId()))
  396 + {
  397 +
  398 + for (int i = 0 ; i < 5 ; i++)
  399 + {
  400 + if (i == 0)
  401 + {
  402 + antExRecordQuery.setcDueWeekStart(0);
  403 + antExRecordQuery.setcDueWeekEnd((12 + 1) * 7 - 1);
  404 + }
  405 + else if (i == 1)
  406 + {
  407 + antExRecordQuery.setcDueWeekStart(16);
  408 + antExRecordQuery.setcDueWeekEnd((20 + 1) * 7 - 1);
  409 + }
  410 + else if (i == 2)
  411 + {
  412 + antExRecordQuery.setcDueWeekStart(21);
  413 + antExRecordQuery.setcDueWeekEnd((24 + 1) * 7 - 1);
  414 + }
  415 + else if (i == 3)
  416 + {
  417 + antExRecordQuery.setcDueWeekStart(28);
  418 + antExRecordQuery.setcDueWeekEnd((36 + 1) * 7 - 1);
  419 + }
  420 + else if (i == 4)
  421 + {
  422 + antExRecordQuery.setcDueWeekStart(37);
  423 + antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1);
  424 + }
  425 +
  426 + List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery);
  427 + if (CollectionUtils.isNotEmpty(list))
  428 + {
  429 + AntExRecordModel m = list.get(list.size() - 1);
  430 + m.setIsFirst(1);
  431 + recordService.updateOne(m,m.getId());
  432 + }
  433 + }
  434 + }
  435 + }
  436 + }
  437 + }
  438 + }).start();
  439 + }
  440 + }
  441 + }
  442 + return "updateCheckRecord finish";
  443 + }
  444 +
344 445  
345 446  
346 447 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 5d15c4c
... ... @@ -29,6 +29,10 @@
29 29 import org.slf4j.LoggerFactory;
30 30 import org.springframework.beans.factory.annotation.Autowired;
31 31 import org.springframework.beans.factory.annotation.Qualifier;
  32 +import org.springframework.data.domain.Sort;
  33 +import org.springframework.data.mongodb.core.MongoTemplate;
  34 +import org.springframework.data.mongodb.core.query.Criteria;
  35 +import org.springframework.data.mongodb.core.query.Query;
32 36 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
33 37 import org.springframework.stereotype.Component;
34 38 import org.springframework.util.StopWatch;
35 39  
... ... @@ -89,7 +93,10 @@
89 93 @Qualifier("commonThreadPool")
90 94 private ThreadPoolTaskExecutor commonThreadPool;
91 95  
  96 + @Autowired
  97 + private MongoTemplate mongoTemplate;
92 98  
  99 +
93 100 /**
94 101 * 修改产妇的社区
95 102 *
... ... @@ -1083,6 +1090,14 @@
1083 1090 patientBaseResult.setRiskFactor(highScoreResult.getHighRisk());
1084 1091 patientBaseResult.setRiskScore(highScoreResult.getScoreStr());
1085 1092 } catch (Exception e) {
  1093 + }
  1094 + Patients p = mongoTemplate.findById(patientBaseResult.getId(), Patients.class);
  1095 + if(p != null) {
  1096 + AntExChuModel chuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(p.getPid()).and("yn").ne("0")).with(new Sort(Sort.Direction.DESC, "created")), AntExChuModel.class);
  1097 + if(chuModel != null) {
  1098 + patientBaseResult.setHeight(StringUtils.isNotEmpty(chuModel.getHeight()) ? chuModel.getHeight() : "");
  1099 + patientBaseResult.setWeight(StringUtils.isNotEmpty(chuModel.getWeight()) ? chuModel.getWeight() : "");
  1100 + }
1086 1101 }
1087 1102 return new BaseObjectResponse().setData(patientBaseResult).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
1088 1103 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientBaseResult.java View file @ 5d15c4c
... ... @@ -33,6 +33,27 @@
33 33 //1 孕妇 0 产妇
34 34 private String isGravida;
35 35  
  36 + // 身高
  37 + private String height;
  38 + //体重
  39 + private String weight ;
  40 +
  41 + public String getHeight() {
  42 + return height;
  43 + }
  44 +
  45 + public void setHeight(String height) {
  46 + this.height = height;
  47 + }
  48 +
  49 + public String getWeight() {
  50 + return weight;
  51 + }
  52 +
  53 + public void setWeight(String weight) {
  54 + this.weight = weight;
  55 + }
  56 +
36 57 public String getIsGravida() {
37 58 return isGravida;
38 59 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java View file @ 5d15c4c
... ... @@ -26,5 +26,7 @@
26 26 BaseResponse wxAddOrUpdate(PatientWeight patientWeight);
27 27  
28 28 BaseResponse wxAddOrUpdateSync(PatientWeight patientWeight);
  29 +
  30 + BaseResponse update(String id, String beforeWeight, String beforeHeight);
29 31 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ 5d15c4c
... ... @@ -399,6 +399,17 @@
399 399 return RespBuilder.buildSuccess(patientWeight.getId());
400 400 }
401 401  
  402 + @Override
  403 + public BaseResponse update(String id, String beforeWeight, String beforeHeight) {
  404 + PatientWeight pw = new PatientWeight();
  405 + pw.setId(id);
  406 + pw.setBeforeHeight(beforeHeight);
  407 + pw.setBeforeWeight(beforeWeight);
  408 + pw.setBmi(getBmi(beforeWeight, beforeHeight));
  409 + patientWeightService2.update(Query.query(Criteria.where("id").is(id)), pw);
  410 + return RespBuilder.buildSuccess(id);
  411 + }
  412 +
402 413 private void setGuide(Integer week, Map<String, Object> map) {
403 414 if(week <= 12) {
404 415 Map<String, Object> map1 = setData2("膳食清淡、适口", "避免过咸、过甜和油腻的食物,这样能增加食欲,易于消化,有利于降低怀孕早期的妊娠反应,满足营养的需要。每日盐不超过6克,油不超过20克,可食用植物油,少用动物油。");