Commit 4a6cb657bcb9903b404b95154bf4ec1bf1b48c27
1 parent
88176476b7
Exists in
master
and in
2 other branches
分娩作废产检劵
Showing 1 changed file with 33 additions and 9 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCheckTicketFacade.java
View file @
4a6cb65
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.AreaCodeService; | |
| 3 | 4 | import com.lyms.platform.biz.service.AutoIncermentService; |
| 4 | 5 | import com.lyms.platform.biz.service.PatientCheckTicketService; |
| 5 | 6 | import com.lyms.platform.biz.service.PatientsService; |
| 6 | 7 | |
| 7 | 8 | |
| ... | ... | @@ -8,10 +9,15 @@ |
| 8 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 9 | 10 | import com.lyms.platform.common.utils.ExceptionUtils; |
| 10 | 11 | import com.lyms.platform.operate.web.worker.WorkHR; |
| 12 | +import com.lyms.platform.permission.model.Organization; | |
| 13 | +import com.lyms.platform.permission.service.OrganizationService; | |
| 14 | +import com.lyms.platform.pojo.AreaCodeModel; | |
| 11 | 15 | import com.lyms.platform.pojo.PatientCheckTicket; |
| 12 | 16 | import com.lyms.platform.pojo.Patients; |
| 17 | +import com.lyms.platform.query.AreaCodeQuery; | |
| 13 | 18 | import com.lyms.platform.query.PatientCheckTicketQuery; |
| 14 | 19 | import com.lyms.platform.query.PatientsQuery; |
| 20 | +import org.apache.commons.collections.CollectionUtils; | |
| 15 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 22 | import org.springframework.stereotype.Component; |
| 17 | 23 | |
| 18 | 24 | |
| ... | ... | @@ -34,9 +40,13 @@ |
| 34 | 40 | private PatientsService patientsService; |
| 35 | 41 | @Autowired |
| 36 | 42 | private AutoMatchFacade autoMatchFacade; |
| 43 | + @Autowired | |
| 44 | + private AreaCodeService areaCodeService; | |
| 37 | 45 | |
| 38 | 46 | @Autowired |
| 39 | 47 | private AutoIncermentService autoIncermentService; |
| 48 | + @Autowired | |
| 49 | + private OrganizationService organizationService; | |
| 40 | 50 | |
| 41 | 51 | /** |
| 42 | 52 | * 补发以前建档的产检劵 |
| ... | ... | @@ -82,15 +92,29 @@ |
| 82 | 92 | checkTicketQuery.setPatientId(p.getId()); |
| 83 | 93 | if (0 == checkTicketServicel.queryTicketCount(checkTicketQuery)) { |
| 84 | 94 | //建档成功后,给孕妇造五个条形码 |
| 85 | - String ticketPid = autoIncermentService.nextPatientTicketId(); | |
| 86 | - for (Integer i = 1; i <= 5; i++) { | |
| 87 | - PatientCheckTicket ticket = new PatientCheckTicket(); | |
| 88 | - ticket.setStatus(1); | |
| 89 | - ticket.setHospitalId(p.getHospitalId()); | |
| 90 | - ticket.setPatientId(p.getId()); | |
| 91 | - ticket.setCreated(new Date()); | |
| 92 | - ticket.setId("0335" + ticketPid + i); | |
| 93 | - checkTicketServicel.addTicket(ticket); | |
| 95 | + Organization organization = organizationService.getOrganization(Integer.valueOf(p.getHospitalId())); | |
| 96 | + if (null != organization) { | |
| 97 | + AreaCodeQuery areaCodeQuery = new AreaCodeQuery(); | |
| 98 | + areaCodeQuery.setAreaId(organization.getCityId()); | |
| 99 | + List<AreaCodeModel> code = areaCodeService.queryList(areaCodeQuery); | |
| 100 | + AreaCodeModel areaCode = null; | |
| 101 | + if (CollectionUtils.isNotEmpty(code)) { | |
| 102 | + areaCode = code.get(0); | |
| 103 | + } | |
| 104 | + if (null != areaCode) { | |
| 105 | + // 建档成功后,给孕妇造五个条形码 | |
| 106 | + String ticketPid = autoIncermentService.nextPatientTicketId(); | |
| 107 | + for (Integer i = 1; i <= 5; i++) { | |
| 108 | + PatientCheckTicket ticket = new PatientCheckTicket(); | |
| 109 | + ticket.setStatus(1); | |
| 110 | + ticket.setHospitalId(p.getHospitalId()); | |
| 111 | + ticket.setPatientId(p.getId()); | |
| 112 | + ticket.setCreated(new Date()); | |
| 113 | + ticket.setId(areaCode.getAreaCode() + ticketPid + i); | |
| 114 | + ticket.setPid(p.getPid()); | |
| 115 | + checkTicketServicel.addTicket(ticket); | |
| 116 | + } | |
| 117 | + } | |
| 94 | 118 | } |
| 95 | 119 | } |
| 96 | 120 | } catch (Exception e) { |