Commit f3df7712a8e22bbab6f50968d2465f4b4eada89d
1 parent
eb76fd291c
Exists in
master
and in
7 other branches
修改数据
Showing 1 changed file with 72 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
f3df771
... | ... | @@ -76,6 +76,7 @@ |
76 | 76 | |
77 | 77 | @Autowired |
78 | 78 | private BabyCheckFacade babyCheckFacade; |
79 | +; | |
79 | 80 | |
80 | 81 | /** |
81 | 82 | * 获取科室 |
... | ... | @@ -870,6 +871,77 @@ |
870 | 871 | |
871 | 872 | |
872 | 873 | return "updateBabyGrowth finish"; |
874 | + } | |
875 | + | |
876 | + | |
877 | + /** | |
878 | + * 修正儿童助产机构 | |
879 | + * @param hid | |
880 | + * @return | |
881 | + */ | |
882 | + @RequestMapping(value = "/updateBabyFmHospital", method = RequestMethod.GET) | |
883 | + @ResponseBody | |
884 | + public String updateBabyFmHospital(@RequestParam(required = true) String hid) { | |
885 | + | |
886 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
887 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
888 | + babyModelQuery.setHospitalId(hid); | |
889 | + | |
890 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
891 | + if (CollectionUtils.isNotEmpty(models)) | |
892 | + { | |
893 | + int batchSize = 200; | |
894 | + int end = 0; | |
895 | + for (int i = 0; i < models.size(); i += batchSize) { | |
896 | + end = (end + batchSize); | |
897 | + if (end > models.size()) { | |
898 | + end = models.size(); | |
899 | + } | |
900 | + System.out.println("start:" + i + ",end:" + end); | |
901 | + final List<BabyModel> tempList = models.subList(i, end); | |
902 | + new Thread(new Runnable() { | |
903 | + @Override | |
904 | + public void run() { | |
905 | + if (CollectionUtils.isNotEmpty(tempList)) | |
906 | + { | |
907 | + for (BabyModel babyModel : tempList) { | |
908 | + if (babyModel != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(babyModel.getMcertNo())) | |
909 | + { | |
910 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
911 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
912 | + patientsQuery.setType(3); | |
913 | + patientsQuery.setCardNo(babyModel.getMcertNo()); | |
914 | + List<Patients> patients = patientsService.queryPatient(patientsQuery); | |
915 | + if (CollectionUtils.isNotEmpty(patients)) | |
916 | + { | |
917 | + for(Patients pat : patients) | |
918 | + { | |
919 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
920 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
921 | + matDeliverQuery.setParentId(pat.getId()); | |
922 | + List<MaternalDeliverModel> lists = matDeliverService.query(matDeliverQuery); | |
923 | + if (CollectionUtils.isNotEmpty(lists)) | |
924 | + { | |
925 | + if (lists.get(0) != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(lists.get(0).getFmHospital())) | |
926 | + { | |
927 | + babyModel.setDeliverOrg(lists.get(0).getFmHospital()); | |
928 | + babyBookbuildingService.updateBabyBuild(babyModel,babyModel.getId()); | |
929 | + break; | |
930 | + } | |
931 | + } | |
932 | + } | |
933 | + } | |
934 | + } | |
935 | + } | |
936 | + } | |
937 | + } | |
938 | + }).start(); | |
939 | + } | |
940 | + | |
941 | + } | |
942 | + | |
943 | + | |
944 | + return "updateBabyFmHospital finish"; | |
873 | 945 | } |
874 | 946 | |
875 | 947 | public static void main(String[] a) { |