Commit b9dfeffdb779b5c3b199f3eb2031a073b2e9a0db

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

update code

Showing 4 changed files with 152 additions and 0 deletions

platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java View file @ b9dfeff
... ... @@ -24,6 +24,7 @@
24 24 BabyVisitModel("BabyVisitModel", 97531000090L),
25 25 BasicConfig("BasicConfig", 97531000100L),
26 26 CheckItemOrder("CheckItemOrder", 97531500100L),
  27 + CheckItemActual("CheckItemActual", 97521500100L),
27 28 CheckItemConfig("CheckItemConfig", 97531320100L),
28 29 BCInventoryModel("BCInventoryModel", 97531000110L),
29 30 BCTransferInHistoryModel("BCTransferInHistoryModel", 97531000120L),
platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemActual.java View file @ b9dfeff
  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_actual")
  14 +public class CheckItemActual 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 checkTime;
  22 + private String hospitalId;
  23 + // 0 未做检出 1已结做检出
  24 + private Integer status;
  25 + private Date created;
  26 +
  27 + public Date getCheckTime() {
  28 + return checkTime;
  29 + }
  30 +
  31 + public void setCheckTime(Date checkTime) {
  32 + this.checkTime = checkTime;
  33 + }
  34 +
  35 + public Integer getStatus() {
  36 + return status;
  37 + }
  38 +
  39 + public void setStatus(Integer status) {
  40 + this.status = status;
  41 + }
  42 +
  43 + public String getHospitalId() {
  44 + return hospitalId;
  45 + }
  46 +
  47 + public void setHospitalId(String hospitalId) {
  48 + this.hospitalId = hospitalId;
  49 + }
  50 +
  51 + public String getId() {
  52 + return id;
  53 + }
  54 +
  55 + public void setId(String id) {
  56 + this.id = id;
  57 + }
  58 +
  59 + public String getItemId() {
  60 + return itemId;
  61 + }
  62 +
  63 + public void setItemId(String itemId) {
  64 + this.itemId = itemId;
  65 + }
  66 +
  67 + public String getPatientId() {
  68 + return patientId;
  69 + }
  70 +
  71 + public void setPatientId(String patientId) {
  72 + this.patientId = patientId;
  73 + }
  74 +
  75 +
  76 +
  77 + public Date getCreated() {
  78 + return created;
  79 + }
  80 +
  81 + public void setCreated(Date created) {
  82 + this.created = created;
  83 + }
  84 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ b9dfeff
... ... @@ -1319,6 +1319,31 @@
1319 1319  
1320 1320 public BaseResponse getActualReport(String checkTime, Integer userId) {
1321 1321  
  1322 + Map<String,Object> data = new HashMap<>();
  1323 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  1324 + if (checkTime != null) {
  1325 + String[] arrs = checkTime.split(" - ");
  1326 + Date start = DateUtil.parseYMD(arrs[0]);
  1327 + Date end = DateUtil.parseYMD(arrs[1]);
  1328 + long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("checkTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemActual.class);
  1329 + data.put("allCount", String.valueOf(count));
  1330 +
  1331 + List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(hospitalId)), CheckItemConfig.class);
  1332 + if (CollectionUtils.isNotEmpty(itemConfigs)) {
  1333 + List<Map> list = new ArrayList<>();
  1334 + for (CheckItemConfig item : itemConfigs) {
  1335 + long itemCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("checkTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId())), CheckItemActual.class);
  1336 + Map<String, String> map = new HashMap<>();
  1337 + map.put("itemName", item.getName());
  1338 + map.put("itemCount", String.valueOf(itemCount));
  1339 + long actualCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("checkTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId()).and("status").is(1)), CheckItemActual.class);
  1340 + list.add(map);
  1341 +
  1342 + map.put("actualCount", String.valueOf(actualCount));
  1343 + }
  1344 + data.put("itemList", list);
  1345 + }
  1346 + }
1322 1347 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData(null).setErrormsg("成功");
1323 1348 }
1324 1349 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ b9dfeff
... ... @@ -499,6 +499,15 @@
499 499 } catch (Exception e) {
500 500 e.printStackTrace();
501 501 }
  502 + try {
  503 + //处方计划
  504 + if (antExamModel.getCheckDate() != null)
  505 + {
  506 + saveCheckActual(antExamModel.getCheckDate(), patients);
  507 + }
  508 + } catch (Exception e) {
  509 + e.printStackTrace();
  510 + }
502 511  
503 512 }
504 513 });
... ... @@ -1138,6 +1147,15 @@
1138 1147 } catch (Exception e) {
1139 1148 e.printStackTrace();
1140 1149 }
  1150 + try {
  1151 + //处方计划
  1152 + if (excAddRequest.getCheckTime()!= null)
  1153 + {
  1154 + saveCheckActual(DateUtil.parseYMD(excAddRequest.getCheckTime()), patients);
  1155 + }
  1156 + } catch (Exception e) {
  1157 + e.printStackTrace();
  1158 + }
1141 1159 }
1142 1160 });
1143 1161 }
... ... @@ -1160,6 +1178,30 @@
1160 1178 mongoTemplate.save(order);
1161 1179 }
1162 1180 }
  1181 + }
  1182 + }
  1183 +
  1184 +
  1185 + public void saveCheckActual(Date checkTime,Patients patients)
  1186 + {
  1187 + List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(patients.getHospitalId())), CheckItemConfig.class);
  1188 + if (CollectionUtils.isNotEmpty(itemConfigs))
  1189 + {
  1190 + for(CheckItemConfig checkItemConfig : itemConfigs)
  1191 + {
  1192 + int currentWeek = DateUtil.getWeek(patients.getLastMenses(),checkTime);
  1193 + if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek)
  1194 + {
  1195 + CheckItemActual actual = new CheckItemActual();
  1196 + actual.setCreated(new Date());
  1197 + actual.setHospitalId(patients.getHospitalId());
  1198 + actual.setCheckTime(checkTime);
  1199 + actual.setItemId(checkItemConfig.getId());
  1200 + actual.setPatientId(patients.getId());
  1201 + actual.setStatus(0);
  1202 + mongoTemplate.save(actual);
  1203 + }
  1204 + }
1163 1205 }
1164 1206 }
1165 1207