Commit a62f204f7b97b940e620596cf1af2b2f740cff3d

Authored by liquanyu
1 parent bbb9a0aa91

update

Showing 12 changed files with 206 additions and 6 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/JsonUtil.java View file @ a62f204
... ... @@ -51,6 +51,17 @@
51 51 }
52 52 return null;
53 53 }
  54 + public static String obj2Str1(
  55 + Object cls) {
  56 + try {
  57 + ObjectMapper objectMapper = new ObjectMapper();
  58 + return objectMapper.writeValueAsString(cls);
  59 + } catch (Exception e) {
  60 +
  61 + }
  62 + return null;
  63 + }
  64 +
54 65  
55 66 @SuppressWarnings("unchecked")
56 67 public static <T> T str2Obj(String content,
platform-dal/src/main/java/com/lyms/platform/pojo/CancerScreeningModel.java View file @ a62f204
... ... @@ -205,6 +205,17 @@
205 205 //患者签名
206 206 private String patientSign;
207 207  
  208 + //1 未同步 2已经同步
  209 + private Integer isSync;
  210 +
  211 + public Integer getIsSync() {
  212 + return isSync;
  213 + }
  214 +
  215 + public void setIsSync(Integer isSync) {
  216 + this.isSync = isSync;
  217 + }
  218 +
208 219 public String getDoctorSign() {
209 220 return doctorSign;
210 221 }
platform-dal/src/main/java/com/lyms/platform/pojo/CervicalCancerModel.java View file @ a62f204
... ... @@ -97,6 +97,17 @@
97 97 //患者签名
98 98 private String patientSign;
99 99  
  100 + //1 未同步 2已经同步
  101 + private Integer isSync;
  102 +
  103 + public Integer getIsSync() {
  104 + return isSync;
  105 + }
  106 +
  107 + public void setIsSync(Integer isSync) {
  108 + this.isSync = isSync;
  109 + }
  110 +
100 111 public String getDoctorSign() {
101 112 return doctorSign;
102 113 }
platform-dal/src/main/java/com/lyms/platform/pojo/PremaritalCheckup.java View file @ a62f204
... ... @@ -458,6 +458,16 @@
458 458 //滦平婚检每个用户分配一个编号20200107-1 20200107-2
459 459 private Long numCode;
460 460  
  461 + //1 未同步 2已经同步
  462 + private Integer isSync;
  463 +
  464 + public Integer getIsSync() {
  465 + return isSync;
  466 + }
  467 +
  468 + public void setIsSync(Integer isSync) {
  469 + this.isSync = isSync;
  470 + }
461 471 public Long getNumCode() {
462 472 return numCode;
463 473 }
platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java View file @ a62f204
1 1 package com.lyms.platform.pojo;
2 2  
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
3 4 import com.lyms.platform.beans.SerialIdEnum;
4 5 import com.lyms.platform.common.enums.TrackDownDateEnums;
5 6 import com.lyms.platform.common.result.BaseModel;
... ... @@ -25,6 +26,7 @@
25 26 //性别
26 27 private String sex;
27 28 //出生日期
  29 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
28 30 private Date birthday;
29 31 //国籍
30 32 private String countryId;
... ... @@ -201,7 +203,6 @@
201 203  
202 204  
203 205 private FilePathModel filePath;
204   -
205 206 //1 未同步 2已经同步
206 207 private Integer isSync;
207 208  
platform-dal/src/main/java/com/lyms/platform/query/CancerScreeningQuery.java View file @ a62f204
... ... @@ -99,7 +99,10 @@
99 99 //最终诊断结果 1未见异常 2良性疾病 3不典型增生 4原位癌 5导管内乳头状癌 6微小浸润癌 7浸润癌 8其他恶性肿瘤
100 100 private String sfZhzd;
101 101  
  102 + //1 未同步 2已经同步
  103 + private Integer isSync;
102 104  
  105 +
103 106 /**
104 107 * @return
105 108 */
... ... @@ -114,6 +117,9 @@
114 117 if(null != yn){
115 118 condition=condition.and("yn", yn, MongoOper.IS);
116 119 }
  120 + if(null != isSync){
  121 + condition=condition.and("isSync", isSync, MongoOper.IS);
  122 + }
117 123  
118 124 if(null != ycRxajc ){
119 125 if("sz".equals(ycRxajc)){
... ... @@ -216,6 +222,13 @@
216 222 }
217 223  
218 224 return condition.toMongoQuery();
  225 + }
  226 + public Integer getIsSync() {
  227 + return isSync;
  228 + }
  229 +
  230 + public void setIsSync(Integer isSync) {
  231 + this.isSync = isSync;
219 232 }
220 233  
221 234  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CancerScreeningController.java View file @ a62f204
... ... @@ -8,6 +8,7 @@
8 8 import com.lyms.platform.operate.web.facade.CancerScreeningFacade;
9 9 import com.lyms.platform.operate.web.request.CancerScreeningRequest;
10 10 import com.lyms.platform.pojo.CancerScreeningModel;
  11 +import com.lyms.platform.pojo.ResidentsArchiveModel;
11 12 import org.springframework.beans.factory.annotation.Autowired;
12 13 import org.springframework.stereotype.Controller;
13 14 import org.springframework.web.bind.annotation.*;
... ... @@ -119,6 +120,21 @@
119 120 @RequestMapping(value = "/{id}", method = RequestMethod.GET)
120 121 public BaseResponse getAppInfo(@PathVariable String id) {
121 122 return cancerScreenService.getCancerScreenInfo(id);
  123 + }
  124 +
  125 +
  126 + @RequestMapping(method = RequestMethod.POST, value = "/syncCancerScreen")
  127 + @ResponseBody
  128 + public BaseResponse syncCancerScreen(@RequestBody CancerScreeningModel cancerScr,
  129 + HttpServletRequest request) {
  130 + return cancerScreenService.syncCancerScreen(cancerScr);
  131 + }
  132 +
  133 + @RequestMapping(method = RequestMethod.GET, value = "/doSyncCancerScreen")
  134 + @ResponseBody
  135 + public BaseResponse doSyncCancerScreen(
  136 + HttpServletRequest request) {
  137 + return cancerScreenService.doSyncCancerScreen();
122 138 }
123 139 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CervicalCancerController.java View file @ a62f204
... ... @@ -4,6 +4,8 @@
4 4 import javax.servlet.http.HttpServletResponse;
5 5  
6 6 import com.lyms.platform.operate.web.service.impl.CervicalCancerServiceImpl;
  7 +import com.lyms.platform.pojo.CancerScreeningModel;
  8 +import com.lyms.platform.pojo.CervicalCancerModel;
7 9 import org.springframework.beans.factory.annotation.Autowired;
8 10 import org.springframework.stereotype.Controller;
9 11 import org.springframework.web.bind.annotation.RequestBody;
... ... @@ -86,7 +88,7 @@
86 88 @ResponseBody
87 89 @TokenRequired
88 90 public BaseListResponse listPage(@JsonAlias CervicalCancerListRequest param,HttpServletRequest request) {
89   - return cervicalCancerService.listPage(param,getUserId(request));
  91 + return cervicalCancerService.listPage(param, getUserId(request));
90 92 }
91 93  
92 94 /**
... ... @@ -142,5 +144,19 @@
142 144 return cervicalCancerService.detail(param);
143 145 }
144 146  
  147 +
  148 + @RequestMapping(method = RequestMethod.POST, value = "/syncCervicalCancer")
  149 + @ResponseBody
  150 + public BaseResponse syncCervicalCancer(@RequestBody CervicalCancerModel cervicalCancer,
  151 + HttpServletRequest request) {
  152 + return cervicalCancerService.syncCervicalCancer(cervicalCancer);
  153 + }
  154 +
  155 + @RequestMapping(method = RequestMethod.GET, value = "/doSyncCervicalCancer")
  156 + @ResponseBody
  157 + public BaseResponse doSyncCancerScreen(
  158 + HttpServletRequest request) {
  159 + return cervicalCancerService.doSyncCervicalCancer();
  160 + }
145 161 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CancerScreeningFacade.java View file @ a62f204
... ... @@ -9,8 +9,7 @@
9 9 import com.lyms.platform.common.result.BaseObjectResponse;
10 10 import com.lyms.platform.common.result.BaseResponse;
11 11 import com.lyms.platform.common.result.RespBuilder;
12   -import com.lyms.platform.common.utils.DateUtil;
13   -import com.lyms.platform.common.utils.EnumUtil;
  12 +import com.lyms.platform.common.utils.*;
14 13 import com.lyms.platform.operate.web.request.CancerScreeningRequest;
15 14 import com.lyms.platform.operate.web.utils.CommonsHelper;
16 15 import com.lyms.platform.operate.web.utils.FunvCommonUtil;
... ... @@ -303,6 +302,7 @@
303 302 public BaseResponse updateCancerScreen(CancerScreeningModel cancerScr, Integer id) {
304 303 try {
305 304 cancerScr.setOperator(id);
  305 + cancerScr.setIsSync(1);
306 306 cancerScreenService.updateOneCancerScreen(cancerScr, cancerScr.getId());
307 307 return new BaseResponse("成功", ErrorCodeConstants.SUCCESS);
308 308 } catch (Exception e) {
... ... @@ -346,6 +346,8 @@
346 346 cancerScr.setOperator(id);
347 347 //有效
348 348 cancerScr.setYn(YnEnums.YES.getId());
  349 +
  350 + cancerScr.setIsSync(1);
349 351 cancerScreenService.addOneCancerScreen(cancerScr);
350 352 return new BaseResponse("成功", ErrorCodeConstants.SUCCESS);
351 353 } else {
... ... @@ -443,5 +445,46 @@
443 445 }
444 446 return new BaseResponse("妇女未建档,请前往妇女建档", ErrorCodeConstants.USER_NOT_EXISTS);
445 447 }
  448 +
  449 + public BaseResponse syncCancerScreen(CancerScreeningModel cancerScr) {
  450 + //查询条件
  451 + CancerScreeningQuery query = new CancerScreeningQuery();
  452 + query.setYn(YnEnums.YES.getId());
  453 + query.setId(cancerScr.getId());
  454 +
  455 + cancerScr.setModified(new Date());
  456 + List <CancerScreeningModel> modelList = cancerScreenService.queryCancerScreList(query);
  457 + if (CollectionUtils.isNotEmpty(modelList)) {
  458 + cancerScreenService.updateOneCancerScreen(modelList.get(0), modelList.get(0).getId());
  459 + }
  460 + else
  461 + {
  462 + cancerScreenService.addOneCancerScreen(cancerScr);
  463 + }
  464 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  465 + }
  466 +
  467 + public BaseResponse doSyncCancerScreen() {
  468 + //查询条件
  469 + CancerScreeningQuery query = new CancerScreeningQuery();
  470 + query.setYn(YnEnums.YES.getId());
  471 + query.setIsSync(1);
  472 + List <CancerScreeningModel> modelList = cancerScreenService.queryCancerScreList(query);
  473 + if (CollectionUtils.isNotEmpty(modelList)) {
  474 + for (CancerScreeningModel model : modelList)
  475 + {
  476 + model.setIsSync(2);
  477 + String json = JsonUtil.obj2Str1(model);
  478 + System.out.println(json);
  479 + String syncRsult = HttpClientUtil.doPostSSL(AREA_URL + "/cancerScr/syncCancerScreen", json);
  480 + cancerScreenService.updateOneCancerScreen(model, model.getId());
  481 + System.out.println("doSyncCancerScreen=" + syncRsult);
  482 + }
  483 + }
  484 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  485 + }
  486 +
  487 + public static final String AREA_URL = PropertiesUtils.getPropertyValue("area_url");
  488 +
446 489 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java View file @ a62f204
... ... @@ -374,6 +374,7 @@
374 374 getTrackHospital(model);
375 375  
376 376 model.setId(id);
  377 + model.setIsSync(1);
377 378 residentsArchiveService.updateResident(model, id);
378 379  
379 380  
380 381  
... ... @@ -1209,8 +1210,27 @@
1209 1210 }
1210 1211  
1211 1212 public BaseResponse syncResidentsArchive(ResidentsArchiveModel addRequest) {
  1213 +
1212 1214 addRequest.setModified(new Date());
1213   - residentsArchiveService.addResident(addRequest);
  1215 + ResidentsArchiveQuery query = new ResidentsArchiveQuery();
  1216 + query.setYn(YnEnums.YES.getId());
  1217 + query.setId(addRequest.getId());
  1218 + List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(query);
  1219 + if (CollectionUtils.isNotEmpty(modelList)) {
  1220 + residentsArchiveService.updateResident(modelList.get(0),modelList.get(0).getId());
  1221 + }
  1222 + else
  1223 + {
  1224 + residentsArchiveService.addResident(addRequest);
  1225 + try {
  1226 + //新增婚检追访信息,默认进入婚检追访
  1227 + addTrackDownInfo(Integer.parseInt(addRequest.getBuildDoctor()), addRequest);
  1228 + }catch (Exception e)
  1229 + {
  1230 +
  1231 + }
  1232 +
  1233 + }
1214 1234 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
1215 1235 }
1216 1236  
... ... @@ -1224,7 +1244,9 @@
1224 1244 for (ResidentsArchiveModel model : archiveModelList)
1225 1245 {
1226 1246 model.setIsSync(2);
1227   - String syncRsult = HttpClientUtil.doPostSSL(AREA_URL+"/syncResidentsArchive",JsonUtil.obj2Str(model));
  1247 + String json = JsonUtil.obj2Str1(model);
  1248 + System.out.println(json);
  1249 + String syncRsult = HttpClientUtil.doPostSSL(AREA_URL+"/syncResidentsArchive",json);
1228 1250 residentsArchiveService.updateResident(model,model.getId());
1229 1251 System.out.println("doSyncResidentsArchive=" + syncRsult);
1230 1252 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/CervicalCancerService.java View file @ a62f204
1 1 package com.lyms.platform.operate.web.service;
2 2  
  3 +import com.lyms.platform.common.result.BaseResponse;
3 4 import com.lyms.platform.operate.web.request.CervicalCancerListRequest;
4 5 import com.lyms.platform.operate.web.request.CervicalCancerRequest;
  6 +import com.lyms.platform.pojo.CervicalCancerModel;
5 7  
6 8 public interface CervicalCancerService extends IFormReportService<CervicalCancerRequest, CervicalCancerListRequest> {
7 9  
  10 + BaseResponse syncCervicalCancer(CervicalCancerModel cervicalCancer);
  11 +
  12 + BaseResponse doSyncCervicalCancer();
8 13 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/CervicalCancerServiceImpl.java View file @ a62f204
... ... @@ -672,5 +672,46 @@
672 672 }
673 673  
674 674  
  675 + @Override
  676 + public BaseResponse syncCervicalCancer(CervicalCancerModel cervicalCancer) {
  677 + CervicalCancerModel model = mongoTemplate.findOne(Query.query(Criteria.where("id").is(cervicalCancer.getId())), CervicalCancerModel.class);
  678 + if (model != null) {
  679 + Query query = Query.query(Criteria.where("id").is(cervicalCancer.getId()));
  680 + Update update = MongoConvertHelper
  681 + .convertToNativeUpdate(ReflectionUtils.getUpdateField(cervicalCancer));
  682 + mongoTemplate.updateFirst(query, update, CervicalCancerModel.class);
  683 + }
  684 + else
  685 + {
  686 + mongoTemplate.insert(cervicalCancer);
  687 + }
  688 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  689 + }
  690 +
  691 + @Override
  692 + public BaseResponse doSyncCervicalCancer() {
  693 + List<CervicalCancerModel> cervicalCancerModels = mongoTemplate.find(Query.query(Criteria.where("isSync").is(1)), CervicalCancerModel.class);
  694 + if (CollectionUtils.isNotEmpty(cervicalCancerModels))
  695 + {
  696 + for (CervicalCancerModel model : cervicalCancerModels)
  697 + {
  698 + model.setIsSync(2);
  699 + String json = JsonUtil.obj2Str1(model);
  700 + System.out.println(json);
  701 + String syncRsult = HttpClientUtil.doPostSSL(AREA_URL+"/cervicalCancer/syncCervicalCancer",json);
  702 +
  703 +
  704 + Query query = Query.query(Criteria.where("id").is(model.getId()));
  705 + Update update = MongoConvertHelper
  706 + .convertToNativeUpdate(ReflectionUtils.getUpdateField(model));
  707 + mongoTemplate.updateFirst(query, update, CervicalCancerModel.class);
  708 +
  709 + System.out.println("doSyncCervicalCancer=" + syncRsult);
  710 + }
  711 + }
  712 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  713 + }
  714 +
  715 + public static final String AREA_URL = PropertiesUtils.getPropertyValue("area_url");
675 716 }