Commit 15e23f25eac0b253f179209285ea9e383a17e540

Authored by jiangjiazhi
1 parent 7383acd94e

孕妇分娩后 变成产妇

Showing 5 changed files with 88 additions and 59 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java View file @ 15e23f2
... ... @@ -38,11 +38,12 @@
38 38 @RequestMapping(method = RequestMethod.GET, value = "/antexmanage")
39 39 @ResponseBody
40 40 @TokenRequired
41   - public BaseResponse queryAntenatalExamination(@Valid AntenatalExaminationQueryRequest antenatalExaminationQueryRequest) {
  41 + public BaseResponse queryAntenatalExamination(@Valid AntenatalExaminationQueryRequest antenatalExaminationQueryRequest,HttpServletRequest request) {
42 42 if (StringUtils.isEmpty(antenatalExaminationQueryRequest.getCardNo()) && StringUtils.isEmpty(antenatalExaminationQueryRequest.getVcCardNo())) {
43 43 return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("请输入查询条件");
44 44 }
45   - return antenatalExaminationFacade.queryAntenatalExamination(antenatalExaminationQueryRequest);
  45 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  46 + return antenatalExaminationFacade.queryAntenatalExamination(antenatalExaminationQueryRequest,loginState.getId());
46 47 }
47 48  
48 49 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java View file @ 15e23f2
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3  
  4 +import javax.servlet.http.HttpServletRequest;
4 5 import javax.validation.Valid;
5 6  
  7 +import com.lyms.platform.common.annotation.TokenRequired;
  8 +import com.lyms.platform.common.base.LoginContext;
6 9 import com.lyms.platform.common.utils.StringUtils;
7 10 import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade;
8 11 import com.lyms.platform.operate.web.request.AntenatalExaminationQueryRequest;
9 12  
... ... @@ -119,10 +122,12 @@
119 122 */
120 123 @RequestMapping(value = "/queryThisBabyPatient/{id}", method = RequestMethod.GET)
121 124 @ResponseBody
122   - public BaseResponse queryThisBabyPatient(@PathVariable("id")String id){
  125 + @TokenRequired
  126 + public BaseResponse queryThisBabyPatient(@PathVariable("id")String id,HttpServletRequest request){
123 127 AntenatalExaminationQueryRequest antenatalExaminationQueryRequest = new AntenatalExaminationQueryRequest();
124 128 antenatalExaminationQueryRequest.setPatientId(id);
125   - return antenatalExaminationFacade.queryAntenatalExamination(antenatalExaminationQueryRequest);
  129 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  130 + return antenatalExaminationFacade.queryAntenatalExamination(antenatalExaminationQueryRequest,loginState.getId());
126 131 }
127 132  
128 133  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java View file @ 15e23f2
... ... @@ -37,8 +37,9 @@
37 37 @RequestMapping(value = "/matmanger",method = RequestMethod.GET)
38 38 @ResponseBody
39 39 @TokenRequired
40   - public BaseResponse queryMatDeliver(@Valid MatDeliverQueryRequest deliverQueryRequest) {
41   - return matDeliverFacade.queryMatDeliver(deliverQueryRequest);
  40 + public BaseResponse queryMatDeliver(@Valid MatDeliverQueryRequest deliverQueryRequest,HttpServletRequest request) {
  41 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  42 + return matDeliverFacade.queryMatDeliver(deliverQueryRequest,loginState.getId());
42 43 }
43 44  
44 45 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 15e23f2
... ... @@ -10,7 +10,10 @@
10 10 import com.lyms.platform.common.utils.JsonUtil;
11 11 import com.lyms.platform.common.utils.SystemConfig;
12 12 import com.lyms.platform.operate.web.request.*;
13   -import com.lyms.platform.operate.web.result.*;
  13 +import com.lyms.platform.operate.web.result.AntData;
  14 +import com.lyms.platform.operate.web.result.AntenatalExaminationResult;
  15 +import com.lyms.platform.operate.web.result.AntexChuResult;
  16 +import com.lyms.platform.operate.web.result.AntexListResult;
14 17 import com.lyms.platform.permission.model.Organization;
15 18 import com.lyms.platform.permission.service.OrganizationService;
16 19 import com.lyms.platform.pojo.*;
17 20  
... ... @@ -71,12 +74,12 @@
71 74 if (CollectionUtils.isNotEmpty(list1)) {
72 75 model.setHospitalId(list1.get(0) + "");
73 76 }
74   - AntExQuery antExQuery=new AntExQuery();
  77 + AntExQuery antExQuery = new AntExQuery();
75 78 antExQuery.setYn(YnEnums.YES.getId());
76 79 antExQuery.setParentId(antExAddRequest.getParentId());
77 80 antExQuery.setStart(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())));
78 81 List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
79   - if(CollectionUtils.isNotEmpty(list)){
  82 + if (CollectionUtils.isNotEmpty(list)) {
80 83 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("同一天只能建一次复诊");
81 84 }
82 85 antenatalExaminationService.addOneBabyAnt(model);
83 86  
84 87  
85 88  
... ... @@ -116,20 +119,20 @@
116 119 List list1 = autoMatchFacade.matchOrgId(userId);
117 120 if (CollectionUtils.isNotEmpty(list1)) {
118 121 antExChuModel.setHospitalId(list1.get(0) + "");
119   - AntExChuQuery antExChuQuery=new AntExChuQuery();
  122 + AntExChuQuery antExChuQuery = new AntExChuQuery();
120 123 antExChuQuery.setYn(YnEnums.YES.getId());
121 124 antExChuQuery.setHospitalId(list1.get(0) + "");
122 125  
123 126 Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
124   - PatientsQuery patientsQuery=new PatientsQuery();
  127 + PatientsQuery patientsQuery = new PatientsQuery();
125 128 patientsQuery.setPid(patients.getPid());
126 129 patientsQuery.setYn(YnEnums.YES.getId());
127 130  
128   - List<Patients> list = patientsService.queryPatient(patientsQuery);
  131 + List<Patients> list = patientsService.queryPatient(patientsQuery);
129 132 antExChuQuery.setStart(list.get(0).getCreated());
130 133 antExChuQuery.setParentId(excAddRequest.getParentId());
131   - List<AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery);
132   - if(CollectionUtils.isNotEmpty(data)){
  134 + List<AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery);
  135 + if (CollectionUtils.isNotEmpty(data)) {
133 136 return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("您本次妊娠中已在本医院建档");
134 137 }
135 138 }
... ... @@ -141,7 +144,7 @@
141 144  
142 145 /**
143 146 * 获取最后一次高危产检的高危信息
144   - *
  147 + * <p>
145 148 * 先取复诊最后一条,在取初诊
146 149 *
147 150 * @return
... ... @@ -153,7 +156,7 @@
153 156 model = list.get(0);
154 157 }
155 158 try {
156   - if(null!=model&&StringUtils.isNotEmpty(model.getRiskFactor())){
  159 + if (null != model && StringUtils.isNotEmpty(model.getRiskFactor())) {
157 160 List list1 = JsonUtil.toList(model.getRiskFactor(), List.class);
158 161 return queryRisk(list1);
159 162 }
... ... @@ -168,7 +171,7 @@
168 171 antExChuModel = list1.get(0);
169 172 }
170 173 try {
171   - if(null!=antExChuModel &&StringUtils.isNotEmpty(antExChuModel.getHighrisk())){
  174 + if (null != antExChuModel && StringUtils.isNotEmpty(antExChuModel.getHighrisk())) {
172 175 List list2 = JsonUtil.toList(antExChuModel.getHighrisk(), List.class);
173 176 return queryRisk(list2);
174 177 }
175 178  
176 179  
... ... @@ -196,15 +199,15 @@
196 199 if (CollectionUtils.isNotEmpty(list)) {
197 200 antexListResult.convertToResult(null, list.get(0), null);
198 201 for (Patients patients : list) {
199   - List<StopPregModel> stopPregs =null;
  202 + List<StopPregModel> stopPregs = null;
200 203 List<AntData> data = new ArrayList<>();
201 204 MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
202 205 matDeliverQuery.setYn(YnEnums.YES.getId());
203 206 matDeliverQuery.setParentId(patients.getId());
204   - Organization organization=null;
  207 + Organization organization = null;
205 208 //建档记录
206   - if(null!=patients.getHospitalId()){
207   - organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId()));
  209 + if (null != patients.getHospitalId()) {
  210 + organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId()));
208 211 }
209 212 data.add(new AntData(patients, null != organization ? organization.getName() : ""));
210 213 //分娩记录
211 214  
212 215  
213 216  
... ... @@ -213,17 +216,18 @@
213 216 if (CollectionUtils.isNotEmpty(modelList)) {
214 217 MaternalDeliverModel model = modelList.get(0);
215 218 dueDate = model.getDueDate();
216   - }else {
  219 + } else {
217 220 //终止妊娠
218   - StopPregQuery query = new StopPregQuery();
  221 + StopPregQuery query = new StopPregQuery();
219 222 query.setYn(YnEnums.YES.getId());
220 223 query.setPid(patients.getPid());
221   - stopPregs = stopPregnancyService.queryStopPreg(query);
222   - if(CollectionUtils.isNotEmpty(stopPregs)){
223   - dueDate=DateUtil.getyyyy_MM_dd(stopPregs.get(0).getStopDate());
  224 + stopPregs = stopPregnancyService.queryStopPreg(query);
  225 + if (CollectionUtils.isNotEmpty(stopPregs)) {
  226 + dueDate = DateUtil.getyyyy_MM_dd(stopPregs.get(0).getStopDate());
224 227 }
225 228 }
226   - PostReviewQuery postReviewQuery = new PostReviewQuery();;
  229 + PostReviewQuery postReviewQuery = new PostReviewQuery();
  230 + ;
227 231 if (StringUtils.isNotEmpty(dueDate)) {
228 232 Date date = DateUtil.parseYMD(dueDate);
229 233 //初诊记录
... ... @@ -235,7 +239,7 @@
235 239 List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
236 240 if (CollectionUtils.isNotEmpty(antExChuModels)) {
237 241 for (AntExChuModel an : antExChuModels) {
238   - if(null!=an.getHospitalId()) {
  242 + if (null != an.getHospitalId()) {
239 243 organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
240 244 }
241 245 data.add(new AntData(an, null != organization ? organization.getName() : ""));
... ... @@ -250,7 +254,7 @@
250 254 List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
251 255 if (CollectionUtils.isNotEmpty(list1)) {
252 256 for (AntenatalExaminationModel an : list1) {
253   - if(null!=an.getHospitalId()) {
  257 + if (null != an.getHospitalId()) {
254 258 organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
255 259 }
256 260 data.add(new AntData(an, null != organization ? organization.getName() : ""));
... ... @@ -272,7 +276,7 @@
272 276 if (CollectionUtils.isNotEmpty(modelList)) {
273 277 organization = organizationService.getOrganization(Integer.valueOf(modelList.get(0).getHospitalId()));
274 278 data.add(new AntData(modelList.get(0), patients.getLastMenses(), null != organization ? organization.getName() : ""));
275   - }else if(CollectionUtils.isNotEmpty(stopPregs)){
  279 + } else if (CollectionUtils.isNotEmpty(stopPregs)) {
276 280 //终止妊娠记录
277 281 organization = organizationService.getOrganization(Integer.valueOf(modelList.get(0).getHospitalId()));
278 282 data.add(new AntData(stopPregs.get(0), patients.getLastMenses(), null != organization ? organization.getName() : ""));
... ... @@ -281,7 +285,7 @@
281 285 List<PostReviewModel> reviewModels = postReviewService.findWithList(postReviewQuery);
282 286 if (CollectionUtils.isNotEmpty(reviewModels)) {
283 287 for (PostReviewModel postReviewModel : reviewModels) {
284   - if(null!=postReviewModel.getHospitalId()) {
  288 + if (null != postReviewModel.getHospitalId()) {
285 289 organization = organizationService.getOrganization(Integer.valueOf(postReviewModel.getHospitalId()));
286 290 }
287 291 data.add(new AntData(postReviewModel, null != organization ? organization.getName() : ""));
... ... @@ -325,7 +329,7 @@
325 329 * @param vcCardNo
326 330 * @return
327 331 */
328   - public Patients findOnePatient(String cardNo, String vcCardNo, String id) {
  332 + public Patients findOnePatient(String cardNo, String vcCardNo, String id, String hospitalId) {
329 333 PatientsQuery patientsQuery = new PatientsQuery();
330 334 if (StringUtils.isNotEmpty(cardNo)) {
331 335 patientsQuery.setCardNo(cardNo);
332 336  
333 337  
334 338  
335 339  
336 340  
337 341  
338 342  
339 343  
... ... @@ -334,41 +338,47 @@
334 338 } else if (StringUtils.isNotEmpty(id)) {
335 339 patientsQuery.setId(id);
336 340 }
337   -
  341 + patientsQuery.setHospitalId(hospitalId);
338 342 patientsQuery.setYn(YnEnums.YES.getId());
339 343 Patients patients = null;
340 344 List<Patients> list = patientsService.queryPatient(patientsQuery);
341 345 if (CollectionUtils.isNotEmpty(list)) {
342   - patients = list.get(0);
  346 + return list.get(0);
343 347 }
  348 + patientsQuery.setHospitalId(null);
  349 + list = patientsService.queryPatient(patientsQuery);
  350 + if (CollectionUtils.isNotEmpty(list)) {
  351 + return list.get(0);
  352 + }
344 353 return patients;
345 354 }
346 355  
347 356 /**
348 357 * 查看是否满足产筛申请条件
349   - *
  358 + * <p>
350 359 * 1.孕周 15周-到20 周 并且没有做过产筛
  360 + *
351 361 * @param date
352 362 * @param parentId
353 363 * @return
354 364 */
355   - public String cap(Date date,String parentId){
356   - if(null==date){
  365 + public String cap(Date date, String parentId) {
  366 + if (null == date) {
357 367 return "0";
358 368 }
359   - int day= DateUtil.getDays(date,new Date());
360   - int start = 15*7;
361   - int end = 20*7+6;
362   - if(day>=start&&day<=end){
363   - SieveApplyOrderQuery sieveApplyOrderQuery=new SieveApplyOrderQuery();
  369 + int day = DateUtil.getDays(date, new Date());
  370 + int start = 15 * 7;
  371 + int end = 20 * 7 + 6;
  372 + if (day >= start && day <= end) {
  373 + SieveApplyOrderQuery sieveApplyOrderQuery = new SieveApplyOrderQuery();
364 374 sieveApplyOrderQuery.setYn(YnEnums.YES.getId());
365 375 sieveApplyOrderQuery.setParentId(parentId);
366 376 List<SieveApplyOrderModel> list = applyOrderService.querySieveApplyOrderWithQuery(sieveApplyOrderQuery);
367   - if(CollectionUtils.isEmpty(list)){
  377 + if (CollectionUtils.isEmpty(list)) {
368 378 return "1";
369 379 }
370 380 }
371   - return "0";
  381 + return "0";
372 382 }
373 383  
374 384 /**
... ... @@ -377,7 +387,7 @@
377 387 * @param queryRequest
378 388 * @return
379 389 */
380   - public BaseResponse queryAntenatalExamination(AntenatalExaminationQueryRequest queryRequest) {
  390 + public BaseResponse queryAntenatalExamination(AntenatalExaminationQueryRequest queryRequest,Integer userId) {
381 391  
382 392 Patients patients = null;
383 393 if (!StringUtils.isEmpty(queryRequest.getPatientId())) {
384 394  
... ... @@ -390,8 +400,13 @@
390 400 patients = list.get(0);
391 401 }
392 402 } else {
  403 + List<Integer> list1 =autoMatchFacade.matchOrgId(userId);
  404 + String hospital =null;
  405 + if(CollectionUtils.isNotEmpty(list1)){
  406 + hospital= list1.get(0) + "";
  407 + }
393 408 //查询产妇数据
394   - patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null);
  409 + patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(),null, hospital);
395 410 }
396 411  
397 412 if (null == patients) {
... ... @@ -417,7 +432,7 @@
417 432 }
418 433  
419 434 antexListResult.convertToResult(list, patients, antExChulist);
420   - antexListResult.setIsSieve(cap(patients.getLastMenses(),patients.getId()));
  435 + antexListResult.setIsSieve(cap(patients.getLastMenses(), patients.getId()));
421 436 antexListResult.setRiskFactor(data);
422 437 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(antexListResult);
423 438 }
424 439  
... ... @@ -449,14 +464,14 @@
449 464 AntenatalExaminationResult antenatalExaminationResult = new AntenatalExaminationResult();
450 465 antenatalExaminationResult.convertToResult(examinationModel);
451 466 try {
452   - if(StringUtils.isNotEmpty(examinationModel.getRiskFactor())){
  467 + if (StringUtils.isNotEmpty(examinationModel.getRiskFactor())) {
453 468 List list1 = JsonUtil.toList(examinationModel.getRiskFactor(), List.class);
454 469 antenatalExaminationResult.setRiskFactor(queryRisk(list1));
455 470 }
456 471 } catch (Exception e) {
457 472 }
458 473 try {
459   - if(StringUtils.isNotEmpty(examinationModel.getDiagnosis())) {
  474 + if (StringUtils.isNotEmpty(examinationModel.getDiagnosis())) {
460 475 List list = JsonUtil.toList(examinationModel.getDiagnosis(), List.class);
461 476 antenatalExaminationResult.setDiagnosis(queryRisk(list));
462 477 }
... ... @@ -469,9 +484,9 @@
469 484 applyOrderQuery.setParentId(examinationModel.getParentId());
470 485 applyOrderQuery.setYn(YnEnums.YES.getId());
471 486 Patients patients = patientsService.findOnePatientById(examinationModel.getParentId());
472   - Date data = null;
473   - if(null!=data){
474   - data=patients.getLastMenses();
  487 + Date data = null;
  488 + if (null != data) {
  489 + data = patients.getLastMenses();
475 490 }
476 491 antenatalExaminationResult.setIsSieve(cap(data, examinationModel.getParentId()));
477 492 antenatalExaminationResult.setHasSieve(CollectionUtils.isEmpty(applyOrderService.querySieveApplyOrderWithQuery(applyOrderQuery)) ? 0 : 1);
478 493  
479 494  
... ... @@ -487,17 +502,17 @@
487 502 if (CollectionUtils.isNotEmpty(antExChuModels)) {
488 503 antExChuModel = antExChuModels.get(0);
489 504 }
490   - if(null!=antExChuModel){
  505 + if (null != antExChuModel) {
491 506 antexChuResult.convertToResult(antExChuModel);
492 507 try {
493   - if(StringUtils.isNotEmpty(antExChuModel.getDiagnosis())){
  508 + if (StringUtils.isNotEmpty(antExChuModel.getDiagnosis())) {
494 509 List list = JsonUtil.toList(antExChuModel.getDiagnosis(), List.class);
495 510 antexChuResult.setDiagnosis(queryRisk(list));
496 511 }
497 512 } catch (Exception e) {
498 513 }
499 514 try {
500   - if(StringUtils.isNotEmpty(antExChuModel.getHighrisk())) {
  515 + if (StringUtils.isNotEmpty(antExChuModel.getHighrisk())) {
501 516 List list1 = JsonUtil.toList(antExChuModel.getHighrisk(), List.class);
502 517 antexChuResult.setHighrisk(queryRisk(list1));
503 518 }
... ... @@ -510,7 +525,7 @@
510 525 applyOrderQuery.setParentId(antExChuModel.getParentId());
511 526 applyOrderQuery.setYn(YnEnums.YES.getId());
512 527 antexChuResult.setHasSieve(CollectionUtils.isEmpty(applyOrderService.querySieveApplyOrderWithQuery(applyOrderQuery)) ? 0 : 1);
513   - antexChuResult.setIsSieve(cap(antExChuModel.getLastMenses(),antExChuModel.getParentId()));
  528 + antexChuResult.setIsSieve(cap(antExChuModel.getLastMenses(), antExChuModel.getParentId()));
514 529 object = antexChuResult;
515 530 }
516 531 }
517 532  
... ... @@ -554,9 +569,10 @@
554 569 map.put("fxys", basicConfigFacade.getBaseicConfigByParentId(SystemConfig.FXYS));
555 570 map.put("gwfz", basicConfigFacade.getBaseicConfigByParentId(SystemConfig.GWFZ));
556 571 map.put("organizations", convert());
557   - map.put("cTime",DateUtil.getyyyy_MM_dd(new Date()));
  572 + map.put("cTime", DateUtil.getyyyy_MM_dd(new Date()));
558 573 return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
559 574 }
  575 +
560 576 //胎数
561 577 public List getTaiShu() {
562 578 List<Object> list = new ArrayList<>();
... ... @@ -568,6 +584,7 @@
568 584 }
569 585 return list;
570 586 }
  587 +
571 588 public List convert() {
572 589 List<Organization> organization = organizationService.queryHospital();
573 590 List data = new ArrayList();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ 15e23f2
... ... @@ -229,9 +229,14 @@
229 229 * @param deliverQueryRequest
230 230 * @return
231 231 */
232   - public BaseResponse queryMatDeliver(MatDeliverQueryRequest deliverQueryRequest) {
  232 + public BaseResponse queryMatDeliver(MatDeliverQueryRequest deliverQueryRequest,Integer userId) {
  233 + List<Integer> list1 =autoMatchFacade.matchOrgId(userId);
  234 + String hospital =null;
  235 + if(CollectionUtils.isNotEmpty(list1)){
  236 + hospital= list1.get(0) + "";
  237 + }
233 238 //获取
234   - Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null);
  239 + Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null,hospital);
235 240 if (null == patients) {
236 241 return new BaseResponse().setErrormsg("没有相关的产妇记录").setErrorcode(ErrorCodeConstants.BUSINESS_ERROR);
237 242 }