From 3c5eb986572e3a9909859e5d8526a10f2db61c0a Mon Sep 17 00:00:00 2001 From: wtt Date: Sun, 9 Jun 2019 15:49:14 +0800 Subject: [PATCH] =?UTF-8?q?3.0=E3=80=812.0=E5=BB=BA=E6=A1=A3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=92=8C=E5=8E=86=E5=8F=B2=E5=BB=BA=E6=A1=A3=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/facade/BookbuildingFacade.java | 263 ++++++++++----------- .../operate/web/worker/SyncV2HistoryWorkerx.java | 60 +++++ .../src/main/resources/config.properties | 2 +- 3 files changed, 192 insertions(+), 133 deletions(-) create mode 100644 platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/SyncV2HistoryWorkerx.java diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java index 55c5c57..6f1e393 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java @@ -22,7 +22,7 @@ import com.lyms.platform.operate.web.result.*; import com.lyms.platform.operate.web.service.ITrackDownService; import com.lyms.platform.operate.web.utils.JdbcUtil; import com.lyms.platform.operate.web.worker.CorrectDataWorker; -import com.lyms.platform.operate.web.worker.CorrectDataWorker2; +import com.lyms.platform.operate.web.worker.SyncV2HistoryWorkerx; import com.lyms.platform.permission.dao.master.CouponMapper; import com.lyms.platform.permission.model.Organization; import com.lyms.platform.permission.model.OrganizationQuery; @@ -46,6 +46,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @@ -58,6 +59,7 @@ import java.io.OutputStream; import java.sql.*; import java.util.*; import java.util.Date; +import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicLong; /** @@ -214,7 +216,7 @@ public class BookbuildingFacade { patientsQuery.setCardNo(yunRequest.getPregnantCertificateNum()); //判断该身份证号码是否有孕妇建档 在该医院 List patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); - if (CollectionUtils.isNotEmpty(patients) && patients.get(0).getLastMenses().getTime() < DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()).getTime()) { + if (CollectionUtils.isNotEmpty(patients) && patients.get(0).getLastMenses().getTime() < DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()).getTime()) { br.setErrorcode(ErrorCodeConstants.DATA_EXIST); br.setErrormsg("该身份证在医院已经建档"); return br; @@ -225,7 +227,7 @@ public class BookbuildingFacade { patientsQuery.setPhone(yunRequest.getPregnantPhone()); //判断该手机号码在 孕期内有没有建档 List patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); - if (CollectionUtils.isNotEmpty(patients) && patients.get(0).getLastMenses().getTime() < DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()).getTime()) { + if (CollectionUtils.isNotEmpty(patients) && patients.get(0).getLastMenses().getTime() < DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()).getTime()) { br.setErrorcode(ErrorCodeConstants.DATA_EXIST); br.setErrormsg("该手机号码已经建档"); return br; @@ -239,7 +241,7 @@ public class BookbuildingFacade { patientsQuery.setVcCardNo(yunRequest.getVcCardNo()); patientsQuery.setHospitalId(yunRequest.getHospitalId()); List patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); - if (CollectionUtils.isNotEmpty(patients) && patients.get(0).getLastMenses().getTime() < DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()).getTime()) { + if (CollectionUtils.isNotEmpty(patients) && patients.get(0).getLastMenses().getTime() < DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()).getTime()) { br.setErrorcode(ErrorCodeConstants.DATA_EXIST); br.setErrormsg("该就诊卡号在该医院已经建档"); return br; @@ -420,12 +422,11 @@ public class BookbuildingFacade { } //秦皇岛建档获取分娩信息 if ("4".equals(HIS_VERSION) && "216".equals(tempP.getHospitalId())) { - Date startDate = DateUtil.addMonth(new Date(),-3); + Date startDate = DateUtil.addMonth(new Date(), -3); Date endDate = DateUtil.addDay(new Date(), 1); qhdfyFmService.syncByCardNo(DateUtil.getyyyy_MM_dd(startDate), DateUtil.getyyyy_MM_dd(endDate), tempP.getCardNo()); } - if (filePath != null && filePath.getId() == null) - { + if (filePath != null && filePath.getId() == null) { filePath.setPatientId(tempP.getId()); yunBookbuildingService.addFilePath(filePath); } @@ -433,27 +434,24 @@ public class BookbuildingFacade { ArchiveDataQuery query = new ArchiveDataQuery(); query.setIdCard(tempP.getCardNo()); - List list = archiveDataServicer.query(query, Sort.Direction.DESC,"created"); + List list = archiveDataServicer.query(query, Sort.Direction.DESC, "created"); ArchiveData archiveData = new ArchiveData(); archiveData.setBuildDate(new Date()); archiveData.setId(tempP.getHospitalId() + ":" + tempP.getCardNo()); archiveDataServicer.update(archiveData); - if (CollectionUtils.isNotEmpty(list)) - { + if (CollectionUtils.isNotEmpty(list)) { Patients patients = new Patients(); - if (list.get(0).getAssistUserId() != null && tempP.getId() != null) - { + if (list.get(0).getAssistUserId() != null && tempP.getId() != null) { patients.setAssistUserId(list.get(0).getAssistUserId()); - yunBookbuildingService.updatePregnant(patients,tempP.getId()); + yunBookbuildingService.updatePregnant(patients, tempP.getId()); } } } }); - if (yunRequest != null) - { + if (yunRequest != null) { deleteImg(yunRequest); } @@ -718,11 +716,12 @@ public class BookbuildingFacade { /** * 保存/更新数据成功后,将数据同步到2.0系统中 - * @param patients - * @param id 更新保存标识 - * @param userId userId + * + * @param patients + * @param id 更新保存标识 + * @param userId userId */ - private void syncDataToV2(final Patients patients, String id, Integer userId){ + private void syncDataToV2(final Patients patients, String id, Integer userId) { try { Thread syncThread = new Thread(new Runnable() { @Override @@ -731,14 +730,17 @@ public class BookbuildingFacade { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); JSONObject jsonObject = getQueryParam(patients); - String result = restTemplate.postForObject(syncToV2Url + "/v3/bookbuilding/savaOrUpdate", jsonObject, String.class); - logger.info("建档数据同步到2.0系统,返回结果: {}", result); +// String result = restTemplate.postForObject(syncToV2Url + "/v3/bookbuilding/savaOrUpdate", jsonObject, String.class); +// logger.info("建档数据同步到2.0系统,返回结果: {}", result); + Map map = new HashMap<>(); + map.put("jsonObject", jsonObject); + ResponseEntity responseEntity = restTemplate.getForEntity(syncToV2Url +"/GetPatient.asmx/GetPatientInfo?data={jsonObject}", String.class, map); } }); syncThread.start(); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); - logger.error("建档数据同步到2.0系统失败",e); + logger.error("建档数据同步到2.0系统失败", e); } } @@ -792,13 +794,13 @@ public class BookbuildingFacade { jsonObject.put("P_HOSPITALID", "todo");//建党机构 jsonObject.put("P_ISVIP", patients.getBookbuildingDate());//建档时间 - if(patients.getReqHusband()!=null){//丈夫信息是否必须 - if(patients.getReqHusband()){ + if (patients.getReqHusband() != null) {//丈夫信息是否必须 + if (patients.getReqHusband()) { jsonObject.put("P_HUSBANDUNPROVIDE", 1); - }else if(!patients.getReqHusband()){ + } else if (!patients.getReqHusband()) { jsonObject.put("P_HUSBANDUNPROVIDE", 2); } - }else { + } else { jsonObject.put("P_HUSBANDUNPROVIDE", ""); } @@ -1026,18 +1028,14 @@ public class BookbuildingFacade { updateAntExLastMenses(patients.getLastMenses(), patients.getPid(), patients.getBookbuildingDate()); FilePathModel filePath = yunRequest.getFilePath(); - if (filePath != null && filePath.getId() != null) - { + if (filePath != null && filePath.getId() != null) { yunBookbuildingService.updateFilePath(filePath); - } - else if (filePath != null) - { + } else if (filePath != null) { filePath.setPatientId(patient.getId()); yunBookbuildingService.addFilePath(filePath); } - if (yunRequest != null) - { + if (yunRequest != null) { deleteImg(yunRequest); } @@ -1049,8 +1047,6 @@ public class BookbuildingFacade { } - - /** * 修改初诊 复诊的末次月经字段 * @@ -1379,7 +1375,7 @@ public class BookbuildingFacade { } } - if(StringUtils.isNotEmpty(yunRequest.getHusbandBirth())){//如果前端传入的丈夫生日,则用传入的数据 + if (StringUtils.isNotEmpty(yunRequest.getHusbandBirth())) {//如果前端传入的丈夫生日,则用传入的数据 patient.setHusbandBirth(DateUtil.parseYMD(yunRequest.getHusbandBirth())); } @@ -1423,7 +1419,7 @@ public class BookbuildingFacade { //建档开通增值服务,以前数据 if (CollectionUtils.isNotEmpty(yunRequest.getSerInfos())) { for (Map serInfo : yunRequest.getSerInfos()) { - if(serInfo.get("serType")==null){ + if (serInfo.get("serType") == null) { continue; } //标准服务 @@ -2220,7 +2216,7 @@ public class BookbuildingFacade { public BaseResponse uploadImg(MultipartFile file) { //如果文件不为空,写入上传路径 BaseObjectResponse objectResponse = new BaseObjectResponse(); - if(file.isEmpty()) { + if (file.isEmpty()) { objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA); objectResponse.setErrormsg("没有上传数据"); return objectResponse; @@ -2228,9 +2224,9 @@ public class BookbuildingFacade { try { String imgPath = DateUtil.getYmd(new Date()); - String filename = StringUtils.uuid()+"."+FileUtil.getFileSuffix(file.getOriginalFilename()); + String filename = StringUtils.uuid() + "." + FileUtil.getFileSuffix(file.getOriginalFilename()); - File filepath = new File(BASE_IMG_PATH+File.separator+imgPath,filename); + File filepath = new File(BASE_IMG_PATH + File.separator + imgPath, filename); //判断路径是否存在,如果不存在就创建一个 if (!filepath.getParentFile().exists()) { filepath.getParentFile().mkdirs(); @@ -2241,7 +2237,7 @@ public class BookbuildingFacade { objectResponse.setErrormsg("成功"); return objectResponse; } catch (IOException e) { - ExceptionUtils.catchException(e,"上传文件发生异常"); + ExceptionUtils.catchException(e, "上传文件发生异常"); objectResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); objectResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); return objectResponse; @@ -2252,24 +2248,19 @@ public class BookbuildingFacade { public void deleteImg(YunBookbuildingAddRequest yunRequest) { List files = new ArrayList<>(); List delFiles = yunRequest.getDelFiles(); - if (CollectionUtils.isNotEmpty(delFiles)) - { + if (CollectionUtils.isNotEmpty(delFiles)) { files.addAll(delFiles); } List hdelFiles = yunRequest.getHdelFiles(); - if (CollectionUtils.isNotEmpty(hdelFiles)) - { + if (CollectionUtils.isNotEmpty(hdelFiles)) { files.addAll(hdelFiles); } - if (CollectionUtils.isNotEmpty(files)) - { - for (String filePath : files) - { - File filepath = new File(BASE_IMG_PATH+File.separator+filePath); - if (filepath.exists()) - { + if (CollectionUtils.isNotEmpty(files)) { + for (String filePath : files) { + File filepath = new File(BASE_IMG_PATH + File.separator + filePath); + if (filepath.exists()) { filepath.delete(); } } @@ -2281,7 +2272,7 @@ public class BookbuildingFacade { BaseObjectResponse objectResponse = new BaseObjectResponse(); - if(!StringUtils.isNotEmpty(imgRequest.getImg())) { + if (!StringUtils.isNotEmpty(imgRequest.getImg())) { objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA); objectResponse.setErrormsg("没有上传数据"); return objectResponse; @@ -2289,22 +2280,22 @@ public class BookbuildingFacade { try { String imgPath = DateUtil.getYmd(new Date()); - String filename = StringUtils.uuid()+".jpg"; + String filename = StringUtils.uuid() + ".jpg"; - String fileAllPath = BASE_IMG_PATH+File.separator+"id_photo"+File.separator+imgPath+File.separator+filename; + String fileAllPath = BASE_IMG_PATH + File.separator + "id_photo" + File.separator + imgPath + File.separator + filename; System.out.println("fileAllPath=" + fileAllPath); File filepath = new File(fileAllPath); //判断路径是否存在,如果不存在就创建一个 if (!filepath.getParentFile().exists()) { filepath.getParentFile().mkdirs(); } - FileUtil.generateImage(imgRequest.getImg(),fileAllPath); + FileUtil.generateImage(imgRequest.getImg(), fileAllPath); objectResponse.setData("id_photo" + "/" + imgPath + "/" + filename); objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); objectResponse.setErrormsg("成功"); return objectResponse; } catch (Exception e) { - ExceptionUtils.catchException(e,"上传图片发生异常"); + ExceptionUtils.catchException(e, "上传图片发生异常"); objectResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); objectResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); return objectResponse; @@ -2314,10 +2305,10 @@ public class BookbuildingFacade { /** * 更新v2.0的数据 * - * @param id 主键 - * @param param 请求参数 + * @param id 主键 + * @param param 请求参数 * @param userId 用户ID - * @param b 是否同步数据 + * @param b 是否同步数据 * @return BaseResponse */ public BaseResponse updatePregnantByIdV2(String id, SyncV2YunBookbuildingRequest param, Integer userId, boolean b) { @@ -2329,9 +2320,9 @@ public class BookbuildingFacade { /** * 保存v2.0的数据 * - * @param param 主键 + * @param param 主键 * @param userId 请求参数 - * @param b 是否同步数据 + * @param b 是否同步数据 * @return BaseResponse */ public BaseResponse addPregnantBookbuildingV2(SyncV2YunBookbuildingRequest param, Integer userId, boolean b) { @@ -2347,15 +2338,15 @@ public class BookbuildingFacade { * @param param * @return */ - private YunBookbuildingAddRequest getYunBookbuildingAddRequest( SyncV2YunBookbuildingRequest param) { + private YunBookbuildingAddRequest getYunBookbuildingAddRequest(SyncV2YunBookbuildingRequest param) { // TODO 2019/6/7 14:07 dongqing 修改 //丈夫信息是否必须,映射 - if (param.getReqHusbandInt()==1){ + if (param.getReqHusbandInt() == 1) { param.setReqHusband(true); - }else if(param.getReqHusbandInt()==2){ + } else if (param.getReqHusbandInt() == 2) { param.setReqHusband(false); - }else { + } else { param.setReqHusband(null); } param.setHospitalId("todo"); @@ -2368,7 +2359,7 @@ public class BookbuildingFacade { * @param param 请求参数 * @return BaseResponse */ - public BaseResponse saveByV2(SyncV2HistoryRequest param) { + public BaseResponse saveByV2(SyncV2HistoryRequest param) { //获取2.0历史建档数据 String startTime = param.getStartTime(); String endTime = param.getEndTime(); @@ -2378,26 +2369,25 @@ public class BookbuildingFacade { String sql = getSqlString(startTime, endTime); QueryRunner queryRunner = new QueryRunner(true); List lists = queryRunner.query(connection, sql, new BeanListHandler(SyncV2HistoryRequest.class)); - // TODO 2019/6/5 15:39 dongqing 分批次请求保存,明天加上 + // TODO 2019/6/5 15:39 dongqing 分批次请求保存 - - if(CollectionUtils.isNotEmpty(lists)){ - int batchSize = 400; - int end = 0; - java.util.concurrent.atomic.AtomicLong counter=new AtomicLong(); - for (int i = 0; i < lists.size(); i += batchSize) { - end = (end + batchSize); - if (end > lists.size()) { - end = lists.size(); - } -// commonThreadPool.submit(new CorrectDataWorker2(lists.subList(i, end),postReviewService,patientsService,anExService,antExFacade,counter)); - } -// logger.info("hand hospitalId :" +hospitalId+", update count "+counter.get()); + for (YunBookbuildingAddRequest list : lists) { + list.setHospitalId("216216"); + list.setBookbuildingDoctor("1000000185"); + System.out.println("建档孕妇身份证号cardNo=="+list.getPregnantCertificateNum()); + addPregnantBookbuilding(list, null, false);//Integer.parseInt(list.getBookbuildingDoctor() } -// for (SyncV2HistoryRequest list : lists) { -// BaseObjectResponse p = addPregnantBookbuilding(list, null, false);//Integer.parseInt(list.getBookbuildingDoctor() -// System.out.println(p.getData()); +// if (CollectionUtils.isNotEmpty(lists)) { +// int batchSize = 2; +// int end = 0; +// for (int i = 0; i < lists.size(); i += batchSize) { +// end = (end + batchSize); +// if (end > lists.size()) { +// end = lists.size(); +// } +// Future f = commonThreadPool.submit(new SyncV2HistoryWorkerx(new BookbuildingFacade(), lists.subList(i, end))); +// } // } } catch (Exception e) { @@ -2417,52 +2407,61 @@ public class BookbuildingFacade { } private String getSqlString(String startTime, String endTime) { - return "SELECT " + - "P_CARDTYPE as pregnantCertificateTypeId," +//证件类型 - "P_ADDRESSPROVINCE as pregnantCensusProvinceId," +//居住地-省 - "P_ADDRESSCITY as pregnantCensusCityId," +//居住地 -城市 - "P_ADDRESSCOUNTY as pregnantCensusAreaId," +//居住地区 - "P_ADDRESSSTREET as pregnantCensusStreetId," +//居住地 -街道 - "P_COUNTRY as pregnantCountryId," +//国籍 - "P_HUSBANDCOUNTRY as husbandCountryId," +//丈夫国籍 - "P_HUSBANDCARDTYPE as husbandCertificateTypeId," +//丈夫证件类型 - "P_NATION as pregnantNationId," +//民族 - "P_HUSBANDNATION as husbandNationId," +//丈夫民族 - "P_DOCID as bookbuildingDoctor," +//建档医生 - "P_CARDNO as pregnantCertificateNum," +//证件号 - "P_CARDNO as pregnantNationId," +// 孕妇民族 - "P_CARDNO as pregnantPhone," +// 孕妇手机号 - "P_RRPROVINCE as pregnantLiveProvinceId," +//户口——省 - "P_RRCITY as pregnantLiveCityId," +//户口——市 - "P_RRCOUNTY as pregnantLiveAreaId," +//户口——区县 - "P_RRSTREET as pregnantLiveStreetId," +//户口——街道 - "P_POSTPARTUMPROVINCE as childbirthProvinceId," +//产后——省 - "P_POSTPARTUMCITY as childbirthCityId," +//产后——市 - "P_POSTPARTUMCOUNTY as childbirthAreaId," +//产后——区县 - "P_POSTPARTUMSTREET as childbirthStreetId," +//产后——街道 - "P_HUSBANDNAME as husbandName," +//丈夫姓名 - "P_HUSBANDCARDNO as husbandCertificateNum," +//丈夫证件号码 - "P_HUSBANDBIRTHDAY as husbandBirth," +//丈夫出生日期 - "P_HUSBANDRRPROVINCE as husbandProvinceRegisterId," +//丈夫户口所在地 省 - "P_HUSBANDRRCITY as husbandCityRegisterId," +//丈夫户口所在地 市 - "P_HUSBANDRRCOUNTY as husbandAreaRegisterId," +//丈夫户口所在地 县 - "P_HUSBANDRRSTREET as husbandStreetRegisterId," +//丈夫户口所在地 街道 - "VC_CARDNO as vcCardNo, " +//就诊卡号 条码号 - "P_BIRTHDAY as birthday, " +//孕妇生日 - "P_LASTMENSTRUALPERIOD as lastMenstrualPeriod," +//末次月经 - "YCQ as dueDate," +//预产期 - "P_FILINGTIME as bookbuildingDate," +//建档日期 - "P_HOSPITALID as hospitalId " +//医院Id - " FROM V_SYNC_TO_V3_PATIENT T " + - "LEFT join v_sync_to_v3_pdr pdr on pdr.p_no = t.p_no "+ - "WHERE TRUNC(T.P_FILINGTIME) between TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD') " + - "and pdr.p_no is null " + - "and ( P_ADDRESSCOUNTY='160' " +//居住地区(桃城区) - "OR P_POSTPARTUMCOUNTY='160' " +//产后区县(桃城区) - "OR P_RRCOUNTY ='160')"; + String str = "t.P_CARDTYPE as pregnantCertificateTypeId," +//证件类型 + "t.P_ADDRESSPROVINCE as pregnantCensusProvinceId," +//居住地-省 + "t.P_ADDRESSCITY as pregnantCensusCityId," +//居住地 -城市 + "t.P_ADDRESSCOUNTY as pregnantCensusAreaId," +//居住地区 + "t.P_ADDRESSSTREET as pregnantCensusStreetId," +//居住地 -街道 + "t.P_COUNTRY as pregnantCountryId," +//国籍 + "t.P_HUSBANDCOUNTRY as husbandCountryId," +//丈夫国籍 + "t.P_HUSBANDCARDTYPE as husbandCertificateTypeId," +//丈夫证件类型 + "t.P_NATION as pregnantNationId," +//民族 + "t.P_HUSBANDNATION as husbandNationId," +//丈夫民族 + "t.P_DOCID as bookbuildingDoctor," +//建档医生 + "t.P_CARDNO as pregnantCertificateNum," +//证件号 + "t.P_CARDNO as pregnantNationId," +// 孕妇民族 + "t.P_CARDNO as pregnantPhone," +// 孕妇手机号 + "t.P_RRPROVINCE as pregnantLiveProvinceId," +//户口——省 + "t.P_RRCITY as pregnantLiveCityId," +//户口——市 + "t.P_RRCOUNTY as pregnantLiveAreaId," +//户口——区县 + "t.P_RRSTREET as pregnantLiveStreetId," +//户口——街道 + "t.P_POSTPARTUMPROVINCE as childbirthProvinceId," +//产后——省 + "t.P_POSTPARTUMCITY as childbirthCityId," +//产后——市 + "t.P_POSTPARTUMCOUNTY as childbirthAreaId," +//产后——区县 + "t.P_POSTPARTUMSTREET as childbirthStreetId," +//产后——街道 + "t.P_HUSBANDNAME as husbandName," +//丈夫姓名 + "t.P_HUSBANDCARDNO as husbandCertificateNum," +//丈夫证件号码 + "t.P_HUSBANDBIRTHDAY as husbandBirth," +//丈夫出生日期 + "t.P_HUSBANDRRPROVINCE as husbandProvinceRegisterId," +//丈夫户口所在地 省 + "t.P_HUSBANDRRCITY as husbandCityRegisterId," +//丈夫户口所在地 市 + "t.P_HUSBANDRRCOUNTY as husbandAreaRegisterId," +//丈夫户口所在地 县 + "t.P_HUSBANDRRSTREET as husbandStreetRegisterId," +//丈夫户口所在地 街道 + "t.VC_CARDNO as vcCardNo, " +//就诊卡号 条码号 + "t.P_BIRTHDAY as birthday, " +//孕妇生日 + "t.P_LASTMENSTRUALPERIOD as lastMenstrualPeriod," +//末次月经 + "t.YCQ as dueDate," +//预产期 + "t.P_FILINGTIME as bookbuildingDate," +//建档日期 + "t.P_HOSPITALID as hospitalId ";//医院Id + + String sql = "select " + str + " from " + + " (select p.* from V_SYNC_TO_V3_PATIENT p " + + " left join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + + " where pdr.p_no is null and (TRUNC(p.P_FILINGTIME) BETWEEN TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD')) and ( p.P_ADDRESSCOUNTY='160' OR p.P_POSTPARTUMCOUNTY='160' OR p.P_RRCOUNTY ='160')" + + " union " + + " select p.* from V_SYNC_TO_V3_PATIENT p " + + " right join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + + " where pdr.PDR_CHILDBIRTHDAY > sysdate - 29 and pdr.p_no is not null and to_char(pdr.PDR_CHILDBIRTHDAY,'YYYY-MM-DD') BETWEEN TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD')" + + ") t"; + return sql; } - + /* + WHERE TRUNC(T.P_FILINGTIME) between TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD') " + + "and pdr.p_no is null " + + "and ( P_ADDRESSCOUNTY='160' " +//居住地区(桃城区) + "OR P_POSTPARTUMCOUNTY='160' " +//产后区县(桃城区) + "OR P_RRCOUNTY ='160')"; + */ public static Connection getConnection() { Connection connection; try { @@ -2481,11 +2480,11 @@ public class BookbuildingFacade { PreparedStatement preparedStatement = connection.prepareStatement("select * from MOMMY_PATIENT"); ResultSet resultSet = preparedStatement.executeQuery(); ResultSetMetaData metaData = resultSet.getMetaData(); - int i=1; - while (resultSet.next()){ + int i = 1; + while (resultSet.next()) { String tableName = metaData.getColumnName(++i); System.out.println(tableName); - // System.out.println(resultSet.getString(tableName)); + // System.out.println(resultSet.getString(tableName)); } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/SyncV2HistoryWorkerx.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/SyncV2HistoryWorkerx.java new file mode 100644 index 0000000..19baa3b --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/SyncV2HistoryWorkerx.java @@ -0,0 +1,60 @@ +package com.lyms.platform.operate.web.worker; + +import com.lyms.platform.biz.service.AntenatalExaminationService; +import com.lyms.platform.biz.service.PatientsService; +import com.lyms.platform.biz.service.PostReviewService; +import com.lyms.platform.common.enums.YnEnums; +import com.lyms.platform.common.result.BaseObjectResponse; +import com.lyms.platform.common.utils.ExceptionUtils; +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; +import com.lyms.platform.operate.web.facade.BookbuildingFacade; +import com.lyms.platform.operate.web.request.SyncV2HistoryRequest; +import com.lyms.platform.operate.web.request.YunBookbuildingAddRequest; +import com.lyms.platform.pojo.AntExChuModel; +import com.lyms.platform.pojo.AntenatalExaminationModel; +import com.lyms.platform.pojo.Patients; +import com.lyms.platform.query.AntExChuQuery; +import com.lyms.platform.query.AntExQuery; +import com.lyms.platform.query.PostReviewQuery; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.data.domain.Sort; + +import java.util.Date; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicLong; + +/** + * 纠正数据线程 + *

+ * Created by Administrator on 2016/10/25 0025. + */ +public class SyncV2HistoryWorkerx implements Callable { + + private BookbuildingFacade bookbuildingFacade; + + private List lists; + + public SyncV2HistoryWorkerx(BookbuildingFacade bookbuildingFacade, List lists) { + this.bookbuildingFacade = bookbuildingFacade; + this.lists = lists; + } + + @Override + public BaseObjectResponse call() throws Exception { + BaseObjectResponse p=null; + for (YunBookbuildingAddRequest list : lists) { + //董勤让写死的 + list.setHospitalId("216216"); + list.setBookbuildingDoctor("1000000185"); + System.out.println("建档孕妇身份证号=="+list.getPregnantCertificateNum()); + p = bookbuildingFacade.addPregnantBookbuilding(list, null, false);//Integer.parseInt(list.getBookbuildingDoctor() + } + return p; + } + + + + + +} diff --git a/platform-operate-api/src/main/resources/config.properties b/platform-operate-api/src/main/resources/config.properties index b502cf7..a3b0882 100644 --- a/platform-operate-api/src/main/resources/config.properties +++ b/platform-operate-api/src/main/resources/config.properties @@ -33,4 +33,4 @@ img_path=/data/images ams_url=http://ams.api.stage.healthbaby.com.cn #同步数据到v2.0 -sync_to_v2_url=http://localhost:8080 \ No newline at end of file +sync_to_v2_url=http://hengshui.mamibeibi.com:8091 -- 1.8.3.1