Commit c4e1cfd53a142e7543b743524173867f93804120

Authored by jiangjiazhi
1 parent 5474767a7c

同一个孕妇在同一医院的本次妊娠期中,只能有一次初诊记录并且在本院的同一天内不能多次复诊

Showing 3 changed files with 39 additions and 3 deletions

platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java View file @ c4e1cfd
... ... @@ -18,13 +18,21 @@
18 18 private String id;
19 19 //创建时间
20 20 private Date start;
21   -
  21 + private String hospitalId;
22 22 private Date end;
23 23  
24 24 private Date nextCheckTime;
25 25 private Date nextCheckTimeStart;
26 26 private Date nextCheckTimeEnd;
27 27  
  28 + public String getHospitalId() {
  29 + return hospitalId;
  30 + }
  31 +
  32 + public void setHospitalId(String hospitalId) {
  33 + this.hospitalId = hospitalId;
  34 + }
  35 +
28 36 public Date getNextCheckTime() {
29 37 return nextCheckTime;
30 38 }
... ... @@ -89,7 +97,9 @@
89 97 condition= condition.and("nextCheckTime",nextCheckTime, MongoOper.IS);
90 98 }
91 99  
92   -
  100 + if(null!=hospitalId){
  101 + condition=condition.and("hospitalId",hospitalId,MongoOper.IS);
  102 + }
93 103  
94 104 boolean isAddStart = Boolean.FALSE;
95 105 Criteria c = null;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ c4e1cfd
... ... @@ -51,6 +51,7 @@
51 51 @Autowired
52 52 private StopPregnancyService stopPregnancyService;
53 53  
  54 +
54 55 /**
55 56 * 增加一条产前检查
56 57 *
... ... @@ -70,6 +71,14 @@
70 71 if (CollectionUtils.isNotEmpty(list1)) {
71 72 model.setHospitalId(list1.get(0) + "");
72 73 }
  74 + AntExQuery antExQuery=new AntExQuery();
  75 + antExQuery.setYn(YnEnums.YES.getId());
  76 + antExQuery.setParentId(antExAddRequest.getParentId());
  77 + antExQuery.setStart(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())));
  78 + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  79 + if(CollectionUtils.isNotEmpty(list)){
  80 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("同一天只能建一次复诊");
  81 + }
73 82 antenatalExaminationService.addOneBabyAnt(model);
74 83 updateApplyOrder(model, antExAddRequest.getParentId());
75 84 }
... ... @@ -107,6 +116,22 @@
107 116 List list1 = autoMatchFacade.matchOrgId(userId);
108 117 if (CollectionUtils.isNotEmpty(list1)) {
109 118 antExChuModel.setHospitalId(list1.get(0) + "");
  119 + AntExChuQuery antExChuQuery=new AntExChuQuery();
  120 + antExChuQuery.setYn(YnEnums.YES.getId());
  121 + antExChuQuery.setHospitalId(list1.get(0) + "");
  122 +
  123 + Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
  124 + PatientsQuery patientsQuery=new PatientsQuery();
  125 + patientsQuery.setPid(patients.getPid());
  126 + patientsQuery.setYn(YnEnums.YES.getId());
  127 +
  128 + List<Patients> list = patientsService.queryPatient(patientsQuery);
  129 + antExChuQuery.setStart(list.get(0).getCreated());
  130 +
  131 + List<AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery);
  132 + if(CollectionUtils.isNotEmpty(data)){
  133 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("您本次妊娠中已在本医院建档");
  134 + }
110 135 }
111 136 antExChuModel.setYn(YnEnums.YES.getId());
112 137 antenatalExaminationService.addOneAntEx(antExChuModel);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AntExAddRequest.java View file @ c4e1cfd
... ... @@ -6,6 +6,7 @@
6 6 import com.lyms.platform.common.utils.JsonUtil;
7 7 import com.lyms.platform.pojo.AntenatalExaminationModel;
8 8 import org.codehaus.jackson.annotate.JsonIgnore;
  9 +import org.hibernate.validator.constraints.NotEmpty;
9 10  
10 11 import java.util.List;
11 12 import java.util.Map;
... ... @@ -130,7 +131,7 @@
130 131  
131 132 examinationModel.setNextCheckTime(DateUtil.parseYMD(nextCheckTime));
132 133 }
133   -examinationModel.setcDueWeek(cDueWeek);
  134 + examinationModel.setcDueWeek(cDueWeek);
134 135 return examinationModel;
135 136 }
136 137