Commit 15a1b32534cbfd4826ddc06ba36288210edd9ec8
1 parent
3c9a461e3a
Exists in
master
and in
6 other branches
优化没筛选条件的时候
Showing 2 changed files with 39 additions and 33 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TempFacade.java
View file @
15a1b32
... | ... | @@ -127,45 +127,47 @@ |
127 | 127 | |
128 | 128 | public BaseResponse findTempDataList(TempQueryRequest queryRequest, Integer userId) { |
129 | 129 | List<String> hospital = groupsFacade.findGroupHospital(userId, false); |
130 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
131 | - patientsQuery.setCardNo(queryRequest.getCardNo()); | |
132 | - patientsQuery.setVcCardNo(queryRequest.getVcCardNo()); | |
133 | - patientsQuery.setHospitalList(hospital); | |
134 | - patientsQuery.setLastMensesStart(queryRequest.capEnd()); | |
135 | - patientsQuery.setLastMensesEnd(queryRequest.capStart()); | |
136 | - patientsQuery.setExtEnable(false); | |
137 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
138 | - patientsQuery.setType(1); | |
139 | - Date currentDate = DateUtil.formatDate(new Date()); | |
140 | - if (null != queryRequest.getStartAge()) { | |
141 | - Date date = DateUtil.addYear(currentDate, -queryRequest.getStartAge()); | |
142 | - patientsQuery.setBirthEnd(date); | |
143 | - } | |
144 | - if (null != queryRequest.getEndAge()) { | |
145 | - Date date = DateUtil.addYear(currentDate, -queryRequest.getEndAge()); | |
146 | - date = DateUtil.addYear(date, -1); | |
130 | + TempQuery tempQuery = new TempQuery(); | |
131 | + if(queryRequest.hasParam()){ | |
132 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
133 | + patientsQuery.setCardNo(queryRequest.getCardNo()); | |
134 | + patientsQuery.setVcCardNo(queryRequest.getVcCardNo()); | |
135 | + patientsQuery.setHospitalList(hospital); | |
136 | + patientsQuery.setLastMensesStart(queryRequest.capEnd()); | |
137 | + patientsQuery.setLastMensesEnd(queryRequest.capStart()); | |
138 | + patientsQuery.setExtEnable(false); | |
139 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
140 | + patientsQuery.setType(1); | |
141 | + Date currentDate = DateUtil.formatDate(new Date()); | |
142 | + if (null != queryRequest.getStartAge()) { | |
143 | + Date date = DateUtil.addYear(currentDate, -queryRequest.getStartAge()); | |
144 | + patientsQuery.setBirthEnd(date); | |
145 | + } | |
146 | + if (null != queryRequest.getEndAge()) { | |
147 | + Date date = DateUtil.addYear(currentDate, -queryRequest.getEndAge()); | |
148 | + date = DateUtil.addYear(date, -1); | |
147 | 149 | |
148 | - patientsQuery.setBirthStart(DateUtil.addDay(date, 1)); | |
149 | - } | |
150 | + patientsQuery.setBirthStart(DateUtil.addDay(date, 1)); | |
151 | + } | |
150 | 152 | |
151 | - List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
152 | - if (CollectionUtils.isEmpty(patientses)) { | |
153 | - return new BaseListResponse().setData(new ArrayList()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
154 | - } | |
155 | - List<String> pids = new ArrayList<>(); | |
156 | - for (Patients patients : patientses) { | |
157 | - if (StringUtils.isNotEmpty(patients.getPid())) { | |
158 | - pids.add(patients.getPid()); | |
153 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
154 | + if (CollectionUtils.isEmpty(patientses)) { | |
155 | + return new BaseListResponse().setData(new ArrayList()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
159 | 156 | } |
157 | + List<String> pids = new ArrayList<>(); | |
158 | + for (Patients patients : patientses) { | |
159 | + if (StringUtils.isNotEmpty(patients.getPid())) { | |
160 | + pids.add(patients.getPid()); | |
161 | + } | |
162 | + } | |
163 | + tempQuery.setpIds(pids); | |
160 | 164 | } |
161 | 165 | |
162 | - TempQuery tempQuery = new TempQuery(); | |
163 | 166 | tempQuery.setYn(YnEnums.YES.getId()); |
164 | - tempQuery.setpIds(pids); | |
167 | + | |
165 | 168 | tempQuery.setPage(queryRequest.getPage()); |
166 | 169 | tempQuery.setLimit(queryRequest.getLimit()); |
167 | 170 | tempQuery.setNeed("1"); |
168 | - | |
169 | 171 | tempQuery.setHospitalList(hospital); |
170 | 172 | |
171 | 173 | List<TempModel> temp = tempService.queryTemp(tempQuery); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TempQueryRequest.java
View file @
15a1b32
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | * @since BME V100R001C40B104 |
23 | 23 | */ |
24 | 24 | @Form |
25 | -public class TempQueryRequest extends BasePageQueryRequest{ | |
25 | +public class TempQueryRequest extends BasePageQueryRequest { | |
26 | 26 | @FormParam |
27 | 27 | private String vcCardNo; |
28 | 28 | @FormParam |
... | ... | @@ -45,6 +45,10 @@ |
45 | 45 | return null; |
46 | 46 | } |
47 | 47 | |
48 | + public boolean hasParam() { | |
49 | + return StringUtils.isNotEmpty(vcCardNo) || StringUtils.isNotEmpty(cardNo) || StringUtils.isNotEmpty(startDueWeek) || StringUtils.isNotEmpty(endDueWeek) || null != startAge || null != endAge; | |
50 | + } | |
51 | + | |
48 | 52 | public Date capEnd() { |
49 | 53 | if (StringUtils.isNotEmpty(endDueWeek)) { |
50 | 54 | int end = NumberUtils.toInt(endDueWeek, 0); |
... | ... | @@ -55,7 +59,7 @@ |
55 | 59 | } |
56 | 60 | |
57 | 61 | public String getVcCardNo() { |
58 | - if(org.apache.commons.lang.StringUtils.isBlank(vcCardNo)){ | |
62 | + if (org.apache.commons.lang.StringUtils.isBlank(vcCardNo)) { | |
59 | 63 | return null; |
60 | 64 | } |
61 | 65 | return vcCardNo; |
... | ... | @@ -66,7 +70,7 @@ |
66 | 70 | } |
67 | 71 | |
68 | 72 | public String getCardNo() { |
69 | - if(org.apache.commons.lang.StringUtils.isBlank(cardNo)){ | |
73 | + if (org.apache.commons.lang.StringUtils.isBlank(cardNo)) { | |
70 | 74 | return null; |
71 | 75 | } |
72 | 76 | return cardNo; |