Commit 1f9610c59a1999e099cf5a9505488c1f6920dc56
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
# Conflicts: # platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
Showing 2 changed files
platform-job-index/src/main/java/com/lyms/platform/job/index/service/SyncDataService.java
View file @
1f9610c
| ... | ... | @@ -320,7 +320,9 @@ |
| 320 | 320 | type = 3; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - patients.setDueDate(DateUtil.addDay(DataUtil.getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7)); | |
| 323 | + Date dueDate = DateUtil.addDay(DateUtil.addMonth(DataUtil.getDate(map.get("P_LASTMENSTRUALPERIOD")), 9), 7); | |
| 324 | + | |
| 325 | + patients.setDueDate(dueDate); | |
| 324 | 326 | person.setCreated(new Date()); |
| 325 | 327 | |
| 326 | 328 | person.setId(String.valueOf(map.get("PID"))); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
1f9610c
| ... | ... | @@ -4,10 +4,14 @@ |
| 4 | 4 | import com.lyms.platform.biz.JdbcUtil; |
| 5 | 5 | import com.lyms.platform.biz.service.AssayConfigService; |
| 6 | 6 | import com.lyms.platform.biz.service.PatientsService; |
| 7 | -import com.lyms.platform.biz.service.SieveService; | |
| 7 | +import com.lyms.platform.common.enums.YnEnums; | |
| 8 | +import com.lyms.platform.common.utils.DateUtil; | |
| 8 | 9 | import com.lyms.platform.common.utils.JsonUtil; |
| 9 | 10 | import com.lyms.platform.operate.web.service.SyncDataTaskService; |
| 10 | 11 | import com.lyms.platform.pojo.AssayConfig; |
| 12 | +import com.lyms.platform.pojo.Patients; | |
| 13 | +import com.lyms.platform.query.PatientsQuery; | |
| 14 | +import org.apache.commons.collections.CollectionUtils; | |
| 11 | 15 | import org.apache.commons.io.FileUtils; |
| 12 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 17 | import org.springframework.data.mongodb.core.MongoTemplate; |
| ... | ... | @@ -19,10 +23,8 @@ |
| 19 | 23 | |
| 20 | 24 | import java.io.File; |
| 21 | 25 | import java.io.IOException; |
| 22 | -import java.util.ArrayList; | |
| 23 | -import java.util.HashMap; | |
| 24 | -import java.util.List; | |
| 25 | -import java.util.Map; | |
| 26 | +import java.text.CollationElementIterator; | |
| 27 | +import java.util.*; | |
| 26 | 28 | |
| 27 | 29 | /** |
| 28 | 30 | * Created by Zhang.Rui on 2016/4/8. |
| ... | ... | @@ -33,7 +35,7 @@ |
| 33 | 35 | |
| 34 | 36 | |
| 35 | 37 | @Autowired |
| 36 | - private MongoTemplate mongoTemplate; | |
| 38 | + private MongoTemplate mongoTemplate; | |
| 37 | 39 | |
| 38 | 40 | @Autowired |
| 39 | 41 | private PatientsService patientsService; |
| ... | ... | @@ -43,8 +45,6 @@ |
| 43 | 45 | |
| 44 | 46 | @Autowired |
| 45 | 47 | private SyncDataTaskService syncDataTaskService; |
| 46 | - @Autowired | |
| 47 | - private SieveService sieveService; | |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * 获取科室 |
| ... | ... | @@ -53,7 +53,7 @@ |
| 53 | 53 | @ResponseBody |
| 54 | 54 | public List getDepartment() { |
| 55 | 55 | List<Object> list = new ArrayList<>(); |
| 56 | - Map<String, String> m = new HashMap<>(); | |
| 56 | + Map<String, String> m = new HashMap<>(); | |
| 57 | 57 | |
| 58 | 58 | m = new HashMap<>(); |
| 59 | 59 | m.put("id", String.valueOf(1)); |
| ... | ... | @@ -86,7 +86,7 @@ |
| 86 | 86 | @ResponseBody |
| 87 | 87 | public List getSampleTypeEnum() { |
| 88 | 88 | List<Object> list = new ArrayList<>(); |
| 89 | - Map<String, String> m = new HashMap<>(); | |
| 89 | + Map<String, String> m = new HashMap<>(); | |
| 90 | 90 | |
| 91 | 91 | m = new HashMap<>(); |
| 92 | 92 | m.put("id", String.valueOf(1)); |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | |
| ... | ... | @@ -117,52 +117,49 @@ |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
| 120 | - @RequestMapping(value = "/syncData", method = RequestMethod.GET) | |
| 121 | - @ResponseBody | |
| 122 | - public String syncData(@RequestParam(required = true) final String oracleHid, @RequestParam(required = true) final Integer mysqlHid) { | |
| 123 | - final MongoTemplate template = mongoTemplate; | |
| 120 | +// @RequestMapping(value = "/syncData", method = RequestMethod.GET) | |
| 121 | +// @ResponseBody | |
| 122 | +// public String syncData(@RequestParam(required = true) final String oracleHid,@RequestParam(required = true) final Integer mysqlHid) { | |
| 123 | +// final MongoTemplate template = mongoTemplate; | |
| 124 | +// | |
| 125 | +// JdbcUtil.initData(mysqlHid); | |
| 126 | +// System.out.println("initData------"); | |
| 127 | +// | |
| 128 | +// new Thread(new Runnable() { | |
| 129 | +// @Override | |
| 130 | +// public void run() { | |
| 131 | +// System.out.print("同步开始儿童>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 132 | +// JdbcUtil.syncDataBaby(oracleHid, template); | |
| 133 | +// System.out.print("同步结束儿童>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 134 | +// } | |
| 135 | +// }).start(); | |
| 136 | +// | |
| 137 | +// | |
| 138 | +//// System.out.println("同步开始孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 139 | +//// JdbcUtil.syncDataPat(oracleHid, template); | |
| 140 | +//// System.out.println("同步结束孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 141 | +// return "starting..........."; | |
| 142 | +// } | |
| 124 | 143 | |
| 125 | - JdbcUtil.initData(mysqlHid); | |
| 126 | - System.out.println("initData------"); | |
| 127 | 144 | |
| 128 | - new Thread(new Runnable() { | |
| 129 | - @Override | |
| 130 | - public void run() { | |
| 131 | - System.out.print("同步开始儿童>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 132 | - JdbcUtil.syncDataBaby(oracleHid, template); | |
| 133 | - System.out.print("同步结束儿童>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 134 | - } | |
| 135 | - }).start(); | |
| 136 | - | |
| 137 | - | |
| 138 | -// System.out.println("同步开始孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 139 | -// JdbcUtil.syncDataPat(oracleHid, template); | |
| 140 | -// System.out.println("同步结束孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
| 141 | - return "starting..........."; | |
| 142 | - } | |
| 143 | - | |
| 144 | - | |
| 145 | 145 | @RequestMapping(value = "/addSieveJob", method = RequestMethod.GET) |
| 146 | 146 | @ResponseBody |
| 147 | 147 | public String addSieveJob() { |
| 148 | - patientsService.addSieveJob(); | |
| 149 | - ; | |
| 148 | + patientsService.addSieveJob();; | |
| 150 | 149 | return "finish"; |
| 151 | 150 | } |
| 152 | 151 | |
| 153 | 152 | @RequestMapping(value = "/autoMatDeliver", method = RequestMethod.GET) |
| 154 | 153 | @ResponseBody |
| 155 | 154 | public String autoMatDeliver() { |
| 156 | - patientsService.autoMatDeliver(); | |
| 157 | - ; | |
| 155 | + patientsService.autoMatDeliver();; | |
| 158 | 156 | return "finish"; |
| 159 | 157 | } |
| 160 | 158 | |
| 161 | 159 | @RequestMapping(value = "/delSieve", method = RequestMethod.GET) |
| 162 | 160 | @ResponseBody |
| 163 | 161 | public String delSieve() { |
| 164 | - patientsService.delSieve(); | |
| 165 | - ; | |
| 162 | + patientsService.delSieve();; | |
| 166 | 163 | return "finish"; |
| 167 | 164 | } |
| 168 | 165 | |
| ... | ... | @@ -181,7 +178,7 @@ |
| 181 | 178 | public String assayconfiginit(String json) { |
| 182 | 179 | try { |
| 183 | 180 | List<AssayConfig> list = JsonUtil.toList(json, AssayConfig.class); |
| 184 | - for (AssayConfig config : list) { | |
| 181 | + for (AssayConfig config:list) { | |
| 185 | 182 | assayConfigService.save(config); |
| 186 | 183 | } |
| 187 | 184 | } catch (Exception e) { |
| ... | ... | @@ -194,7 +191,7 @@ |
| 194 | 191 | try { |
| 195 | 192 | String json = FileUtils.readFileToString(new File("d:/assayconfig.json")); |
| 196 | 193 | List<AssayConfig> list = JsonUtil.toList(json, AssayConfig.class); |
| 197 | - for (AssayConfig config : list) { | |
| 194 | + for (AssayConfig config:list) { | |
| 198 | 195 | System.out.println(JsonUtil.obj2JsonString(config)); |
| 199 | 196 | } |
| 200 | 197 | } catch (IOException e) { |
| 201 | 198 | |
| 202 | 199 | |
| ... | ... | @@ -237,11 +234,39 @@ |
| 237 | 234 | return "syncQhdSieve finish"; |
| 238 | 235 | } |
| 239 | 236 | |
| 240 | - @RequestMapping(value = "/execsieveorder", method = RequestMethod.GET) | |
| 237 | + /** | |
| 238 | + * 更新医院的孕妇的建档的预产期 | |
| 239 | + * @param hospitalId | |
| 240 | + * @return | |
| 241 | + */ | |
| 242 | + @RequestMapping(value = "/updateDueDate", method = RequestMethod.GET) | |
| 241 | 243 | @ResponseBody |
| 242 | - public String sieveOrder() { | |
| 243 | - sieveService.correctSieveOrder(); | |
| 244 | - return "sieveOrder finish"; | |
| 244 | + public String updateDueDate(@RequestParam(required = true) String hospitalId) { | |
| 245 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 246 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 247 | + patientsQuery1.setHospitalId(hospitalId); | |
| 248 | + List<Patients> pats = patientsService.queryPatient(patientsQuery1); | |
| 249 | + if (CollectionUtils.isNotEmpty(pats)) | |
| 250 | + { | |
| 251 | + for (Patients pat : pats) | |
| 252 | + { | |
| 253 | + if (pat != null && pat.getLastMenses() != null) | |
| 254 | + { | |
| 255 | + Date dueDate = DateUtil.addDay(DateUtil.addMonth(pat.getLastMenses(), 9), 7); | |
| 256 | + if (!DateUtil.getyyyy_MM_dd(dueDate).equals(DateUtil.getyyyy_MM_dd(pat.getDueDate()))) | |
| 257 | + { | |
| 258 | + System.out.println(pat.getPhone()); | |
| 259 | + pat.setDueDate(dueDate); | |
| 260 | + patientsService.updatePatient(pat); | |
| 261 | + } | |
| 262 | + | |
| 263 | + } | |
| 264 | + | |
| 265 | + } | |
| 266 | + } | |
| 267 | + | |
| 268 | + return "update finish"; | |
| 245 | 269 | } |
| 270 | + | |
| 246 | 271 | } |