Commit 5151655ace2dff643333d885f35b39bebd21bf57

Authored by jiangjiazhi
1 parent 2950f69102

增加设置parentid

Showing 3 changed files with 61 additions and 17 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 5151655
... ... @@ -507,11 +507,12 @@
507 507 /**
508 508 * 根据身份证号或者就诊卡号查询产妇
509 509 *
510   - * @param cardNo
511   - * @param vcCardNo
512   - * @return
  510 + * @param cardNo 身份证号
  511 + * @param vcCardNo 就诊卡号
  512 + * @param type 类型 1 孕妇 3 产妇 -1 不区分
  513 + * @param outHospital 是否需要查外院
513 514 */
514   - public Patients findOnePatient(String cardNo, String vcCardNo, String id, String hospitalId, Integer type) {
  515 + public Patients findOnePatient(String cardNo, String vcCardNo, String id, String hospitalId, Integer type, boolean outHospital) {
515 516 PatientsQuery patientsQuery = new PatientsQuery();
516 517 if (StringUtils.isNotEmpty(cardNo)) {
517 518 patientsQuery.setCardNo(cardNo);
... ... @@ -528,10 +529,12 @@
528 529 if (CollectionUtils.isNotEmpty(list)) {
529 530 return list.get(0);
530 531 }
531   - patientsQuery.setHospitalId(null);
532   - list = patientsService.queryPatient(patientsQuery);
533   - if (CollectionUtils.isNotEmpty(list)) {
534   - return list.get(0);
  532 + if (outHospital) {
  533 + patientsQuery.setHospitalId(null);
  534 + list = patientsService.queryPatient(patientsQuery);
  535 + if (CollectionUtils.isNotEmpty(list)) {
  536 + return list.get(0);
  537 + }
535 538 }
536 539 return patients;
537 540 }
... ... @@ -589,7 +592,7 @@
589 592 hospital = list1.get(0) + "";
590 593 }
591 594 //查询产妇数据
592   - patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospital, 1);
  595 + patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospital, 1, false);
593 596 }
594 597  
595 598 if (null == patients) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ 5151655
... ... @@ -282,15 +282,15 @@
282 282 return new BaseResponse().setErrormsg("没有相关的产妇记录").setErrorcode(ErrorCodeConstants.BUSINESS_ERROR);
283 283 }*/
284 284 //外院的孕妇
285   - Patients patients1 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, null, 1);
  285 + Patients patients1 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, null, 1,false);
286 286 //外院的产妇
287 287 // Patients patients2 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, null, 3);
288 288  
289 289 //http://jira.healthbaby.com.cn/browse/WEB-204 修改bug
290 290 //本院的孕妇
291   - Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, 1);
  291 + Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, 1,false);
292 292 //本院产妇
293   - Patients patients3 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, 3);
  293 + Patients patients3 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, 3,false);
294 294 //本院产妇,并且本院没建档需要提醒补录记录
295 295 if(null!=patients3 && null==patients){
296 296 patients=patients3;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostReviewFacade.java View file @ 5151655
... ... @@ -53,17 +53,37 @@
53 53 @Autowired
54 54 private OrganizationService organizationService;
55 55  
  56 + /**
  57 + *
  58 + * 增加产后复查记录
  59 + *
  60 + * 3、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),但该孕妇在本院未建档,点击查询进入新增复查界面;在保存产后复查时要自动给该产妇建档(建档的基本信息为该产妇在系统中最新的建档信息)
  61 +
  62 + 4、当通过产后复查给产妇建档时,如果查询到该产妇在本院有patient数据并且该patient的buildType=1,则要把该patient的buildType更新为0(防止儿童建档时产生了产妇建档数据,在添加产后复查时重复给该产妇建档)
  63 +
  64 + * @param postReviewRequest
  65 + * @param userId
  66 + * @return
  67 + */
56 68 public BaseResponse addPostReview(PostReviewRequest postReviewRequest,Integer userId) {
  69 + //获取数据
  70 + Patients patients1 = patientsService.findOnePatientById(postReviewRequest.getParentId());
  71 + String hospital= autoMatchFacade.getHospitalId(userId);
  72 + //判断是否是同一个医院
  73 + if(!patients1.getHospitalId().equals(hospital)){
  74 + patients1.setId(null);
  75 + patients1.setHospitalId(hospital);
  76 + patients1.setBuildType(0);
  77 + patientsService.addPatient(patients1);
  78 + }
57 79 if (StringUtils.isEmpty(postReviewRequest.getId())) {
58 80 PostReviewModel postReviewModel = postReviewRequest.convertToDataModel();
59 81 postReviewModel.setYn(YnEnums.YES.getId());
60   - List list1 = autoMatchFacade.matchOrgId(userId);
61   - if(CollectionUtils.isNotEmpty(list1)){
62   - postReviewModel.setHospitalId(list1.get(0)+"");
63   - }
  82 + postReviewModel.setHospitalId(hospital);
64 83 Patients patients = patientsService.findOnePatientById(postReviewRequest.getParentId());
65 84 if(StringUtils.isNotEmpty(postReviewRequest.getDueDate())){
66 85 patients.setFmDate(DateUtil.parseYMD(postReviewRequest.getDueDate()));
  86 + patients.setBuildType(0);
67 87 patientsService.updatePatient(patients);
68 88 }
69 89 postReviewModel.setPid(patients.getPid());
70 90  
71 91  
... ... @@ -79,11 +99,32 @@
79 99 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
80 100 }
81 101  
  102 + /**
  103 + *
  104 + * 1、当前孕妇在系统中的本次妊娠期处于未分娩/已终止妊娠或在结束上次妊娠期后再次新增了建档,不管该孕妇在本院是否建档,点击查询时提示当前用户未分娩,不能进行复查
  105 +
  106 + 2、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),并且该孕妇在本院已建档,点击查询进入新增复查界面
  107 +
  108 + 3、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),但该孕妇在本院未建档,点击查询进入新增复查界面;在保存产后复查时要自动给该产妇建档(建档的基本信息为该产妇在系统中最新的建档信息)
  109 +
  110 + 4、当通过产后复查给产妇建档时,如果查询到该产妇在本院有patient数据并且该patient的buildType=1,则要把该patient的buildType更新为0(防止儿童建档时产生了产妇建档数据,在添加产后复查时重复给该产妇建档)
  111 + *
  112 + * @param postReviewQueryRequest
  113 + * @param userId
  114 + * @return
  115 + */
82 116 public BaseResponse queryPostList(PostReviewQueryRequest postReviewQueryRequest,Integer userId) {
83 117  
  118 + //未分娩建档
  119 + Patients patients = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, null, 1,false);
  120 + if(null!=patients){
  121 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("当前用户未分娩,不能进行复查");
  122 + }
  123 +
  124 +
84 125 String hospitalId = autoMatchFacade.getHospitalId(userId);
85 126 //取所有医院的建档数据 优先取本院 ,然后取外院
86   - Patients patientsList = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, hospitalId, 3);
  127 + Patients patientsList = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, hospitalId, 3,true);
87 128 PostReviewListResult postReviewListResult = new PostReviewListResult();
88 129  
89 130 if (null != patientsList) {