Commit 435a69150f4aaf58a3df383cf043a00803179770

Authored by liquanyu
1 parent a9b935f297

update code

Showing 9 changed files with 344 additions and 2 deletions

platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java View file @ 435a691
... ... @@ -23,6 +23,8 @@
23 23 Cookbook("Cookbook", 97231020081L),
24 24 BabyVisitModel("BabyVisitModel", 97531000090L),
25 25 BasicConfig("BasicConfig", 97531000100L),
  26 + CheckItemOrder("CheckItemOrder", 97531500100L),
  27 + CheckItemConfig("CheckItemConfig", 97531320100L),
26 28 BCInventoryModel("BCInventoryModel", 97531000110L),
27 29 BCTransferInHistoryModel("BCTransferInHistoryModel", 97531000120L),
28 30 CommunityConfig("CommunityConfig", 97531000130L),
platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemConfig.java View file @ 435a691
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.common.result.BaseModel;
  5 +import org.springframework.data.mongodb.core.mapping.Document;
  6 +
  7 +import java.util.Date;
  8 +
  9 +
  10 +/**
  11 + * 处方报表基础项配置
  12 + */
  13 +@Document(collection="lyms_check_item_config")
  14 +public class CheckItemConfig extends BaseModel {
  15 +
  16 + private static final long serialVersionUID = SerialIdEnum.CheckItemConfig.getCid();
  17 +
  18 + private String id;
  19 + private String hospitalId;
  20 + private String name;
  21 + private Integer startWeek;
  22 + private Integer endWeek;
  23 + private Integer enable;
  24 + private Date created;
  25 + private Date modified;
  26 +
  27 + public String getId() {
  28 + return id;
  29 + }
  30 +
  31 + public void setId(String id) {
  32 + this.id = id;
  33 + }
  34 +
  35 + public String getHospitalId() {
  36 + return hospitalId;
  37 + }
  38 +
  39 + public void setHospitalId(String hospitalId) {
  40 + this.hospitalId = hospitalId;
  41 + }
  42 +
  43 + public String getName() {
  44 + return name;
  45 + }
  46 +
  47 + public void setName(String name) {
  48 + this.name = name;
  49 + }
  50 +
  51 + public Integer getStartWeek() {
  52 + return startWeek;
  53 + }
  54 +
  55 + public void setStartWeek(Integer startWeek) {
  56 + this.startWeek = startWeek;
  57 + }
  58 +
  59 + public Integer getEndWeek() {
  60 + return endWeek;
  61 + }
  62 +
  63 + public void setEndWeek(Integer endWeek) {
  64 + this.endWeek = endWeek;
  65 + }
  66 +
  67 + public Integer getEnable() {
  68 + return enable;
  69 + }
  70 +
  71 + public void setEnable(Integer enable) {
  72 + this.enable = enable;
  73 + }
  74 +
  75 + public Date getCreated() {
  76 + return created;
  77 + }
  78 +
  79 + public void setCreated(Date created) {
  80 + this.created = created;
  81 + }
  82 +
  83 + public Date getModified() {
  84 + return modified;
  85 + }
  86 +
  87 + public void setModified(Date modified) {
  88 + this.modified = modified;
  89 + }
  90 +}
platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemOrder.java View file @ 435a691
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.common.result.BaseModel;
  5 +import org.springframework.data.mongodb.core.mapping.Document;
  6 +
  7 +import java.util.Date;
  8 +
  9 +
  10 +/**
  11 + * 处方计划内容
  12 + */
  13 +@Document(collection="lyms_check_item_order")
  14 +public class CheckItemOrder extends BaseModel {
  15 +
  16 + private static final long serialVersionUID = SerialIdEnum.CheckItemOrder.getCid();
  17 +
  18 + private String id;
  19 + private String itemId;
  20 + private String patientId;
  21 + private Date nextCheckTime;
  22 + private String hospitalId;
  23 + private Date created;
  24 +
  25 + public String getHospitalId() {
  26 + return hospitalId;
  27 + }
  28 +
  29 + public void setHospitalId(String hospitalId) {
  30 + this.hospitalId = hospitalId;
  31 + }
  32 +
  33 + public String getId() {
  34 + return id;
  35 + }
  36 +
  37 + public void setId(String id) {
  38 + this.id = id;
  39 + }
  40 +
  41 + public String getItemId() {
  42 + return itemId;
  43 + }
  44 +
  45 + public void setItemId(String itemId) {
  46 + this.itemId = itemId;
  47 + }
  48 +
  49 + public String getPatientId() {
  50 + return patientId;
  51 + }
  52 +
  53 + public void setPatientId(String patientId) {
  54 + this.patientId = patientId;
  55 + }
  56 +
  57 + public Date getNextCheckTime() {
  58 + return nextCheckTime;
  59 + }
  60 +
  61 + public void setNextCheckTime(Date nextCheckTime) {
  62 + this.nextCheckTime = nextCheckTime;
  63 + }
  64 +
  65 + public Date getCreated() {
  66 + return created;
  67 + }
  68 +
  69 + public void setCreated(Date created) {
  70 + this.created = created;
  71 + }
  72 +}
platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java View file @ 435a691
... ... @@ -49,6 +49,9 @@
49 49 private Date birthEnd;
50 50 private Date birthStart;
51 51  
  52 + private Date nextCheckTimeStart;
  53 + private Date nextCheckTimeEnd;
  54 +
52 55 //户籍地
53 56 private String provinceRegisterId;
54 57 private String cityRegisterId;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java View file @ 435a691
... ... @@ -471,5 +471,34 @@
471 471 return antExRecordFacade.zd();
472 472 }*/
473 473  
  474 + /**
  475 + *处方计划报表
  476 + * @param orderTime 预约时间
  477 + * @param request
  478 + * @return
  479 + */
  480 + @RequestMapping(method = RequestMethod.GET, value = "/getPlanReport")
  481 + @ResponseBody
  482 + @TokenRequired
  483 + public BaseResponse getPlanReport(@RequestParam String orderTime, HttpServletRequest request) {
  484 + return antExRecordFacade.getPlanReport(orderTime,getUserId(request));
  485 + }
  486 +
  487 + /**
  488 + * 处方实际报表
  489 + * @param checkTime 产检时间
  490 + * @param request
  491 + * @return
  492 + */
  493 + @RequestMapping(method = RequestMethod.GET, value = "/getActualReport")
  494 + @ResponseBody
  495 + @TokenRequired
  496 + public BaseResponse getActualReport(@RequestParam String checkTime, HttpServletRequest request) {
  497 + return antExRecordFacade.getActualReport(checkTime,getUserId(request));
  498 + }
  499 +
  500 +
  501 +
  502 +
474 503 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BasicConfigController.java View file @ 435a691
1 1 package com.lyms.platform.operate.web.controller;
2 2  
  3 +import com.lyms.platform.common.annotation.TokenRequired;
3 4 import com.lyms.platform.common.base.BaseController;
4 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
5 6 import com.lyms.platform.common.result.BaseListResponse;
6 7  
... ... @@ -10,11 +11,13 @@
10 11 import com.lyms.platform.operate.web.request.BasicConfigQueryRequest;
11 12 import com.lyms.platform.operate.web.request.BasicConfigUpdateRequest;
12 13 import com.lyms.platform.operate.web.result.FrontEndResult;
  14 +import com.lyms.platform.pojo.CheckItemConfig;
13 15 import org.springframework.beans.factory.annotation.Autowired;
14 16 import org.springframework.http.MediaType;
15 17 import org.springframework.stereotype.Controller;
16 18 import org.springframework.web.bind.annotation.*;
17 19  
  20 +import javax.servlet.http.HttpServletRequest;
18 21 import javax.validation.Valid;
19 22 import java.util.ArrayList;
20 23 import java.util.List;
... ... @@ -187,5 +190,42 @@
187 190 public BaseResponse getHighRisk() {
188 191 return basicConfigFacade.getHighRisk();
189 192 }*/
  193 +
  194 +
  195 + /**
  196 + *查询处方计划配置项c
  197 + * @return
  198 + */
  199 + @RequestMapping(method = RequestMethod.GET, value = "/queryCheckItemConfig")
  200 + @ResponseBody
  201 + @TokenRequired
  202 + public BaseResponse queryCheckItemConfig( HttpServletRequest request) {
  203 + return basicConfigFacade.queryCheckItemConfig(getUserId(request));
  204 + }
  205 +
  206 + /**
  207 + * 添加
  208 + * @param request
  209 + * @return
  210 + */
  211 + @RequestMapping(method = RequestMethod.POST, value = "/addCheckItemConfig")
  212 + @ResponseBody
  213 + @TokenRequired
  214 + public BaseResponse addCheckItemConfig(@Valid CheckItemConfig itemConfig,HttpServletRequest request) {
  215 + return basicConfigFacade.addCheckItemConfig(itemConfig,getUserId(request));
  216 + }
  217 +
  218 + /**
  219 + * 删除
  220 + * @param id
  221 + * @param request
  222 + * @return
  223 + */
  224 + @RequestMapping(method = RequestMethod.DELETE, value = "/deleteCheckItemConfig/{id}")
  225 + @ResponseBody
  226 + @TokenRequired
  227 + public BaseResponse addCheckItemConfig(@PathVariable String id,HttpServletRequest request) {
  228 + return basicConfigFacade.deleteCheckItemConfig(id);
  229 + }
190 230 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 435a691
... ... @@ -1287,6 +1287,39 @@
1287 1287 return sb.toString().toUpperCase();
1288 1288 }
1289 1289  
  1290 + public BaseResponse getPlanReport(String orderTime, Integer userId) {
1290 1291  
  1292 + Map<String,Object> data = new HashMap<>();
  1293 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  1294 + if (orderTime != null)
  1295 + {
  1296 + String[] arrs = orderTime.split(" - ");
  1297 + Date start = DateUtil.parseYMD(arrs[0]);
  1298 + Date end = DateUtil.parseYMD(arrs[1]);
  1299 + long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemOrder.class);
  1300 + data.put("allCount",String.valueOf(count));
  1301 +
  1302 + List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(hospitalId)), CheckItemConfig.class);
  1303 + if (CollectionUtils.isNotEmpty(itemConfigs))
  1304 + {
  1305 + List<Map> list = new ArrayList<>();
  1306 + for (CheckItemConfig item : itemConfigs)
  1307 + {
  1308 + long itemCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId())), CheckItemOrder.class);
  1309 + Map<String,String> map = new HashMap<>();
  1310 + map.put("itemName",item.getName());
  1311 + map.put("itemCount",String.valueOf(itemCount));
  1312 + list.add(map);
  1313 + }
  1314 + data.put("itemList",list);
  1315 + }
  1316 + }
  1317 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setErrormsg("成功");
  1318 + }
  1319 +
  1320 + public BaseResponse getActualReport(String checkTime, Integer userId) {
  1321 +
  1322 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData(null).setErrormsg("成功");
  1323 + }
1291 1324 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 435a691
... ... @@ -410,8 +410,8 @@
410 410 commonThreadPool.execute(new Runnable() {
411 411 @Override
412 412 public void run() {
  413 + Patients patients = patientsService.findOnePatientById(antExamModel.getParentId());
413 414 try {
414   - Patients patients = patientsService.findOnePatientById(antExamModel.getParentId());
415 415 if (patients != null) {
416 416 patients.setVcCardNo(antExAddRequest.getVcCardNo());
417 417 //发送推送消息
... ... @@ -490,6 +490,16 @@
490 490 // zcPrenatalService.saveAntexFu(antExamModel);
491 491 // }
492 492  
  493 + try {
  494 + //处方计划
  495 + if (antExamModel.getNextCheckTime() != null)
  496 + {
  497 + saveCheckItem(antExamModel.getNextCheckTime(),patients);
  498 + }
  499 + } catch (Exception e) {
  500 + e.printStackTrace();
  501 + }
  502 +
493 503 }
494 504 });
495 505  
496 506  
497 507  
... ... @@ -1117,11 +1127,41 @@
1117 1127 // {
1118 1128 // zcPrenatalService.saveAntexChu(antExChuModel);
1119 1129 // }
  1130 +
  1131 +
  1132 + try {
  1133 + //处方计划
  1134 + if (excAddRequest.getNextCheckTime() != null)
  1135 + {
  1136 + saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()),patients);
  1137 + }
  1138 + } catch (Exception e) {
  1139 + e.printStackTrace();
  1140 + }
1120 1141 }
1121 1142 });
1122 1143 }
  1144 + public void saveCheckItem(Date nextCheckTime,Patients patients)
  1145 + {
  1146 + List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(patients.getHospitalId())), CheckItemConfig.class);
  1147 + if (CollectionUtils.isNotEmpty(itemConfigs))
  1148 + {
  1149 + for(CheckItemConfig checkItemConfig : itemConfigs)
  1150 + {
  1151 + int currentWeek = DateUtil.getWeek(patients.getLastMenses(),nextCheckTime);
  1152 + if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek)
  1153 + {
  1154 + CheckItemOrder order = new CheckItemOrder();
  1155 + order.setCreated(new Date());
  1156 + order.setNextCheckTime(nextCheckTime);
  1157 + order.setItemId(checkItemConfig.getId());
  1158 + order.setPatientId(patients.getId());
  1159 + mongoTemplate.save(order);
  1160 + }
  1161 + }
  1162 + }
  1163 + }
1123 1164  
1124   -
1125 1165 /**
1126 1166 * 初诊、复诊添加或更新追访信息
1127 1167 *
... ... @@ -2356,6 +2396,8 @@
2356 2396  
2357 2397 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
2358 2398 }
  2399 +
  2400 +
2359 2401  
2360 2402  
2361 2403 public class SortIn {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BasicConfigFacade.java View file @ 435a691
... ... @@ -17,12 +17,16 @@
17 17 import com.lyms.platform.operate.web.result.TreeNode;
18 18 import com.lyms.platform.operate.web.utils.TreeHelper;
19 19 import com.lyms.platform.pojo.BasicConfig;
  20 +import com.lyms.platform.pojo.CheckItemConfig;
  21 +import com.lyms.platform.pojo.ModularFunctionConfigModel;
20 22 import com.lyms.platform.query.BasicConfigQuery;
21 23 import com.mongodb.Mongo;
22 24 import org.apache.commons.collections.CollectionUtils;
23 25 import org.springframework.beans.factory.annotation.Autowired;
24 26 import org.springframework.data.authentication.UserCredentials;
25 27 import org.springframework.data.mongodb.core.MongoTemplate;
  28 +import org.springframework.data.mongodb.core.query.Criteria;
  29 +import org.springframework.data.mongodb.core.query.Query;
26 30 import org.springframework.stereotype.Component;
27 31  
28 32 import java.util.*;
... ... @@ -33,6 +37,10 @@
33 37 private BasicConfigService basicConfigService;
34 38  
35 39 private static List<BasicConfig> mainBasicConfigList;
  40 + @Autowired
  41 + private AutoMatchFacade autoMatchFacade;
  42 + @Autowired
  43 + private MongoTemplate mongoTemplate;
36 44  
37 45 /**
38 46 * 获取新版的高危因数
... ... @@ -574,5 +582,28 @@
574 582 map.put("towns", towns);
575 583 return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
576 584 }
  585 +
  586 + public BaseResponse queryCheckItemConfig(Integer userId) {
  587 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  588 + List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(hospitalId)), CheckItemConfig.class);
  589 +
  590 + return new BaseObjectResponse().setData(itemConfigs).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  591 + }
  592 +
  593 + public BaseResponse addCheckItemConfig(CheckItemConfig itemConfig,Integer userId) {
  594 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  595 + itemConfig.setHospitalId(hospitalId);
  596 + itemConfig.setCreated(new Date());
  597 + itemConfig.setModified(new Date());
  598 + mongoTemplate.save(itemConfig);
  599 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  600 + }
  601 +
  602 +
  603 + public BaseResponse deleteCheckItemConfig(String id) {
  604 + mongoTemplate.remove(Query.query(Criteria.where("_id").is(id)), CheckItemConfig.class);
  605 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  606 + }
  607 +
577 608 }