Commit 8ca1e39e24f05532a298fd5cef68ca1b974f10f7

Authored by jiangjiazhi
1 parent c7f377d0e0

建档生成产检劵

Showing 6 changed files with 220 additions and 51 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAreaCodeDao.java View file @ 8ca1e39
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.pojo.AreaCodeModel;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * Created by Administrator on 2017/1/13 0013.
  10 + */
  11 +public interface IAreaCodeDao {
  12 +
  13 + /**
  14 + * 查询区域号
  15 + *
  16 + * @param mongoQuery
  17 + *
  18 + * @return
  19 + */
  20 + List<AreaCodeModel> queryList(MongoQuery mongoQuery);
  21 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AreaCodeImpl.java View file @ 8ca1e39
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.ArchiveDataDao;
  4 +import com.lyms.platform.biz.dal.IAreaCodeDao;
  5 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  6 +import com.lyms.platform.common.dao.operator.MongoQuery;
  7 +import com.lyms.platform.pojo.ArchiveData;
  8 +import com.lyms.platform.pojo.AreaCodeModel;
  9 +import org.springframework.stereotype.Repository;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * 区域号
  15 + * Created by Administrator on 2017/1/13 0013.
  16 + */
  17 +@Repository("areaCodeDao")
  18 +public class AreaCodeImpl extends BaseMongoDAOImpl<AreaCodeModel> implements IAreaCodeDao {
  19 + @Override
  20 + public List<AreaCodeModel> queryList(MongoQuery mongoQuery) {
  21 + return find(mongoQuery.convertToMongoQuery());
  22 + }
  23 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AreaCodeService.java View file @ 8ca1e39
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.biz.dal.IAreaCodeDao;
  4 +import com.lyms.platform.common.dao.operator.MongoQuery;
  5 +import com.lyms.platform.pojo.AreaCodeModel;
  6 +import com.lyms.platform.query.AreaCodeQuery;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + *
  14 + * Created by Administrator on 2017/1/13 0013.
  15 + */
  16 +@Service
  17 +public class AreaCodeService {
  18 + @Autowired
  19 + private IAreaCodeDao iAreaCodeDao;
  20 +
  21 + public List<AreaCodeModel> queryList(AreaCodeQuery mongoQuery){
  22 + return iAreaCodeDao.queryList(mongoQuery.convertToQuery());
  23 + }
  24 +}
platform-dal/src/main/java/com/lyms/platform/pojo/AreaCodeModel.java View file @ 8ca1e39
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import org.springframework.data.mongodb.core.mapping.Document;
  4 +
  5 +/**
  6 + * Created by Administrator on 2017/1/13 0013.
  7 + */
  8 +@Document(collection = "lyms_areacode")
  9 +public class AreaCodeModel {
  10 + private String areaId;
  11 + private String id;
  12 + private String areaCode;
  13 + private String areaName;
  14 + private Integer yn;
  15 +
  16 + public String getAreaId() {
  17 + return areaId;
  18 + }
  19 +
  20 + public void setAreaId(String areaId) {
  21 + this.areaId = areaId;
  22 + }
  23 +
  24 + public String getId() {
  25 + return id;
  26 + }
  27 +
  28 + public void setId(String id) {
  29 + this.id = id;
  30 + }
  31 +
  32 + public String getAreaCode() {
  33 + return areaCode;
  34 + }
  35 +
  36 + public void setAreaCode(String areaCode) {
  37 + this.areaCode = areaCode;
  38 + }
  39 +
  40 + public String getAreaName() {
  41 + return areaName;
  42 + }
  43 +
  44 + public void setAreaName(String areaName) {
  45 + this.areaName = areaName;
  46 + }
  47 +
  48 + public Integer getYn() {
  49 + return yn;
  50 + }
  51 +
  52 + public void setYn(Integer yn) {
  53 + this.yn = yn;
  54 + }
  55 +}
platform-dal/src/main/java/com/lyms/platform/query/AreaCodeQuery.java View file @ 8ca1e39
  1 +package com.lyms.platform.query;
  2 +
  3 +import com.lyms.platform.common.base.IConvertToNativeQuery;
  4 +import com.lyms.platform.common.dao.BaseQuery;
  5 +import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
  7 +import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +
  9 +/**
  10 + * Created by Administrator on 2017/1/13 0013.
  11 + */
  12 +public class AreaCodeQuery extends BaseQuery implements IConvertToNativeQuery {
  13 + private String areaId;
  14 +
  15 + @Override
  16 + public MongoQuery convertToQuery() {
  17 + MongoCondition condition = MongoCondition.newInstance();
  18 +
  19 + if(null!=areaId){
  20 + condition=condition.and("areaId", areaId, MongoOper.IS);
  21 + }
  22 + return condition.toMongoQuery();
  23 + }
  24 +
  25 + public String getAreaId() {
  26 + return areaId;
  27 + }
  28 +
  29 + public void setAreaId(String areaId) {
  30 + this.areaId = areaId;
  31 + }
  32 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 8ca1e39
... ... @@ -111,6 +111,8 @@
111 111  
112 112 @Autowired
113 113 private PatientCheckTicketService patientCheckTicketService;
  114 + @Autowired
  115 + private AreaCodeService areaCodeService;
114 116  
115 117 /**
116 118 * 根据患者的建档ID,查询还未使用的免费产检查券
... ... @@ -220,7 +222,7 @@
220 222 patient.setDueStatus(0);
221 223 //1孕妇 3 产妇
222 224 patient.setType(type);
223   - if(type==3){
  225 + if (type == 3) {
224 226 patient.setIsAutoFm(YnEnums.YES.getId());
225 227 }
226 228 patient.setBuildType(buildType);
... ... @@ -260,18 +262,31 @@
260 262 }
261 263  
262 264  
263   - if (p.getType()!=null&&p.getType() == 1) {
264   - // 建档成功后,给孕妇造五个条形码
265   - String ticketPid = autoIncermentService.nextPatientTicketId();
266   - for (Integer i = 1; i <= 5; i++) {
267   - PatientCheckTicket ticket = new PatientCheckTicket();
268   - ticket.setStatus(1);
269   - ticket.setHospitalId(p.getHospitalId());
270   - ticket.setPatientId(p.getId());
271   - ticket.setCreated(new Date());
272   - ticket.setId("0335" + ticketPid + i);
273   - ticket.setPid(p.getPid());
274   - patientCheckTicketService.addTicket(ticket);
  265 + if (p.getType() != null && p.getType() == 1) {
  266 +
  267 + Organization organization = organizationService.getOrganization(Integer.valueOf(yunRequest.getHospitalId()));
  268 + if (null != organization) {
  269 + AreaCodeQuery areaCodeQuery = new AreaCodeQuery();
  270 + areaCodeQuery.setAreaId(organization.getCityId());
  271 + List<AreaCodeModel> code = areaCodeService.queryList(areaCodeQuery);
  272 + AreaCodeModel areaCode = null;
  273 + if (CollectionUtils.isNotEmpty(code)) {
  274 + areaCode = code.get(0);
  275 + }
  276 + if (null != areaCode) {
  277 + // 建档成功后,给孕妇造五个条形码
  278 + String ticketPid = autoIncermentService.nextPatientTicketId();
  279 + for (Integer i = 1; i <= 5; i++) {
  280 + PatientCheckTicket ticket = new PatientCheckTicket();
  281 + ticket.setStatus(1);
  282 + ticket.setHospitalId(p.getHospitalId());
  283 + ticket.setPatientId(p.getId());
  284 + ticket.setCreated(new Date());
  285 + ticket.setId(areaCode.getAreaCode() + ticketPid + i);
  286 + ticket.setPid(p.getPid());
  287 + patientCheckTicketService.addTicket(ticket);
  288 + }
  289 + }
275 290 }
276 291 }
277 292  
... ... @@ -585,7 +600,7 @@
585 600 }
586 601  
587 602 String group = groupsFacade.findByCurrentUserId(autoMatchFacade.getHospitalId(userId));
588   - if(StringUtils.isNotEmpty(group)){
  603 + if (StringUtils.isNotEmpty(group)) {
589 604 //区域模式
590 605 patientsQuery.setHospitalList(groupsFacade.findGroupHospital(userId, false));
591 606 }
... ... @@ -658,7 +673,7 @@
658 673 Map<String, Object> mapData = new HashMap<>();
659 674 mapData.put("data", results);
660 675 // 是否在本医院所在区域建档
661   - mapData.put("rBType",count>0);
  676 + mapData.put("rBType", count > 0);
662 677 mapData.put("initBuildDate", DateUtil.getyyyy_MM_dd(new Date()));
663 678 list.add(mapData);
664 679  
... ... @@ -731,7 +746,7 @@
731 746 List<BasicConfig> data = basicConfigService.queryBasicConfig(basicConfigQuery);
732 747 if (CollectionUtils.isNotEmpty(data)) {
733 748 //身份证类型得到丈夫的生日 必须为身份证类型
734   - if (StringUtils.isNotEmpty(data.get(0).getCode())&&"SFZ".endsWith(data.get(0).getCode())) {
  749 + if (StringUtils.isNotEmpty(data.get(0).getCode()) && "SFZ".endsWith(data.get(0).getCode())) {
735 750 String cardNo = yunRequest.getHusbandCertificateNum();
736 751 Date birth = StringUtils.getBirthDay(cardNo);
737 752 patient.setHusbandBirth(birth);
738 753  
739 754  
740 755  
741 756  
742 757  
743 758  
744 759  
745 760  
746 761  
747 762  
748 763  
749 764  
... ... @@ -1472,76 +1487,75 @@
1472 1487 return "";
1473 1488 }
1474 1489  
1475   - public BaseObjectResponse findPatientData(String id){
  1490 + public BaseObjectResponse findPatientData(String id) {
1476 1491  
1477 1492 BaseObjectResponse br = new BaseObjectResponse();
1478   - if (org.apache.commons.lang.StringUtils.isEmpty(id)){
  1493 + if (org.apache.commons.lang.StringUtils.isEmpty(id)) {
1479 1494 br.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR);
1480 1495 br.setErrormsg("id为空");
1481 1496 return br;
1482 1497 }
1483 1498  
1484 1499 Patients data = patientsService.findOnePatientById(id);
1485   - if (data==null || data.getYn()==YnEnums.NO.getId()){
  1500 + if (data == null || data.getYn() == YnEnums.NO.getId()) {
1486 1501 br.setErrorcode(ErrorCodeConstants.NO_DATA);
1487 1502 br.setErrormsg("没有查询到数据");
1488 1503 return br;
1489 1504 }
1490 1505  
1491   - Map<String,Object> map = new HashMap<>();
1492   - map.put("id",data.getId());
  1506 + Map<String, Object> map = new HashMap<>();
  1507 + map.put("id", data.getId());
1493 1508 /* 孕妇基础数据 */
1494   - map.put("username",data.getUsername());
1495   - map.put("pcerteType",getBasicConfig(data.getPcerteTypeId()));
1496   - map.put("cardNo",data.getCardNo());
1497   - map.put("pcountry",getBasicConfig(data.getPcountryId()));
1498   - map.put("pnation",getBasicConfig(data.getPnationId()));
1499   - map.put("birth",DateUtil.getyyyy_MM_dd(data.getBirth()));
1500   - map.put("age",DateUtil.getAge(data.getBirth()));
1501   - map.put("pcensusType",getBasicConfig(data.getPcensusTypeId()));
1502   - map.put("pliveType",getBasicConfig(data.getPliveTypeId()));
1503   - map.put("pprofessionType",getBasicConfig(data.getPprofessionTypeId()));
1504   - map.put("plevelType",getBasicConfig(data.getPlevelTypeId()));
  1509 + map.put("username", data.getUsername());
  1510 + map.put("pcerteType", getBasicConfig(data.getPcerteTypeId()));
  1511 + map.put("cardNo", data.getCardNo());
  1512 + map.put("pcountry", getBasicConfig(data.getPcountryId()));
  1513 + map.put("pnation", getBasicConfig(data.getPnationId()));
  1514 + map.put("birth", DateUtil.getyyyy_MM_dd(data.getBirth()));
  1515 + map.put("age", DateUtil.getAge(data.getBirth()));
  1516 + map.put("pcensusType", getBasicConfig(data.getPcensusTypeId()));
  1517 + map.put("pliveType", getBasicConfig(data.getPliveTypeId()));
  1518 + map.put("pprofessionType", getBasicConfig(data.getPprofessionTypeId()));
  1519 + map.put("plevelType", getBasicConfig(data.getPlevelTypeId()));
1505 1520 //TODO 家庭人均收入
1506 1521  
1507 1522 /* 孕妇联系方式 */
1508   - map.put("residence", CommonsHelper.getResidence(data.getProvinceId(),data.getCityId(),
1509   - data.getAreaId(),data.getStreetId(),data.getAddress(),basicConfigService));
1510   - map.put("register",CommonsHelper.getResidence(data.getProvinceRegisterId(), data.getCityRegisterId(),
  1523 + map.put("residence", CommonsHelper.getResidence(data.getProvinceId(), data.getCityId(),
  1524 + data.getAreaId(), data.getStreetId(), data.getAddress(), basicConfigService));
  1525 + map.put("register", CommonsHelper.getResidence(data.getProvinceRegisterId(), data.getCityRegisterId(),
1511 1526 data.getAreaRegisterId(), data.getStreetRegisterId(), data.getAddressRegister(), basicConfigService));
1512   - map.put("postRest",CommonsHelper.getResidence(data.getProvinceId(), data.getCityId(),
  1527 + map.put("postRest", CommonsHelper.getResidence(data.getProvinceId(), data.getCityId(),
1513 1528 data.getAreaId(), data.getStreetId(), data.getAddress(), basicConfigService));
1514 1529  
1515 1530 /* 丈夫信息 */
1516   - map.put("husbandName",data.getHusbandName());
1517   - map.put("hcertificateType",getBasicConfig(data.getHcertificateTypeId()));
1518   - map.put("hcertificateNum",data.getHcertificateNum());
1519   - map.put("hcountry",getBasicConfig(data.getHcountryId()));
1520   - map.put("hnation",getBasicConfig(data.getHnationId()));
1521   - map.put("husbandPhone",data.getHusbandPhone());
1522   - map.put("hprofessionType",getBasicConfig(data.getHprofessionTypeId()));
1523   - map.put("hworkUnit",data.getHworkUnit());
1524   - map.put("hregister",CommonsHelper.getResidence(data.getHprovinceRegisterId(), data.getHcityRegisterId(),
  1531 + map.put("husbandName", data.getHusbandName());
  1532 + map.put("hcertificateType", getBasicConfig(data.getHcertificateTypeId()));
  1533 + map.put("hcertificateNum", data.getHcertificateNum());
  1534 + map.put("hcountry", getBasicConfig(data.getHcountryId()));
  1535 + map.put("hnation", getBasicConfig(data.getHnationId()));
  1536 + map.put("husbandPhone", data.getHusbandPhone());
  1537 + map.put("hprofessionType", getBasicConfig(data.getHprofessionTypeId()));
  1538 + map.put("hworkUnit", data.getHworkUnit());
  1539 + map.put("hregister", CommonsHelper.getResidence(data.getHprovinceRegisterId(), data.getHcityRegisterId(),
1525 1540 data.getHareaRegisterId(), data.getHstreetRegisterId(), data.getHaddressRegister(),
1526 1541 basicConfigService));
1527 1542  
1528 1543 /* 院内信息 */
1529   - map.put("lastMenses",DateUtil.getyyyy_MM_dd(data.getLastMenses()));
  1544 + map.put("lastMenses", DateUtil.getyyyy_MM_dd(data.getLastMenses()));
1530 1545 //TODO 纠正末次月经
1531   - map.put("dueDate",DateUtil.getyyyy_MM_dd(data.getDueDate()));
1532   - map.put("vcCardNo",data.getVcCardNo());
  1546 + map.put("dueDate", DateUtil.getyyyy_MM_dd(data.getDueDate()));
  1547 + map.put("vcCardNo", data.getVcCardNo());
1533 1548 //TODO 条码
1534 1549 //TODO 档案编号
1535   - map.put("mremark",data.getMremark());
  1550 + map.put("mremark", data.getMremark());
1536 1551 //TODO 服务类型
1537   - map.put("serviceStatus",ServiceStatusEnums.getNameById(data.getServiceStatus()));
  1552 + map.put("serviceStatus", ServiceStatusEnums.getNameById(data.getServiceStatus()));
1538 1553  
1539 1554 br.setData(map);
1540 1555 br.setErrorcode(ErrorCodeConstants.SUCCESS);
1541 1556 br.setErrormsg("成功");
1542 1557 return br;
1543 1558 }
1544   -
1545 1559  
1546 1560  
1547 1561 }