Commit 34980c996911b05cd82284d9f8b95fcc840d585e

Authored by liquanyu
1 parent 7c407ddb1c
Exists in master and in 1 other branch dev

出生医学证明

Showing 2 changed files with 216 additions and 146 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java View file @ 34980c9
... ... @@ -691,15 +691,14 @@
691 691 /**
692 692 * 对接北京系统出生医学证明的接口
693 693 *
694   - * @param idCard
  694 + * @param id
695 695 * @return
696 696 */
697   - @RequestMapping(value = "/getCheckInfo", method = RequestMethod.GET)
  697 + @RequestMapping(value = "/GetDeliveryInfo", method = RequestMethod.GET)
698 698 @ResponseBody
699   - @TokenRequired
700   - public List<Map<String, Object>> getMatDeliverData(@RequestParam(required = true) String idCard,
701   - @RequestParam(required = false) String jigou) {
702   - return viewFacade.getMatDeliverData(idCard,jigou);
  699 + public Object getMatDeliverData(@RequestParam(required = true) String id,
  700 + @RequestParam(required = true) String hospital) {
  701 + return viewFacade.getMatDeliverData(id,hospital);
703 702 }
704 703  
705 704 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 34980c9
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.platform.biz.SequenceConstant;
4 4 import com.lyms.platform.biz.service.*;
5 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.dao.operator.Page;
6 7 import com.lyms.platform.common.enums.*;
7 8 import com.lyms.platform.common.result.BaseObjectResponse;
8 9 import com.lyms.platform.common.result.BaseResponse;
... ... @@ -36,6 +37,7 @@
36 37 import org.springframework.data.mongodb.core.query.Query;
37 38 import org.springframework.stereotype.Component;
38 39  
  40 +import java.text.SimpleDateFormat;
39 41 import java.util.*;
40 42  
41 43 /**
42 44  
43 45  
44 46  
45 47  
46 48  
47 49  
48 50  
49 51  
50 52  
51 53  
52 54  
53 55  
54 56  
55 57  
56 58  
57 59  
58 60  
59 61  
60 62  
61 63  
62 64  
63 65  
64 66  
65 67  
66 68  
67 69  
68 70  
69 71  
70 72  
71 73  
72 74  
73 75  
... ... @@ -4291,161 +4293,230 @@
4291 4293 return br;
4292 4294 }
4293 4295  
4294   - public List<Map<String, Object>> getMatDeliverData(String idCard, String jigou) {
  4296 + public Map<String, Object> getMatDeliverData(String idCard, String hospitalName) {
  4297 + Map<String, Object> deliverMap = new HashMap<>();
  4298 + try {
  4299 + PatientsQuery patientsQuery = new PatientsQuery();
  4300 + patientsQuery.setYn(YnEnums.YES.getId());
  4301 + patientsQuery.setCardNo(idCard);
4295 4302  
4296   - PatientsQuery patientsQuery = new PatientsQuery();
4297   - patientsQuery.setYn(YnEnums.YES.getId());
4298   - patientsQuery.setCardNo(idCard);
4299   -
4300   - if (StringUtils.isNotEmpty(jigou)) {
4301   - OrganizationQuery query = new OrganizationQuery();
4302   - query.setName(jigou);
4303   - query.setYn(YnEnums.YES.getId());
4304   - List<Organization> organizations = organizationService.queryOrganization(query);
4305   - if (CollectionUtils.isNotEmpty(organizations)) {
4306   - patientsQuery.setHospitalId(String.valueOf(organizations.get(0).getId()));
  4303 + if (StringUtils.isNotEmpty(hospitalName)) {
  4304 + OrganizationQuery query = new OrganizationQuery();
  4305 + query.setName(hospitalName);
  4306 + query.setYn(YnEnums.YES.getId());
  4307 + List<Organization> organizations = organizationService.queryOrganization(query);
  4308 + if (CollectionUtils.isNotEmpty(organizations)) {
  4309 + patientsQuery.setHospitalId(String.valueOf(organizations.get(0).getId()));
  4310 + }
4307 4311 }
4308   - }
4309   - List<Map<String, Object>> deliverList = new ArrayList<>();
4310   - List<Patients> list = patientsService.queryPatient1(patientsQuery, "created");
4311   - if (CollectionUtils.isNotEmpty(list)) {
4312   - Patients pat = list.get(0);
4313   - MatDeliverQuery deliverQuery = new MatDeliverQuery();
4314   - deliverQuery.setYn(YnEnums.YES.getId());
4315   - deliverQuery.setParentId(pat.getId());
4316   - List<MaternalDeliverModel> datas = matDeliverService.query(deliverQuery);
4317   - if (CollectionUtils.isNotEmpty(datas)) {
4318   - MaternalDeliverModel data = datas.get(0);
4319 4312  
4320   - List<MaternalDeliverModel.Baby> babies = data.getBaby();
4321   - if (CollectionUtils.isNotEmpty(babies)) {
4322   - for (MaternalDeliverModel.Baby baby : babies) {
4323   - Map<String, Object> map = new HashMap<>();
4324 4313  
4325   - //新生儿性别
4326   - map.put("id", baby.getId());
4327   - //新生儿主键
4328   - map.put("sex", baby.getBabyGender() == null ? "" : SexEnum.getTextById(
4329   - Integer.parseInt(baby.getBabyGender())));
  4314 + List<Map<String, Object>> deliverList = new ArrayList<>();
  4315 + List<Patients> list = patientsService.queryPatient1(patientsQuery, "created");
  4316 + if (CollectionUtils.isNotEmpty(list)) {
  4317 + Patients pat = list.get(0);
4330 4318  
  4319 + Map<String, Object> patientMap = new HashMap<>();
4331 4320  
4332   - Integer betweenDay = DateUtil.getDays(pat.getLastMenses(), data.getDueDate1());
4333   - Integer week = betweenDay / 7;
4334   - Integer day = betweenDay % 7;
  4321 + patientMap.put("mid",pat.getId());//
  4322 + patientMap.put("mbuilddate",DateUtil.getyyyy_MM_dd(pat.getBookbuildingDate()));// 建档时间
4335 4323  
4336   - //出生孕周(周)
4337   - map.put("yz_week", week);
4338   - //出生孕天(天)
4339   - map.put("yz_day", day);
4340   - //新生儿出生日期
4341   - map.put("birthday", baby.getDueTime());
4342   - //新生儿出生地(省)
4343   - map.put("address_sheng", "");
4344   - //新生儿出生地(市)
4345   - map.put("address_shi", "");
4346   - //新生儿出生地(区县)
4347   - map.put("address_xian", "");
4348   - //新生儿健康状态
4349   - map.put("health", "");
4350   - //新生儿体重(克)
4351   - map.put("weight", baby.getBabyWeight());
4352   - //新生儿身长(厘米)
4353   - map.put("height", baby.getBabyHeight());
4354 4324  
  4325 + String buildHospital = "";
  4326 + if (StringUtils.isNotEmpty(pat.getHospitalId())) {
  4327 + Organization organization = organizationService.getOrganization(Integer.parseInt(pat.getHospitalId()));
  4328 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  4329 + buildHospital = organization.getName();
  4330 + }
  4331 + }
  4332 + patientMap.put("mbuildhospital",buildHospital);//建档单位
4355 4333  
4356   -// map.put("residence", CommonsHelper.getResidence(data.getProvinceId(), data.getCityId(),
4357   -// data.getAreaId(), data.getStreetId(), data.getAddress(), basicConfigService));
4358   -// map.put("register", CommonsHelper.getResidence(data.getProvinceRegisterId(), data.getCityRegisterId(),
4359   -// data.getAreaRegisterId(), data.getStreetRegisterId(), data.getAddressRegister(), basicConfigService));
  4334 + patientMap.put("mname",pat.getUsername());//母亲姓名
  4335 + patientMap.put("mcountry",getBasicConfig(pat.getPcountryId()));//母亲国籍
  4336 + patientMap.put("mnation",getBasicConfig(pat.getPnationId()));//母亲民族
  4337 + patientMap.put("mbirthday",DateUtil.getyyyy_MM_dd(pat.getBirth()));//母亲出生日期
  4338 + patientMap.put("mcardtype",getBasicConfig(pat.getPcerteTypeId()));//母亲证件类型
  4339 + patientMap.put("mcardnum", pat.getCardNo());//母亲证件号码
  4340 + patientMap.put("maddress",CommonsHelper.getResidence(pat.getProvinceId(), pat.getCityId(),
  4341 + pat.getAreaId(), pat.getStreetId(), pat.getAddress(), basicConfigService));//母亲户籍地址
4360 4342  
4361   - //母亲户籍地
4362   - map.put("womanaddress", CommonsHelper.getResidence(pat.getProvinceId(), pat.getCityId(),
4363   - pat.getAreaId(), pat.getStreetId(), pat.getAddress(), basicConfigService));
4364   - //母亲姓名
4365   - map.put("womanname", pat.getUsername());
4366 4343  
4367   - //母亲分娩年龄
4368   - map.put("womanage", DateUtil.getAge(pat.getBirth(), pat.getFmDate()));
  4344 + patientMap.put("fname",StringUtils.isNotEmpty(pat.getHusbandName()) ? pat.getHusbandName() : "");//父亲姓名
4369 4345  
4370   - //母亲国籍
4371   - map.put("womannation", getBasicConfig(pat.getPcountryId()));
4372   - //母亲证件类型
4373   - map.put("womancardtype", getBasicConfig(pat.getPcerteTypeId()));
4374   - //母亲证件号码
4375   - map.put("womancardnum", pat.getCardNo());
4376   - //母亲民族
4377   - map.put("womanminzu", getBasicConfig(pat.getPnationId()));
  4346 + patientMap.put("fcountry",getBasicConfig(pat.getHcountryId()));//父亲国籍
  4347 + patientMap.put("fnation",getBasicConfig(pat.getHnationId()));//父亲民族
  4348 + String fage = "";
  4349 + if (StringUtils.isNotEmpty(pat.getHcertificateTypeId()) && StringUtils.isNotEmpty(pat.getHcertificateNum()) &&
  4350 + pat.getHcertificateNum().length() == 18 &&
  4351 + "70ae1d93-2964-46bc-83fa-bec9ff605b1c".equals(pat.getHcertificateTypeId())) {
  4352 + String cardNo = pat.getHcertificateNum().substring(6, 14);
  4353 + Date date = DateUtil.parseYYYYMMDD(cardNo);
  4354 + Integer age = DateUtil.getAge(date);
  4355 + fage = String.valueOf(age);
  4356 + }
4378 4357  
  4358 + patientMap.put("fbirthday",fage);//父亲出生日期
  4359 + patientMap.put("fcardtype",getBasicConfig(pat.getHcertificateTypeId()));//父亲证件类型
4379 4360  
4380   - //父亲户籍地
4381   - map.put("manaddress", CommonsHelper.getResidence(pat.getHprovinceRegisterId(), pat.getHcityRegisterId(),
4382   - pat.getHareaRegisterId(), pat.getHstreetRegisterId(), pat.getHaddressRegister(),
4383   - basicConfigService));
4384 4361  
4385   - //父亲姓名
4386   - map.put("manname", pat.getHusbandName());
  4362 + patientMap.put("fcardnum",StringUtils.isNotEmpty(pat.getHcertificateNum()) ? pat.getHcertificateNum() : "");//父亲证件号码
  4363 + patientMap.put("faddress",CommonsHelper.getResidence(pat.getHprovinceRegisterId(), pat.getHcityRegisterId(),
  4364 + pat.getHareaRegisterId(), pat.getHstreetRegisterId(), pat.getHaddressRegister(),
  4365 + basicConfigService));//父亲户籍地址
4387 4366  
4388   - String fage = "";
4389   - if (StringUtils.isNotEmpty(pat.getHcertificateTypeId()) && StringUtils.isNotEmpty(pat.getHcertificateNum()) &&
4390   - pat.getHcertificateNum().length() == 18 &&
4391   - "70ae1d93-2964-46bc-83fa-bec9ff605b1c".equals(pat.getHcertificateTypeId())) {
4392   - String cardNo = pat.getHcertificateNum().substring(6, 14);
4393   - Date date = DateUtil.parseYYYYMMDD(cardNo);
4394   - Integer age = DateUtil.getAge(date);
4395   - fage = String.valueOf(age);
  4367 + Organization organization = null;
  4368 + String fmHospital = "";
  4369 + if (StringUtils.isNotEmpty(pat.getFmHospital())) {
  4370 + if (com.lyms.platform.common.utils.StringUtils.isNum(pat.getFmHospital())) {
  4371 + organization = organizationService.getOrganization(Integer.parseInt(pat.getFmHospital()));
  4372 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  4373 + fmHospital = organization.getName();
4396 4374 }
  4375 + } else {
  4376 + fmHospital = pat.getFmHospital();
  4377 + }
4397 4378  
4398   - //父亲年龄
4399   - map.put("manage", fage);
4400   - //父亲国籍
4401   - map.put("mannation", getBasicConfig(pat.getHcountryId()));
4402   - //父亲证件类型
4403   - map.put("mancardtype", getBasicConfig(pat.getHcertificateTypeId()));
4404   - //父亲证件号码
4405   - map.put("mancardnum", pat.getHcertificateNum());
4406   - //父亲民族
4407   - map.put("manminzu", getBasicConfig(pat.getHnationId()));
  4379 + }
  4380 + patientMap.put("hospital",fmHospital);//接生单位
4408 4381  
4409   - //出生地点分类
4410   - map.put("addresstype", (data.getFmType() != null && data.getFmType().equals("1")) ? "住院" : "其他");
4411 4382  
4412   - String fmHospital = "";
4413   - if (StringUtils.isNotEmpty(data.getFmHospital())) {
4414   - if (com.lyms.platform.common.utils.StringUtils.isNum(data.getFmHospital())) {
4415   - Organization organization = organizationService.getOrganization(Integer.parseInt(data.getFmHospital()));
4416   - if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
4417   - fmHospital = organization.getName();
4418   - }
4419   - } else {
4420   - fmHospital = data.getFmHospital();
  4383 + MatDeliverQuery deliverQuery = new MatDeliverQuery();
  4384 + deliverQuery.setYn(YnEnums.YES.getId());
  4385 + deliverQuery.setParentId(pat.getId());
  4386 + List<MaternalDeliverModel> datas = matDeliverService.query(deliverQuery);
  4387 + if (CollectionUtils.isNotEmpty(datas)) {
  4388 + String deliverDoctor = "";
  4389 + if (StringUtils.isNotEmpty(datas.get(0).getDeliverDoctor())) {
  4390 + if (com.lyms.platform.common.utils.StringUtils.isNum(datas.get(0).getDeliverDoctor())) {
  4391 + Users users = usersService.getUsers(Integer.parseInt(datas.get(0).getDeliverDoctor()));
  4392 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  4393 + deliverDoctor = users.getName();
4421 4394 }
  4395 + } else {
  4396 + deliverDoctor = datas.get(0).getDeliverDoctor();
  4397 + }
  4398 + }
  4399 + patientMap.put("doctor",deliverDoctor);//接生人
  4400 + MaternalDeliverModel data = datas.get(0);
4422 4401  
  4402 + String place = ""; //1 "住院" : "其他
  4403 + if (data.getFmType() != null && "1".equals(data.getFmType()))
  4404 + {
  4405 + if (fmHospital.contains("妇幼"))
  4406 + {
  4407 + place = "妇幼保健医院";
4423 4408 }
4424   - //接生机构
4425   - map.put("jieshengjigou", fmHospital);
  4409 + else
  4410 + {
  4411 + place = fmHospital;
  4412 + }
  4413 + }
  4414 + else
  4415 + {
  4416 + place = "其他";
  4417 + }
4426 4418  
  4419 + patientMap.put("place",place);//出生地点分类
4427 4420  
4428   - String deliverDoctor = "";
4429   - if (StringUtils.isNotEmpty(data.getDeliverDoctor())) {
4430   - if (com.lyms.platform.common.utils.StringUtils.isNum(data.getDeliverDoctor())) {
4431   - Users users = usersService.getUsers(Integer.parseInt(data.getDeliverDoctor()));
4432   - if (users != null && users.getYn() == YnEnums.YES.getId()) {
4433   - deliverDoctor = users.getName();
4434   - }
4435   - } else {
4436   - deliverDoctor = data.getDeliverDoctor();
  4421 +
  4422 + List babyList = new ArrayList();
  4423 +
  4424 + SimpleDateFormat hh = new SimpleDateFormat("HH");
  4425 + SimpleDateFormat mm = new SimpleDateFormat("mm");
  4426 +
  4427 + List<MaternalDeliverModel.Baby> babies = data.getBaby();
  4428 + if (CollectionUtils.isNotEmpty(babies)) {
  4429 + for (MaternalDeliverModel.Baby baby : babies) {
  4430 + Map<String, Object> map = new HashMap<>();
  4431 +
  4432 + //新生儿性别
  4433 + map.put("babyid", baby.getId());
  4434 + //新生儿主键
  4435 + map.put("babysex", baby.getBabyGender() == null ? "" : SexEnum.getTextById(
  4436 + Integer.parseInt(baby.getBabyGender())));
  4437 +
  4438 +
  4439 + Integer betweenDay = DateUtil.getDays(pat.getLastMenses(), data.getDueDate1());
  4440 + Integer week = betweenDay / 7;
  4441 + Integer day = betweenDay % 7;
  4442 +
  4443 + Date fmDate = DateUtil.parseYMDHM(baby.getDueTime());
  4444 +
  4445 + //出生孕周(周)
  4446 + map.put("babyweek", "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""));
  4447 + //新生儿出生日期
  4448 + map.put("babybirthday", DateUtil.getyyyy_MM_dd(fmDate));
  4449 +
  4450 + //新生儿出生日期 小时
  4451 + map.put("babybirthdayhour",hh.format(fmDate));
  4452 +
  4453 + //新生儿出生日期 分
  4454 + map.put("babybirthdayminute", mm.format(fmDate));
  4455 +
  4456 +
  4457 + if (StringUtils.isNotEmpty(data.getFmHospital()) && com.lyms.platform.common.utils.StringUtils.isNum(data.getFmHospital())) {
  4458 + organization = organizationService.getOrganization(Integer.parseInt(pat.getFmHospital()));
4437 4459 }
4438   - }
4439 4460  
4440   - //接生人
4441   - map.put("jieshengren", deliverDoctor);
  4461 + String babyprovince = "";
  4462 + String babycity = "";
  4463 + String babydistrict = "";
  4464 + if (organization != null)
  4465 + {
  4466 + babyprovince = getBasicConfig(organization.getProvinceId());
  4467 + babycity = getBasicConfig(organization.getCityId());
  4468 + babydistrict = getBasicConfig(organization.getAreaId());
  4469 + }
4442 4470  
4443   - deliverList.add(map);
  4471 + //新生儿出生地(省)
  4472 + map.put("babyprovince", babyprovince);
  4473 +
  4474 + //新生儿出生地(市)
  4475 + map.put("babycity", babycity);
  4476 +
  4477 + //新生儿出生地(区县)
  4478 + map.put("babydistrict", babydistrict);
  4479 +
  4480 + String babyState = "";
  4481 + if (baby.getDeformity() != null && baby.getDeformity() == 1)
  4482 + {
  4483 + babyState = "差";
  4484 + }
  4485 + else if (StringUtils.isNotEmpty(baby.getBabyHealthy()) && !"健康".equals(baby.getBabyHealthy()))
  4486 + {
  4487 + babyState = "一般";
  4488 + }
  4489 + else
  4490 + {
  4491 + babyState = "良好";
  4492 + }
  4493 +
  4494 + //新生儿健康状态
  4495 + map.put("babystate", babyState);
  4496 +
  4497 + //新生儿体重(克)
  4498 + map.put("weight", StringUtils.isNotEmpty(baby.getBabyWeight()) ? baby.getBabyWeight() : "");
  4499 + //新生儿身长(厘米)
  4500 + map.put("height", StringUtils.isNotEmpty(baby.getBabyHeight()) ? baby.getBabyHeight() : "");
  4501 +
  4502 + babyList.add(map);
  4503 + }
4444 4504 }
  4505 +
  4506 + patientMap.put("newborninfo", babyList);
4445 4507 }
  4508 + patientMap.put("address", CommonsHelper.getResidence(pat.getProvincePostRestId(), pat.getCityPostRestId(),
  4509 + pat.getAreaPostRestId(), pat.getStreetPostRestId(), pat.getAddressPostRest(), basicConfigService));//母亲产后休养地
  4510 + deliverList.add(patientMap);
4446 4511 }
  4512 + deliverMap.put("motherinfo",deliverList);
4447 4513 }
4448   - return deliverList;
  4514 + catch (Exception e)
  4515 + {
  4516 + System.out.println(e.getMessage()+"出生医学接口异常");
  4517 + }
  4518 +
  4519 + return deliverMap;
4449 4520 }
4450 4521 }