Commit d18fa625a963c0d83f99ffc01ca9b3304078a2ab

Authored by jiangjiazhi
1 parent a7b9a335ee

增加字段

Showing 5 changed files with 167 additions and 8 deletions

platform-dal/src/main/java/com/lyms/platform/query/DischargeAbstractMotherQuery.java View file @ d18fa62
... ... @@ -3,9 +3,12 @@
3 3 import com.lyms.platform.common.base.IConvertToNativeQuery;
4 4 import com.lyms.platform.common.dao.BaseQuery;
5 5 import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
6 7 import com.lyms.platform.common.dao.operator.MongoQuery;
7 8 import org.springframework.data.mongodb.core.query.Criteria;
8 9  
  10 +import java.util.Date;
  11 +
9 12 /**
10 13 * @auther HuJiaqi
11 14 * @createTime 2016年12月06日 13时48分
... ... @@ -20,6 +23,45 @@
20 23 */
21 24 private String patientId;
22 25  
  26 + private String pid;
  27 +
  28 + private Date start;
  29 + private Date end;
  30 +
  31 + private int yn=-1;
  32 +
  33 + public Date getStart() {
  34 + return start;
  35 + }
  36 +
  37 + public void setStart(Date start) {
  38 + this.start = start;
  39 + }
  40 +
  41 + public Date getEnd() {
  42 + return end;
  43 + }
  44 +
  45 + public void setEnd(Date end) {
  46 + this.end = end;
  47 + }
  48 +
  49 + public String getPid() {
  50 + return pid;
  51 + }
  52 +
  53 + public void setPid(String pid) {
  54 + this.pid = pid;
  55 + }
  56 +
  57 + public int getYn() {
  58 + return yn;
  59 + }
  60 +
  61 + public void setYn(int yn) {
  62 + this.yn = yn;
  63 + }
  64 +
23 65 public String getPatientId() {
24 66 return patientId;
25 67 }
... ... @@ -30,9 +72,47 @@
30 72  
31 73 @Override
32 74 public MongoQuery convertToQuery() {
33   - Criteria criteria = new Criteria();
34   - criteria.and("patientId").is(patientId);
35   - return new MongoCondition(criteria).toMongoQuery();
  75 + MongoCondition condition = new MongoCondition();
  76 + if (patientId != null) {
  77 + condition = condition.and("patientId", patientId, MongoOper.IS);
  78 + }
  79 + if (yn != -1) {
  80 + condition = condition.and("yn", yn, MongoOper.IS);
  81 + }
  82 +
  83 + if(pid!= null){
  84 + condition = condition.and("pid", pid, MongoOper.IS);
  85 + }
  86 +
  87 + boolean isBirthStart = false;
  88 + Criteria c1 = condition.getCriteria();
  89 + if (null != start) {
  90 + isBirthStart = true;
  91 + if (null != c1) {
  92 + c1 = c1.and("leaveHospitalDate").gte(start);
  93 + } else {
  94 + c1 = Criteria.where("leaveHospitalDate").gte(start);
  95 + }
  96 + }
  97 +
  98 + if (null != end) {
  99 + if (null != c1) {
  100 + if (isBirthStart)
  101 + {
  102 + c1 = c1.lte(end);
  103 + }
  104 + else
  105 + {
  106 + c1 = c1.and("leaveHospitalDate").lte(end);
  107 + }
  108 + } else {
  109 + c1 = Criteria.where("leaveHospitalDate").lte(end);
  110 + }
  111 + }
  112 + if (null != c1) {
  113 + condition = condition.andCondition(new MongoCondition(c1));
  114 + }
  115 + return condition.toMongoQuery();
36 116 }
37 117 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DischargeAbstractController.java View file @ d18fa62
... ... @@ -101,5 +101,10 @@
101 101 public BaseResponse delDisCharge(@RequestParam("id")String id){
102 102 return dischargeAbstractFacade.delDisCharge(id);
103 103 }
  104 +
  105 + @RequestMapping(value = "correct", method = RequestMethod.GET)
  106 + public BaseResponse correctDisCharge(){
  107 + return dischargeAbstractFacade.correctDisCharge();
  108 + }
104 109 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ d18fa62
... ... @@ -74,8 +74,10 @@
74 74  
75 75 @Autowired
76 76 private CouponService couponService;
77   -@Autowired
  77 + @Autowired
78 78 private SieveService sieveService;
  79 + @Autowired
  80 + private DischargeAbstractMotherService dischargeAbstractMotherService;
79 81 /**
80 82 * 处理区域隐藏建档
81 83 *
... ... @@ -925,7 +927,6 @@
925 927 List listData = new ArrayList();
926 928 Organization organization = null;
927 929 PatientsQuery patientsQuery1 = new PatientsQuery();
928   -// patientsQuery1.setBookbuildingDateEnd(end);
929 930 patientsQuery1.setLastMensesEnd(end);
930 931 patientsQuery1.setBuildType(1);
931 932 //在区域组的时候不用查询隐藏档案
... ... @@ -934,7 +935,6 @@
934 935 }
935 936  
936 937 if (listDate.size() > i + 1) {
937   -// patientsQuery1.setBookbuildingDateStart(new Date(listDate.get(i + 1).getDate().getTime() + 86398000));
938 938 patientsQuery1.setLastMensesStart(new Date(listDate.get(i + 1).getDate().getTime() + 86398000));
939 939 }
940 940 pid = list.get(0).getPid();
... ... @@ -983,6 +983,29 @@
983 983 listData.add(new AntData(stopPregs.get(0), patientses.get(0).getLastMenses(), null != organization ? organization.getName() : ""));
984 984 }
985 985  
  986 +
  987 + DischargeAbstractMotherQuery dischargeAbstractMotherQuery = new DischargeAbstractMotherQuery();
  988 + dischargeAbstractMotherQuery.setPid(pid);
  989 + dischargeAbstractMotherQuery.setYn(YnEnums.YES.getId());
  990 + if (list.size() - 1 > i) {
  991 + dischargeAbstractMotherQuery.setStart(dueDate);
  992 + if (CollectionUtils.isNotEmpty(listDate)) {
  993 + //下次建档记录前都是产后复查,如果没有下个产程的数据就直接显示
  994 + if (listDate.size() > 1 && i > 1) {
  995 + dischargeAbstractMotherQuery.setEnd(listDate.get(i - 1).getDate());
  996 + }
  997 + }
  998 + }
  999 +
  1000 + List<DischargeAbstractMotherModel> dischargeAbstractMotherModels=dischargeAbstractMotherService.query(dischargeAbstractMotherQuery);
  1001 +
  1002 + if(CollectionUtils.isNotEmpty(dischargeAbstractMotherModels)){
  1003 + for(DischargeAbstractMotherModel model:dischargeAbstractMotherModels){
  1004 + listData.add(new AntData(model, null != organization ? organization.getName() : "",dueDate));
  1005 + }
  1006 + }
  1007 +
  1008 +
986 1009 //产后复查记录
987 1010 List<PostReviewModel> reviewModels = postReviewService.findWithList(postReviewQuery);
988 1011 if (CollectionUtils.isNotEmpty(reviewModels)) {
... ... @@ -1008,7 +1031,6 @@
1008 1031 PatientsQuery patientsQuery1 = new PatientsQuery();
1009 1032 patientsQuery1.setYn(YnEnums.YES.getId());
1010 1033 patientsQuery1.setPid(pid);
1011   -// patientsQuery1.setBookbuildingDateStart(new Date(listDate.get(0).getDate().getTime()));
1012 1034 patientsQuery1.setLastMensesStart(new Date(listDate.get(0).getDate().getTime()));
1013 1035 patientsQuery1.setType(1);
1014 1036 patientsQuery1.setBuildType(1);
... ... @@ -1159,6 +1181,28 @@
1159 1181 listData.add(new AntData((MaternalDeliverModel) obj, patientses.get(0).getLastMenses(), null != organization ? organization.getName() : ""));
1160 1182 }
1161 1183 }
  1184 +
  1185 + DischargeAbstractMotherQuery dischargeAbstractMotherQuery = new DischargeAbstractMotherQuery();
  1186 + dischargeAbstractMotherQuery.setPid(pid);
  1187 + dischargeAbstractMotherQuery.setYn(YnEnums.YES.getId());
  1188 + if (list.size() - 1 > i) {
  1189 + dischargeAbstractMotherQuery.setStart(dueDate);
  1190 + if (CollectionUtils.isNotEmpty(listDate)) {
  1191 + //下次建档记录前都是产后复查,如果没有下个产程的数据就直接显示
  1192 + if (listDate.size() > 1 && i > 1) {
  1193 + dischargeAbstractMotherQuery.setEnd(listDate.get(i - 1).getDate());
  1194 + }
  1195 + }
  1196 + }
  1197 +
  1198 + List<DischargeAbstractMotherModel> dischargeAbstractMotherModels=dischargeAbstractMotherService.query(dischargeAbstractMotherQuery);
  1199 +
  1200 + if(CollectionUtils.isNotEmpty(dischargeAbstractMotherModels)){
  1201 + for(DischargeAbstractMotherModel model:dischargeAbstractMotherModels){
  1202 + listData.add(new AntData(model, null != organization ? organization.getName() : "",dueDate));
  1203 + }
  1204 + }
  1205 +
1162 1206 //终止妊娠的情况
1163 1207 if(null!=patients.getDueStatus()&&1==patients.getDueStatus()){
1164 1208 StopPregQuery stopPregQuery=new StopPregQuery();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DischargeAbstractFacade.java View file @ d18fa62
... ... @@ -308,5 +308,23 @@
308 308 dischargeAbstractMotherService.update(dischargeAbstractMotherQueryModel);
309 309 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
310 310 }
  311 +
  312 +
  313 + public BaseResponse correctDisCharge(){
  314 + DischargeAbstractMotherQuery dischargeAbstractMotherQuery = new DischargeAbstractMotherQuery();
  315 + dischargeAbstractMotherQuery.setYn(YnEnums.YES.getId());
  316 + List<DischargeAbstractMotherModel> models = dischargeAbstractMotherService.query(dischargeAbstractMotherQuery);
  317 + if(CollectionUtils.isNotEmpty(models)){
  318 + for(DischargeAbstractMotherModel mode:models){
  319 + Patients patients = patientsService.findOnePatientById(mode.getPatientId());
  320 + if(null!=patients){
  321 + mode.setHospitalId(patients.getHospitalId());
  322 + mode.setpId(patients.getPid());
  323 + dischargeAbstractMotherService.update(mode);
  324 + }
  325 + }
  326 + }
  327 + return new BaseResponse().setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setErrorcode(ErrorCodeConstants.SUCCESS);
  328 + }
311 329 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntData.java View file @ d18fa62
... ... @@ -144,6 +144,18 @@
144 144 this.checkTime=DateUtil.getyyyy_MM_dd(postReviewModel.getCheckTime());
145 145 this.created=postReviewModel.getCheckTime();
146 146 this.title="产后复查";
  147 + this.type="6";
  148 + this.hospitalName=hospitalName;
  149 + this.hospitalId=postReviewModel.getHospitalId();
  150 + }
  151 + public AntData(DischargeAbstractMotherModel postReviewModel,String hospitalName,Date dueDate) {
  152 + this.id=postReviewModel.getId();
  153 + int days = DateUtil.daysBetween(dueDate,postReviewModel.getLeaveHospitalDate());
  154 + this.dueWeek= "产后"+days+"天";
  155 + this.dueDate=DateUtil.getyyyy_MM_dd(dueDate);
  156 + this.checkTime=DateUtil.getyyyy_MM_dd(postReviewModel.getLeaveHospitalDate());
  157 + this.created=postReviewModel.getLeaveHospitalDate();
  158 + this.title="出院小结";
147 159 this.type="5";
148 160 this.hospitalName=hospitalName;
149 161 this.hospitalId=postReviewModel.getHospitalId();
... ... @@ -156,7 +168,7 @@
156 168 this.checkTime=DateUtil.getyyyy_MM_dd(postReviewModel.getStopDate());
157 169 this.created=postReviewModel.getStopDate();
158 170 this.title="终止妊娠";
159   - this.type="6";
  171 + this.type="7";
160 172 this.hospitalName=hospitalName;
161 173 this.hospitalId=postReviewModel.getHospitalId();
162 174 }