Commit d85a1848c116536485bb746be25cb76f101dc04a
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 1 changed file
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
d85a184
... | ... | @@ -56,6 +56,7 @@ |
56 | 56 | import org.springframework.web.bind.annotation.*; |
57 | 57 | |
58 | 58 | import javax.servlet.http.HttpServletRequest; |
59 | +import javax.servlet.http.HttpServletResponse; | |
59 | 60 | import javax.validation.Valid; |
60 | 61 | import java.io.File; |
61 | 62 | import java.io.IOException; |
... | ... | @@ -3166,6 +3167,66 @@ |
3166 | 3167 | } |
3167 | 3168 | } |
3168 | 3169 | } |
3170 | + } | |
3171 | + | |
3172 | + | |
3173 | + @RequestMapping(value = "/service/handle", method = RequestMethod.GET) | |
3174 | + public void serviceHandle(HttpServletResponse response) { | |
3175 | + new Thread(new Runnable() { | |
3176 | + @Override | |
3177 | + public void run() { | |
3178 | + int page = 1; | |
3179 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
3180 | + patientQuery.setSort(" create_date desc "); | |
3181 | + patientQuery.setNeed("y"); | |
3182 | + patientQuery.setPerType(1); | |
3183 | + patientQuery.setLimit(1000); | |
3184 | + | |
3185 | + while (true) | |
3186 | + { | |
3187 | + System.out.println("page index " + page); | |
3188 | + patientQuery.setPage(page); | |
3189 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
3190 | + if (CollectionUtils.isEmpty(patientServices)) | |
3191 | + { | |
3192 | + System.out.println("service break ............ "); | |
3193 | + break; | |
3194 | + } | |
3195 | + else | |
3196 | + { | |
3197 | + for (PatientService patientService : patientServices) | |
3198 | + { | |
3199 | + if (patientService.getSerStatus() != null && patientService.getSerStatus() == 1 && patientService.getServiceWeek() == null && patientService.getParentid() != null) | |
3200 | + { | |
3201 | + System.out.println("service record id " + patientService.getId()); | |
3202 | + | |
3203 | + Patients patients = patientsService.findOnePatientById(patientService.getParentid()); | |
3204 | + if (patients != null && patients.getLastMenses() != null) | |
3205 | + { | |
3206 | + patientService.setSerStartTime(patients.getLastMenses()); | |
3207 | + patientService.setSerEndTime(DateUtil.addWeek(patients.getLastMenses(),42)); | |
3208 | + patientService.setSerStartWeek(0); | |
3209 | + patientService.setSerEndWeek(42); | |
3210 | + patientService.setServiceWeek(42); | |
3211 | + if (StringUtils.isNotEmpty(patientService.getSerDoct())) | |
3212 | + { | |
3213 | + patientService.setDoctorWeek(42); | |
3214 | + patientService.setDocStartWeek(0); | |
3215 | + patientService.setDocEndWeek(42); | |
3216 | + | |
3217 | + patientService.setDocEndTime(DateUtil.addWeek(patients.getLastMenses(),42)); | |
3218 | + patientService.setDocStartTime(patients.getLastMenses()); | |
3219 | + } | |
3220 | + System.out.println("update service id " + patientService.getId()); | |
3221 | + patientServiceService.updatePatientService(patientService); | |
3222 | + } | |
3223 | + } | |
3224 | + } | |
3225 | + } | |
3226 | + page++; | |
3227 | + } | |
3228 | + } | |
3229 | + }).start(); | |
3169 | 3230 | } |
3170 | 3231 | |
3171 | 3232 | } |