Commit bbb9a0aa910bf4ded6b093b72e1d11974296888d
1 parent
60279cfb3c
Exists in
master
and in
1 other branch
update
Showing 8 changed files with 115 additions and 5 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/LymsEncodeUtil.java
- platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java
- platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CdGwController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ResidentsArchiveController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
- platform-operate-api/src/main/resources/config.properties
platform-common/src/main/java/com/lyms/platform/common/utils/LymsEncodeUtil.java
View file @
bbb9a0a
platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java
View file @
bbb9a0a
| ... | ... | @@ -202,6 +202,17 @@ |
| 202 | 202 | |
| 203 | 203 | private FilePathModel filePath; |
| 204 | 204 | |
| 205 | + //1 未同步 2已经同步 | |
| 206 | + private Integer isSync; | |
| 207 | + | |
| 208 | + public Integer getIsSync() { | |
| 209 | + return isSync; | |
| 210 | + } | |
| 211 | + | |
| 212 | + public void setIsSync(Integer isSync) { | |
| 213 | + this.isSync = isSync; | |
| 214 | + } | |
| 215 | + | |
| 205 | 216 | public FilePathModel getFilePath() { |
| 206 | 217 | return filePath; |
| 207 | 218 | } |
platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java
View file @
bbb9a0a
| ... | ... | @@ -149,6 +149,11 @@ |
| 149 | 149 | //大于创建时间 |
| 150 | 150 | private Date gteCreated; |
| 151 | 151 | |
| 152 | + //1 未同步 2已经同步 | |
| 153 | + private Integer isSync; | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 152 | 157 | @Override |
| 153 | 158 | public MongoQuery convertToQuery() { |
| 154 | 159 | MongoCondition condition = MongoCondition.newInstance(); |
| ... | ... | @@ -240,6 +245,9 @@ |
| 240 | 245 | if (yn != null) { |
| 241 | 246 | condition = condition.and("yn", yn, MongoOper.IS); |
| 242 | 247 | } |
| 248 | + if (isSync != null) { | |
| 249 | + condition = condition.and("isSync", isSync, MongoOper.IS); | |
| 250 | + } | |
| 243 | 251 | if (created != null) { |
| 244 | 252 | condition = condition.and("created", created, MongoOper.IS); |
| 245 | 253 | } |
| ... | ... | @@ -362,6 +370,14 @@ |
| 362 | 370 | |
| 363 | 371 | //0 或者空不是 1是 |
| 364 | 372 | private Integer hasHj; |
| 373 | + | |
| 374 | + public Integer getIsSync() { | |
| 375 | + return isSync; | |
| 376 | + } | |
| 377 | + | |
| 378 | + public void setIsSync(Integer isSync) { | |
| 379 | + this.isSync = isSync; | |
| 380 | + } | |
| 365 | 381 | |
| 366 | 382 | public Date getGteModified() { |
| 367 | 383 | return gteModified; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CdGwController.java
View file @
bbb9a0a
| ... | ... | @@ -129,5 +129,39 @@ |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| 132 | + @ResponseBody | |
| 133 | + @RequestMapping(value = "/sync/test",method = RequestMethod.GET) | |
| 134 | + private BaseResponse test(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String typeStr){ | |
| 135 | + System.out.printf("start = %s , end = %s , typeStr = %s", startTime, endTime, typeStr); | |
| 136 | + if ("saveYf".equals(typeStr)) { | |
| 137 | + return cdGwInterface.saveYf(startTime, endTime); | |
| 138 | + } | |
| 139 | + if ("saveChuZhen".equals(typeStr)) { | |
| 140 | + return cdGwInterface.saveChuZhen(startTime, endTime); | |
| 141 | + } | |
| 142 | + if ("saveFuZhen".equals(typeStr)) { | |
| 143 | + return cdGwInterface.saveFuZhen(startTime, endTime); | |
| 144 | + } | |
| 145 | + if ("saveFm".equals(typeStr)) { | |
| 146 | + return cdGwInterface.saveFm(startTime, endTime); | |
| 147 | + } | |
| 148 | + if ("saveChFs".equals(typeStr)) { | |
| 149 | + return cdGwInterface.saveChFs(startTime, endTime); | |
| 150 | + } | |
| 151 | + if ("saveEtDa".equals(typeStr)) { | |
| 152 | + return cdGwInterface.saveEtDa(startTime, endTime); | |
| 153 | + } | |
| 154 | + if ("saveXsrFs".equals(typeStr)) { | |
| 155 | + return cdGwInterface.saveXsrFs(startTime, endTime); | |
| 156 | + } | |
| 157 | + if ("saveEb".equals(typeStr)) { | |
| 158 | + return cdGwInterface.saveEb(startTime, endTime); | |
| 159 | + } | |
| 160 | + if ("all".equals(typeStr)) { | |
| 161 | + return cdGwInterface.testAll(startTime, endTime); | |
| 162 | + } | |
| 163 | + return new BaseResponse(); | |
| 164 | + } | |
| 165 | + | |
| 132 | 166 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ResidentsArchiveController.java
View file @
bbb9a0a
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import com.lyms.platform.operate.web.request.ResidentsArchiveAddRequest; |
| 12 | 12 | import com.lyms.platform.operate.web.request.ResidentsArchiveQueryRequest; |
| 13 | 13 | import com.lyms.platform.operate.web.request.WomenGuideSmsRequest; |
| 14 | +import com.lyms.platform.pojo.ResidentsArchiveModel; | |
| 14 | 15 | import org.apache.commons.lang.StringUtils; |
| 15 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 17 | import org.springframework.stereotype.Controller; |
| ... | ... | @@ -80,7 +81,7 @@ |
| 80 | 81 | param.setVcCardNo(vcCardNo); |
| 81 | 82 | param.setCertificateTypeId(certificateTypeId); |
| 82 | 83 | param.setCardNo(cardNo); |
| 83 | - return residentsArchiveFacade.queryResidentsArchiveNewZufy(param , loginState.getId()); | |
| 84 | + return residentsArchiveFacade.queryResidentsArchiveNewZufy(param, loginState.getId()); | |
| 84 | 85 | } |
| 85 | 86 | /** |
| 86 | 87 | * 通过证件号,就诊卡号查询居民建档信息,优先返回本院 |
| ... | ... | @@ -176,7 +177,7 @@ |
| 176 | 177 | @TokenRequired |
| 177 | 178 | public BaseResponse queryAllResidents(@Valid ResidentsArchiveQueryRequest residentsArchiveQueryRequest,HttpServletRequest request) { |
| 178 | 179 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 179 | - return residentsArchiveFacade.queryResidentsArchives(residentsArchiveQueryRequest,loginState.getId(),"true"); | |
| 180 | + return residentsArchiveFacade.queryResidentsArchives(residentsArchiveQueryRequest, loginState.getId(), "true"); | |
| 180 | 181 | } |
| 181 | 182 | |
| 182 | 183 | //返回证件类型Blood type |
| ... | ... | @@ -234,7 +235,22 @@ |
| 234 | 235 | public BaseResponse deleteArchive(@RequestParam("id") String id, |
| 235 | 236 | HttpServletRequest request) { |
| 236 | 237 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 237 | - return residentsArchiveFacade.deleteArchive(id,loginState.getId()); | |
| 238 | + return residentsArchiveFacade.deleteArchive(id, loginState.getId()); | |
| 239 | + } | |
| 240 | + | |
| 241 | + | |
| 242 | + @RequestMapping(method = RequestMethod.POST, value = "/syncResidentsArchive") | |
| 243 | + @ResponseBody | |
| 244 | + public BaseResponse syncResidentsArchive(@RequestBody ResidentsArchiveModel addRequest, | |
| 245 | + HttpServletRequest request) { | |
| 246 | + return residentsArchiveFacade.syncResidentsArchive(addRequest); | |
| 247 | + } | |
| 248 | + | |
| 249 | + @RequestMapping(method = RequestMethod.GET, value = "/doSyncResidentsArchive") | |
| 250 | + @ResponseBody | |
| 251 | + public BaseResponse doSyncResidentsArchive( | |
| 252 | + HttpServletRequest request) { | |
| 253 | + return residentsArchiveFacade.doSyncResidentsArchive(); | |
| 238 | 254 | } |
| 239 | 255 | |
| 240 | 256 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java
View file @
bbb9a0a
| ... | ... | @@ -1466,6 +1466,7 @@ |
| 1466 | 1466 | while (true) |
| 1467 | 1467 | { |
| 1468 | 1468 | antExQuery.setPage(page); |
| 1469 | + System.out.println("syncAntexToMysql" + page); | |
| 1469 | 1470 | List <AntenatalExaminationModel> antexs = antenatalExaminationService.queryLastAntenx(antExQuery); |
| 1470 | 1471 | if (CollectionUtils.isEmpty(antexs)) |
| 1471 | 1472 | { |
| ... | ... | @@ -1550,6 +1551,7 @@ |
| 1550 | 1551 | while (true) |
| 1551 | 1552 | { |
| 1552 | 1553 | matDeliverQuery.setPage(page); |
| 1554 | + System.out.println("syncMatdeliverToMysql" + page); | |
| 1553 | 1555 | List <MaternalDeliverModel> maternalDeliverModels = matDeliverService.pageQuery(matDeliverQuery); |
| 1554 | 1556 | if (CollectionUtils.isEmpty(maternalDeliverModels)) |
| 1555 | 1557 | { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
View file @
bbb9a0a
| ... | ... | @@ -458,6 +458,7 @@ |
| 458 | 458 | archiveModel.setYn(YnEnums.YES.getId()); |
| 459 | 459 | archiveModel.setCreated(now); |
| 460 | 460 | archiveModel.setModified(now); |
| 461 | + archiveModel.setIsSync(1); | |
| 461 | 462 | |
| 462 | 463 | archiveModel.setPublishId(String.valueOf(userId)); |
| 463 | 464 | Users users = usersService.getUsers(userId); |
| ... | ... | @@ -1206,5 +1207,32 @@ |
| 1206 | 1207 | } |
| 1207 | 1208 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 1208 | 1209 | } |
| 1210 | + | |
| 1211 | + public BaseResponse syncResidentsArchive(ResidentsArchiveModel addRequest) { | |
| 1212 | + addRequest.setModified(new Date()); | |
| 1213 | + residentsArchiveService.addResident(addRequest); | |
| 1214 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 1215 | + } | |
| 1216 | + | |
| 1217 | + public BaseResponse doSyncResidentsArchive() { | |
| 1218 | + | |
| 1219 | + ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); | |
| 1220 | + archiveQuery.setIsSync(1); | |
| 1221 | + List<ResidentsArchiveModel> archiveModelList = residentsArchiveService.queryResident(archiveQuery); | |
| 1222 | + if (CollectionUtils.isNotEmpty(archiveModelList)) | |
| 1223 | + { | |
| 1224 | + for (ResidentsArchiveModel model : archiveModelList) | |
| 1225 | + { | |
| 1226 | + model.setIsSync(2); | |
| 1227 | + String syncRsult = HttpClientUtil.doPostSSL(AREA_URL+"/syncResidentsArchive",JsonUtil.obj2Str(model)); | |
| 1228 | + residentsArchiveService.updateResident(model,model.getId()); | |
| 1229 | + System.out.println("doSyncResidentsArchive=" + syncRsult); | |
| 1230 | + } | |
| 1231 | + } | |
| 1232 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 1233 | + } | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + public static final String AREA_URL = PropertiesUtils.getPropertyValue("area_url"); | |
| 1209 | 1237 | } |