Commit 18a5de30bc5492c43e1f8df6ee3c4706c8d0292c

Authored by zhangrui

Merge remote-tracking branch 'origin/master'

Showing 8 changed files

platform-common/src/main/java/com/lyms/platform/common/constants/ErrorCodeConstants.java View file @ 18a5de3
... ... @@ -43,6 +43,9 @@
43 43 public static final int NAME_EXIST=4100;
44 44  
45 45  
  46 + //数据已存在
  47 + public static final int DATA_EXIST=4200;
  48 +
46 49 //没有数据
47 50 public static final int NO_DATA=4200;
48 51 //不能删除
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java View file @ 18a5de3
... ... @@ -129,6 +129,16 @@
129 129 //是否高危 0非高危 1高危
130 130 private Integer highRisk;
131 131  
  132 + private Integer hospitalId;
  133 +
  134 + public Integer getHospitalId() {
  135 + return hospitalId;
  136 + }
  137 +
  138 + public void setHospitalId(Integer hospitalId) {
  139 + this.hospitalId = hospitalId;
  140 + }
  141 +
132 142 public String getName() {
133 143 return name;
134 144 }
... ... @@ -243,6 +253,12 @@
243 253 if(null!=vcCardNo){
244 254 condition=condition.and("vcCardNo", mcertNo, MongoOper.IS);
245 255 }
  256 +
  257 + if(null!=hospitalId){
  258 + condition=condition.and("hospitalId", hospitalId, MongoOper.IS);
  259 + }
  260 +
  261 +
246 262  
247 263 if(null!=sex){
248 264 condition=condition.and("sex", sex, MongoOper.IS);
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ 18a5de3
... ... @@ -117,6 +117,17 @@
117 117 * 1:孕妇,2:儿童
118 118 */
119 119 private int type = -1;
  120 +
  121 + private Integer hospitalId;
  122 +
  123 + public Integer getHospitalId() {
  124 + return hospitalId;
  125 + }
  126 +
  127 + public void setHospitalId(Integer hospitalId) {
  128 + this.hospitalId = hospitalId;
  129 + }
  130 +
120 131 public Boolean getIsHighRisk() {
121 132 return isHighRisk;
122 133 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java View file @ 18a5de3
... ... @@ -91,7 +91,7 @@
91 91 @ResponseBody
92 92 public BaseObjectResponse queryBabyBuild(@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo){
93 93 BookbuildingQueryRequest param = new BookbuildingQueryRequest();
94   - param.setIdCard(cardNo);
  94 + param.setCardNo(cardNo);
95 95 param.setVcCardNo(vcCardNo);
96 96 return babyBookbuildingFacade.queryBabyBuild(param);
97 97 }
... ... @@ -108,7 +108,7 @@
108 108 @ResponseBody
109 109 public BaseObjectResponse queryBabyBuildRecord(@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo){
110 110 BookbuildingQueryRequest param = new BookbuildingQueryRequest();
111   - param.setIdCard(cardNo);
  111 + param.setCardNo(cardNo);
112 112 param.setVcCardNo(vcCardNo);
113 113 return babyBookbuildingFacade.queryBabyBuildRecord(param);
114 114 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java View file @ 18a5de3
... ... @@ -95,10 +95,10 @@
95 95 */
96 96 @RequestMapping(value = "/queryPregnantBuildRecord", method = RequestMethod.GET)
97 97 @ResponseBody
98   - public BaseListResponse queryPregnantBuildRecord(@RequestParam(required = false) String vcCardNo,@RequestParam(required = false) String idCard){
  98 + public BaseListResponse queryPregnantBuildRecord(@RequestParam(required = false) String vcCardNo,@RequestParam(required = false) String cardNo){
99 99 BookbuildingQueryRequest bookbuildingQueryRequest = new BookbuildingQueryRequest();
100 100 bookbuildingQueryRequest.setVcCardNo(vcCardNo);
101   - bookbuildingQueryRequest.setIdCard(idCard);
  101 + bookbuildingQueryRequest.setCardNo(cardNo);
102 102 BaseListResponse listResponse = bookbuildingFacade.queryPregnantBuildRecord(bookbuildingQueryRequest);
103 103 return listResponse;
104 104 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ 18a5de3
... ... @@ -359,10 +359,10 @@
359 359 public BaseObjectResponse queryBabyBuild(BookbuildingQueryRequest param) {
360 360  
361 361 BabyBuildResult result = new BabyBuildResult();
362   - if (!StringUtils.isEmpty(param.getVcCardNo()) || !StringUtils.isEmpty(param.getIdCard()))
  362 + if (!StringUtils.isEmpty(param.getVcCardNo()) || !StringUtils.isEmpty(param.getCardNo()))
363 363 {
364 364 BabyModelQuery babyQuery = new BabyModelQuery();
365   - babyQuery.setMcertNo(param.getIdCard());
  365 + babyQuery.setMcertNo(param.getCardNo());
366 366 babyQuery.setVcCardNo(param.getVcCardNo());
367 367 babyQuery.setYn(YnEnums.YES.getId());
368 368  
... ... @@ -407,7 +407,7 @@
407 407  
408 408 //服务状态
409 409 List serviceStatus = ServiceStatusEnums.getServiceStatusList();
410   - map.put("serviceStatus",serviceStatus);
  410 + map.put("serviceStatus", serviceStatus);
411 411  
412 412 BaseObjectResponse objectResponse = new BaseObjectResponse();
413 413 objectResponse.setData(map);
414 414  
415 415  
416 416  
... ... @@ -425,14 +425,21 @@
425 425 public BaseObjectResponse queryBabyBuildRecord(BookbuildingQueryRequest param) {
426 426  
427 427 List<BabyInfoResult> results = new ArrayList<>();
428   - if (!StringUtils.isEmpty(param.getVcCardNo()) || !StringUtils.isEmpty(param.getIdCard()))
  428 + BabyModelQuery babyQuery = new BabyModelQuery();
  429 + babyQuery.setYn(YnEnums.YES.getId());
  430 + List<BabyModel> models = null;
  431 + if (!StringUtils.isEmpty(param.getVcCardNo()))
429 432 {
430   - BabyModelQuery babyQuery = new BabyModelQuery();
431   - babyQuery.setMcertNo(param.getIdCard());
  433 + babyQuery.setMcertNo(param.getCardNo());
  434 + models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
  435 + }
  436 + else if (!StringUtils.isEmpty(param.getCardNo()) && !StringUtils.isEmpty(String.valueOf(param.getHospitalId())))
  437 + {
  438 + babyQuery.setHospitalId(param.getHospitalId());
432 439 babyQuery.setVcCardNo(param.getVcCardNo());
433   - babyQuery.setYn(YnEnums.YES.getId());
  440 + models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
  441 + }
434 442  
435   - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
436 443 if (models != null && models.size() > 0)
437 444 {
438 445 Set<String> cardNos = new HashSet<>();
... ... @@ -482,7 +489,7 @@
482 489 results.add(result);
483 490 }
484 491 }
485   - }
  492 +
486 493  
487 494 BaseObjectResponse objectResponse = new BaseObjectResponse();
488 495 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 18a5de3
... ... @@ -16,6 +16,7 @@
16 16 import com.lyms.platform.pojo.BasicConfig;
17 17 import com.lyms.platform.query.BasicConfigQuery;
18 18 import com.lyms.platform.query.PatientsQuery;
  19 +import org.apache.commons.collections.CollectionUtils;
19 20 import org.springframework.beans.factory.annotation.Autowired;
20 21 import org.springframework.stereotype.Component;
21 22  
22 23  
... ... @@ -50,10 +51,26 @@
50 51 */
51 52 public BaseObjectResponse addPregnantBookbuilding(
52 53 YunBookbuildingAddRequest yunRequest) {
  54 +
  55 + BaseObjectResponse br = new BaseObjectResponse();
  56 + PatientsQuery patientsQuery = new PatientsQuery();
  57 + patientsQuery.setYn(YnEnums.YES.getId());
  58 + patientsQuery.setType(1);
  59 + patientsQuery.setHospitalId(yunRequest.getHospitalId());
  60 +
  61 + //判断该身份证号码是否有孕妇建档 在该医院
  62 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  63 + if (CollectionUtils.isNotEmpty(patients))
  64 + {
  65 + br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  66 + br.setErrormsg("孕妇在该医院已建档");
  67 + return br;
  68 + }
  69 +
53 70 Patients patient = getPatientsData(yunRequest);
54 71 patient.setCreated(new Date());
55 72 Patients p = yunBookbuildingService.addPregnantBookbuilding(patient);
56   - BaseObjectResponse br = new BaseObjectResponse();
  73 +
57 74 if (p == null || p.getId() == null)
58 75 {
59 76 br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR);
60 77  
61 78  
62 79  
63 80  
64 81  
... ... @@ -87,18 +104,36 @@
87 104 public BaseListResponse queryPregnantBuildRecord(BookbuildingQueryRequest bookbuildingQueryRequest) {
88 105  
89 106  
  107 + List<Patients> patients = new ArrayList<>();
90 108  
91   - List<Map<String,List>> list = new ArrayList<>();
92   - List<BookbuildingRecordResult> results = new ArrayList<>();
93   - if (!StringUtils.isEmpty(bookbuildingQueryRequest.getIdCard()) || !StringUtils.isEmpty(bookbuildingQueryRequest.getVcCardNo()))
  109 + PatientsQuery patientsQuery = new PatientsQuery();
  110 + patientsQuery.setYn(YnEnums.YES.getId());
  111 + //如果身份证号码不为空就以身份证号码查询
  112 + if (!StringUtils.isEmpty(bookbuildingQueryRequest.getIdCard()))
94 113 {
95   -
96   - PatientsQuery patientsQuery = new PatientsQuery();
97 114 patientsQuery.setCardNo(bookbuildingQueryRequest.getIdCard());
98   - patientsQuery.setYn(YnEnums.YES.getId());
  115 + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  116 + }
  117 + //否则用就诊卡号 查询到这个孕妇的身份证号码 再用身份证号码查询该孕妇的所有建档 包括产妇记录
  118 + else if (!StringUtils.isEmpty(bookbuildingQueryRequest.getVcCardNo()) && !StringUtils.isEmpty(String.valueOf(bookbuildingQueryRequest.getHospitalId())))
  119 + {
99 120 patientsQuery.setVcCardNo(bookbuildingQueryRequest.getVcCardNo());
  121 + patientsQuery.setHospitalId(bookbuildingQueryRequest.getHospitalId());
  122 + List<Patients> patientsVc = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  123 + if (CollectionUtils.isNotEmpty(patientsVc))
  124 + {
  125 + patientsQuery.setHospitalId(null);
  126 + patientsQuery.setVcCardNo(null);
  127 + patientsQuery.setCardNo(patients.get(0).getCardNo());
  128 + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  129 + }
  130 + }
100 131  
101   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  132 + //历史建档记录
  133 + List<Map<String,List>> list = new ArrayList<>();
  134 + List<BookbuildingRecordResult> results = new ArrayList<>();
  135 + if (CollectionUtils.isNotEmpty(patients))
  136 + {
102 137 for(Patients pat : patients)
103 138 {
104 139 if (pat != null)
... ... @@ -115,6 +150,7 @@
115 150 }
116 151 }
117 152 }
  153 +
118 154  
119 155  
120 156 Map<String,List> typeMap = new HashMap<>();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BookbuildingQueryRequest.java View file @ 18a5de3
... ... @@ -8,18 +8,21 @@
8 8 @Form
9 9 public class BookbuildingQueryRequest {
10 10 //身份号
11   - private String idCard;
  11 + private String cardNo;
12 12 //就诊卡号
13 13 private String vcCardNo;
14 14 //建档类型
15 15 private String bookbuildingType;
16 16  
17   - public String getIdCard() {
18   - return idCard;
  17 + //医院ID
  18 + private Integer hospitalId;
  19 +
  20 + public String getCardNo() {
  21 + return cardNo;
19 22 }
20 23  
21   - public void setIdCard(String idCard) {
22   - this.idCard = idCard;
  24 + public void setCardNo(String cardNo) {
  25 + this.cardNo = cardNo;
23 26 }
24 27  
25 28 public String getVcCardNo() {
... ... @@ -36,6 +39,14 @@
36 39  
37 40 public void setBookbuildingType(String bookbuildingType) {
38 41 this.bookbuildingType = bookbuildingType;
  42 + }
  43 +
  44 + public Integer getHospitalId() {
  45 + return hospitalId;
  46 + }
  47 +
  48 + public void setHospitalId(Integer hospitalId) {
  49 + this.hospitalId = hospitalId;
39 50 }
40 51 }