Commit 7d4e0106f1042e6c23d906f9542ff4194899d50b
1 parent
e99a68f34a
Exists in
master
and in
7 other branches
增加产检劵处理
Showing 4 changed files with 129 additions and 1 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientCheckTicket.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UpdateController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCheckTicketFacade.java
platform-dal/src/main/java/com/lyms/platform/pojo/PatientCheckTicket.java
View file @
7d4e010
... | ... | @@ -17,10 +17,19 @@ |
17 | 17 | private String id; |
18 | 18 | private String patientId; |
19 | 19 | private String hospitalId; |
20 | + private String pid; | |
20 | 21 | private String consumeHospitalId; |
21 | 22 | private Integer status; // 1:创建未使用, 2:产检使用,3:分娩销毁 |
22 | 23 | private Date created; |
23 | 24 | private Date consumeDate; |
25 | + | |
26 | + public String getPid() { | |
27 | + return pid; | |
28 | + } | |
29 | + | |
30 | + public void setPid(String pid) { | |
31 | + this.pid = pid; | |
32 | + } | |
24 | 33 | |
25 | 34 | public String getId() { |
26 | 35 | return id; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UpdateController.java
View file @
7d4e010
... | ... | @@ -2,9 +2,11 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.common.base.BaseController; |
4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
5 | +import com.lyms.platform.common.result.BaseResponse; | |
5 | 6 | import com.lyms.platform.common.utils.ExceptionUtils; |
6 | 7 | import com.lyms.platform.common.utils.StringUtils; |
7 | 8 | import com.lyms.platform.operate.web.facade.CorrectDataFacade; |
9 | +import com.lyms.platform.operate.web.facade.PatientCheckTicketFacade; | |
8 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 11 | import org.springframework.stereotype.Controller; |
10 | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
... | ... | @@ -27,6 +29,8 @@ |
27 | 29 | @Autowired |
28 | 30 | private CorrectDataFacade correctDataFacade; |
29 | 31 | |
32 | + @Autowired | |
33 | + private PatientCheckTicketFacade patientCheckTicketFacade; | |
30 | 34 | @RequestMapping(value = "/updateData", method = RequestMethod.GET) |
31 | 35 | @ResponseBody |
32 | 36 | private Map<String, String> updateCorrectData(@RequestParam("hId") String hId) { |
... | ... | @@ -44,6 +48,18 @@ |
44 | 48 | ExceptionUtils.catchException(e, "updateCorrectData Error. hospitalId:" + hId); |
45 | 49 | } |
46 | 50 | return result; |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * 补发指定医院的产检劵 | |
55 | + * | |
56 | + * @param hId | |
57 | + * @return | |
58 | + */ | |
59 | + @RequestMapping(value = "/supplyCheckTicket", method = RequestMethod.GET) | |
60 | + @ResponseBody | |
61 | + private BaseResponse supplyCheckTicket(@RequestParam("hId")String hId){ | |
62 | + return patientCheckTicketFacade.supplyCheckTicket(hId); | |
47 | 63 | } |
48 | 64 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
7d4e010
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCheckTicketFacade.java
View file @
7d4e010
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.AutoIncermentService; | |
4 | +import com.lyms.platform.biz.service.PatientCheckTicketService; | |
5 | +import com.lyms.platform.biz.service.PatientsService; | |
6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
7 | +import com.lyms.platform.common.enums.YnEnums; | |
8 | +import com.lyms.platform.common.result.BaseResponse; | |
9 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
10 | +import com.lyms.platform.operate.web.worker.WorkHR; | |
11 | +import com.lyms.platform.pojo.PatientCheckTicket; | |
12 | +import com.lyms.platform.pojo.Patients; | |
13 | +import com.lyms.platform.query.PatientCheckTicketQuery; | |
14 | +import com.lyms.platform.query.PatientsQuery; | |
15 | +import org.springframework.beans.factory.annotation.Autowired; | |
16 | +import org.springframework.stereotype.Component; | |
17 | + | |
18 | +import java.util.ArrayList; | |
19 | +import java.util.Date; | |
20 | +import java.util.List; | |
21 | +import java.util.concurrent.Future; | |
22 | + | |
23 | +/** | |
24 | + * 产检劵补发 | |
25 | + * <p/> | |
26 | + * Created by Administrator on 2017/1/5 0005. | |
27 | + */ | |
28 | +@Component | |
29 | +public class PatientCheckTicketFacade { | |
30 | + | |
31 | + @Autowired | |
32 | + private PatientCheckTicketService checkTicketServicel; | |
33 | + @Autowired | |
34 | + private PatientsService patientsService; | |
35 | + @Autowired | |
36 | + private AutoMatchFacade autoMatchFacade; | |
37 | + | |
38 | + @Autowired | |
39 | + private AutoIncermentService autoIncermentService; | |
40 | + | |
41 | + /** | |
42 | + * 补发以前建档的产检劵 | |
43 | + * | |
44 | + * @return | |
45 | + */ | |
46 | + public BaseResponse supplyCheckTicket(String hId) { | |
47 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
48 | + patientsQuery1.setHospitalId(hId); | |
49 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
50 | + patientsQuery1.setType(1); | |
51 | + List buildType = new ArrayList(); | |
52 | + buildType.add(0); | |
53 | + buildType.add(2); | |
54 | + patientsQuery1.setBuildTypeList(buildType); | |
55 | + | |
56 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery1); | |
57 | + | |
58 | + int batchSize = 400; | |
59 | + int end = 0; | |
60 | + for (int i = 0; i < patientses.size(); i += batchSize) { | |
61 | + end = (end + batchSize); | |
62 | + if (end > patientses.size()) { | |
63 | + end = patientses.size(); | |
64 | + } | |
65 | + new SupplyCheckTicketThread(patientses.subList(i, end)).start(); | |
66 | + } | |
67 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
68 | + } | |
69 | + | |
70 | + private class SupplyCheckTicketThread extends Thread { | |
71 | + private List<Patients> patientses; | |
72 | + | |
73 | + public SupplyCheckTicketThread(List<Patients> patientses) { | |
74 | + this.patientses = patientses; | |
75 | + } | |
76 | + | |
77 | + @Override | |
78 | + public void run() { | |
79 | + PatientCheckTicketQuery checkTicketQuery = new PatientCheckTicketQuery(); | |
80 | + for (Patients p : patientses) { | |
81 | + try { | |
82 | + checkTicketQuery.setPatientId(p.getId()); | |
83 | + if (0 == checkTicketServicel.queryTicketCount(checkTicketQuery)) { | |
84 | + //建档成功后,给孕妇造五个条形码 | |
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); | |
94 | + } | |
95 | + } | |
96 | + } catch (Exception e) { | |
97 | + ExceptionUtils.catchException(e, "SupplyCheckTicketThread Error."); | |
98 | + } | |
99 | + } | |
100 | + } | |
101 | + } | |
102 | +} |