Commit c58ff6620b5f6780b3bcadce1752d40f5e5052b3

Authored by jiangjiazhi
1 parent 9c30a23599

commit

Showing 1 changed file with 221 additions and 225 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCheckTicketFacade.java View file @ c58ff66
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import java.util.ArrayList;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +import org.apache.commons.collections.CollectionUtils;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.beans.factory.annotation.Qualifier;
  10 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
  11 +import org.springframework.stereotype.Component;
  12 +
3 13 import com.lyms.platform.biz.service.AreaCodeService;
4 14 import com.lyms.platform.biz.service.AutoIncermentService;
5 15 import com.lyms.platform.biz.service.PatientCheckTicketService;
... ... @@ -10,7 +20,6 @@
10 20 import com.lyms.platform.common.utils.DateUtil;
11 21 import com.lyms.platform.common.utils.ExceptionUtils;
12 22 import com.lyms.platform.common.utils.StringUtils;
13   -import com.lyms.platform.operate.web.worker.WorkHR;
14 23 import com.lyms.platform.permission.model.Organization;
15 24 import com.lyms.platform.permission.service.OrganizationService;
16 25 import com.lyms.platform.pojo.AreaCodeModel;
17 26  
18 27  
19 28  
... ... @@ -19,31 +28,19 @@
19 28 import com.lyms.platform.query.AreaCodeQuery;
20 29 import com.lyms.platform.query.PatientCheckTicketQuery;
21 30 import com.lyms.platform.query.PatientsQuery;
22   -import org.apache.commons.collections.CollectionUtils;
23   -import org.springframework.beans.factory.annotation.Autowired;
24   -import org.springframework.beans.factory.annotation.Qualifier;
25   -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
26   -import org.springframework.stereotype.Component;
27 31  
28   -import java.util.ArrayList;
29   -import java.util.Date;
30   -import java.util.List;
31   -import java.util.concurrent.Future;
32   -
33 32 /**
34 33 * 产检劵补发
35 34 * <p/>
36 35 * 补发规则:
  36 + * <pre/>
  37 + * 当前孕周 <= 孕12周+6天 补发1、2、3、4、5券
  38 + * 孕12周+6天 < 当前孕周 <= 孕20周+6天 补发2、3、4、5券
  39 + * 孕20周+6天 < 当前孕周 <= 孕24周+6天 补发3、4、5券
  40 + * 孕24周+6天 < 当前孕周 <= 孕36周+6天 补发4、5券
  41 + * 孕36周+6天 <当前孕周 <= 孕40周+6天 补发5券
  42 + * <pre/>
37 43 * <p/>
38   - * 当前孕周 <= 孕12周+6天 补发1、2、3、4、5券
39   - * 孕12周+6天 < 当前孕周 <= 孕20周+6天 补发2、3、4、5券
40   - * 孕20周+6天 < 当前孕周 <= 孕24周+6天 补发3、4、5券
41   - * 孕24周+6天 < 当前孕周 <= 孕36周+6天 补发4、5券
42   - * 孕36周+6天 < 当前孕周 <= 孕40周+6天 补发5券
43   - * <p/>
44   - * <p/>
45   - * <p/>
46   - * <p/>
47 44 * Created by Administrator on 2017/1/5 0005.
48 45 */
49 46 @Component
50 47  
51 48  
52 49  
53 50  
54 51  
55 52  
... ... @@ -51,24 +48,26 @@
51 48  
52 49 @Autowired
53 50 private PatientCheckTicketService checkTicketServicel;
  51 +
54 52 @Autowired
55   - private PatientsService patientsService;
  53 + private PatientsService patientsService;
56 54  
57 55 @Autowired
58   - private AreaCodeService areaCodeService;
  56 + private AreaCodeService areaCodeService;
59 57  
60 58 @Autowired
61   - private AutoIncermentService autoIncermentService;
  59 + private AutoIncermentService autoIncermentService;
  60 +
62 61 @Autowired
63   - private OrganizationService organizationService;
  62 + private OrganizationService organizationService;
64 63  
65 64 @Autowired
66 65 @Qualifier("commonThreadPool")
67   - private ThreadPoolTaskExecutor commonThreadPool;
  66 + private ThreadPoolTaskExecutor commonThreadPool;
68 67  
69 68 /**
70 69 * 补发以前建档的产检劵
71   - *
  70 + *
72 71 * @return
73 72 */
74 73 public BaseResponse supplyCheckTicket(String hId) {
... ... @@ -77,7 +76,7 @@
77 76 patientsQuery1.setYn(YnEnums.YES.getId());
78 77 patientsQuery1.setType(1);
79 78 patientsQuery1.setExtEnable(false);
80   - List buildType = new ArrayList();
  79 + List<Integer> buildType = new ArrayList<Integer>();
81 80 buildType.add(0);
82 81 buildType.add(2);
83 82 patientsQuery1.setBuildTypeList(buildType);
84 83  
85 84  
86 85  
... ... @@ -98,20 +97,19 @@
98 97  
99 98 /**
100 99 * 补发单个建档的产检劵
101   - *
  100 + *
102 101 * @param parentId
103 102 * @return
104 103 */
105 104 public BaseResponse supplyCheckTicketByPatientId(String parentId) {
106 105  
107   -
108 106 Patients patients = patientsService.findOnePatientById(parentId);
109   - //表示不是隐藏建档
  107 + // 表示不是隐藏建档
110 108 PatientsQuery patientsQuery1 = new PatientsQuery();
111 109 patientsQuery1.setYn(YnEnums.YES.getId());
112 110 patientsQuery1.setType(1);
113 111 patientsQuery1.setExtEnable(false);
114   - List buildType = new ArrayList();
  112 + List<Integer> buildType = new ArrayList<Integer>();
115 113 buildType.add(0);
116 114 buildType.add(2);
117 115 patientsQuery1.setBuildTypeList(buildType);
... ... @@ -135,7 +133,6 @@
135 133 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("操作成功.");
136 134 }
137 135  
138   -
139 136 private class SupplyCheckTicketThread extends Thread {
140 137 private List<Patients> patientses;
141 138  
... ... @@ -162,7 +159,7 @@
162 159  
163 160 private void doBiz(PatientCheckTicketQuery checkTicketQuery, Patients p) {
164 161 if (0 == checkTicketServicel.queryTicketCount(checkTicketQuery)) {
165   - //建档成功后,给孕妇造五个条形码
  162 + // 建档成功后,给孕妇造五个条形码
166 163 Organization organization = organizationService.getOrganization(Integer.valueOf(p.getHospitalId()));
167 164 if (null != organization) {
168 165 AreaCodeQuery areaCodeQuery = new AreaCodeQuery();
169 166  
... ... @@ -176,14 +173,14 @@
176 173 if (null != areaCode && StringUtils.isNotEmpty(areaCode.getAreaCode())) {
177 174 String ticketPid = null;
178 175 int index = 0;
179   - //重试3次获取劵,取不到就失败
  176 + // 重试3次获取劵,取不到就失败
180 177 do {
181 178 index++;
182 179 ticketPid = autoIncermentService.nextPatientTicketId(areaCode.getAreaCode());
183 180 } while (StringUtils.isEmpty(ticketPid) && index < 3);
184 181  
185 182 if (StringUtils.isEmpty(ticketPid)) {
186   - ExceptionUtils.catchException(null, "补发产检劵失败.id : "+p.getId());
  183 + ExceptionUtils.catchException(null, "补发产检劵失败.id : " + p.getId());
187 184 return;
188 185 }
189 186 // 建档成功后,给孕妇造五个条形码
190 187  
... ... @@ -202,10 +199,9 @@
202 199 }
203 200 }
204 201  
205   -
206 202 /**
207 203 * 获取当前月经从第几期开始补发
208   - *
  204 + *
209 205 * @param lastMess
210 206 * @return
211 207 */