Commit d9f57f6c57ac57b1bcd35db297fd98d321bbdc3c

Authored by dongqin
1 parent 53b0241098

优化承德同步数据存在遗漏问题,但尚未完全解决

Showing 2 changed files with 100 additions and 26 deletions

platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java View file @ d9f57f6
1 1 package com.lyms.hospitalapi.Cdfy;
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
4   -import com.lyms.hospitalapi.pojo.HealthRecord;
5 4 import com.lyms.platform.biz.service.*;
6 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
7   -import com.lyms.platform.common.enums.PermissionTypeEnums;
8 6 import com.lyms.platform.common.enums.RenShenJieJuEnums;
9 7 import com.lyms.platform.common.enums.YnEnums;
10 8 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -14,8 +12,6 @@
14 12 import com.lyms.platform.operate.web.result.MatdeliverFollowResult;
15 13 import com.lyms.platform.operate.web.utils.CommonsHelper;
16 14 import com.lyms.platform.operate.web.utils.FunvCommonUtil;
17   -import com.lyms.platform.operate.web.utils.UnitConstants;
18   -import com.lyms.platform.operate.web.utils.UnitUtils;
19 15 import com.lyms.platform.permission.dao.master.CouponMapper;
20 16 import com.lyms.platform.permission.model.Organization;
21 17 import com.lyms.platform.permission.model.Users;
22 18  
... ... @@ -25,16 +21,7 @@
25 21 import com.lyms.platform.query.*;
26 22 import org.apache.commons.collections.CollectionUtils;
27 23 import org.apache.commons.collections.MapUtils;
28   -import org.apache.commons.dbutils.DbUtils;
29   -import org.apache.commons.dbutils.QueryRunner;
30 24 import org.apache.commons.lang.StringUtils;
31   -import org.apache.commons.lang.math.NumberUtils;
32   -import org.apache.http.HttpResponse;
33   -import org.apache.http.client.methods.HttpPost;
34   -import org.apache.http.entity.StringEntity;
35   -import org.apache.http.impl.client.DefaultHttpClient;
36   -import org.apache.http.impl.conn.PoolingClientConnectionManager;
37   -import org.apache.http.util.EntityUtils;
38 25 import org.springframework.beans.factory.annotation.Autowired;
39 26 import org.springframework.data.domain.Sort;
40 27 import org.springframework.data.mongodb.core.MongoTemplate;
... ... @@ -43,8 +30,9 @@
43 30 import org.springframework.stereotype.Service;
44 31  
45 32 import java.sql.*;
46   -import java.sql.Date;
47   -import java.util.*;
  33 +import java.util.HashMap;
  34 +import java.util.List;
  35 +import java.util.Map;
48 36  
49 37 /**
50 38 * Created by Administrator on 2018/6/25.
... ... @@ -147,7 +135,7 @@
147 135 conn = ConnTools.makeGwConnection();
148 136  
149 137 //个人基本信息语句
150   - String inBaseInfoSql = "insert into baseinfo(ORG_CODE,PATIENT_ID,CARD_NO,CARD_TYPE_CODE,NAME,\n" +
  138 + String inBaseInfoSql = "insert into BASEINFO(ORG_CODE,PATIENT_ID,CARD_NO,CARD_TYPE_CODE,NAME,\n" +
151 139 "SEX_CODE,BIRTH_DATE,ID_TYPE_CODE,ID_NO,EMPLOYER_NAME,TEL_NO,\n" +
152 140 "CONTACT_NAME,CONTACT_TEL_NO,NATIONALITY_CODE,ABO_CODE,RH_CODE,\n" +
153 141 "EDUCATION_CODE,OCCUPATION_CODE,MARRIAGE_CODE,DRUG_ALLERGY_MARK,OP_HISTORY_MARK,TRAUMA_HISTORY_MARK,\n" +
154 142  
... ... @@ -155,12 +143,12 @@
155 143 "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
156 144  
157 145 //地址信息语句,01:户籍地址
158   - String inAddressSql01 = "insert into baseinfo_address(ORG_CODE,PATIENT_ID,Address_Type_Code,Addr_Province,Addr_City,\n" +
  146 + String inAddressSql01 = "insert into BASEINFO_ADDRESS(ORG_CODE,PATIENT_ID,Address_Type_Code,Addr_Province,Addr_City,\n" +
159 147 "Addr_County,Addr_Town,Addr_Village,Addr_House_No,Postal_Code,DELETE_MARK,LAST_UPDATE_DTIME) \n" +
160 148 "values(?,?,?,?,?,?,?,?,?,?,?,?)";
161 149  
162 150 //地址信息语句,03:居住地址
163   - String inAddressSql03 = "insert into baseinfo_address(ORG_CODE,PATIENT_ID,Address_Type_Code,Addr_Province,Addr_City,\n" +
  151 + String inAddressSql03 = "insert into BASEINFO_ADDRESS(ORG_CODE,PATIENT_ID,Address_Type_Code,Addr_Province,Addr_City,\n" +
164 152 "Addr_County,Addr_Town,Addr_Village,Addr_House_No,Postal_Code,DELETE_MARK,LAST_UPDATE_DTIME) \n" +
165 153 "values(?,?,?,?,?,?,?,?,?,?,?,?)";
166 154  
... ... @@ -820,7 +808,15 @@
820 808 ps.setString(47, "未见异常");
821 809 }
822 810 if(antExChuModel.getXhdb() != null){
823   - ps.setInt(48, Integer.parseInt(antExChuModel.getXhdb()));
  811 + int xh = 0;
  812 + try {
  813 + String xhdb = antExChuModel.getXhdb();
  814 + double v = Double.parseDouble(xhdb);
  815 + xh = (int) v;
  816 + } catch (Exception e) {
  817 + e.printStackTrace();
  818 + }
  819 + ps.setInt(48, xh);
824 820 }else{
825 821 ps.setNull(48,Types.INTEGER);
826 822 }
... ... @@ -1293,8 +1289,14 @@
1293 1289 }else{
1294 1290 ps.setNull(14,Types.INTEGER);
1295 1291 }
1296   - if(antenatalExaminationModel.getUrineProtein() != null){
1297   - ps.setDouble(15, Double.parseDouble(antenatalExaminationModel.getUrineProtein()));
  1292 + if(antenatalExaminationModel.getUrineProtein() != null && !"-".equals(antenatalExaminationModel.getUrineProtein())){
  1293 + Double parseDouble = null;
  1294 + try {
  1295 + parseDouble = Double.parseDouble(antenatalExaminationModel.getUrineProtein());
  1296 + }catch (Exception e){
  1297 + e.printStackTrace();
  1298 + }
  1299 + ps.setDouble(15, parseDouble);
1298 1300 }else{
1299 1301 ps.setNull(15,Types.DOUBLE);
1300 1302 }
... ... @@ -1649,7 +1651,13 @@
1649 1651 ps.setString(56,null);
1650 1652 }
1651 1653 if(data.getNeedleNum() != null){
1652   - ps.setInt(57,Integer.parseInt(data.getNeedleNum()));
  1654 + Integer needleNum = null;
  1655 + try {
  1656 + needleNum = Integer.parseInt(data.getNeedleNum());
  1657 + } catch (Exception e) {
  1658 + e.printStackTrace();
  1659 + }
  1660 + ps.setInt(57,needleNum);
1653 1661 }else{
1654 1662 ps.setNull(57,Types.INTEGER);
1655 1663 }
1656 1664  
... ... @@ -4020,11 +4028,15 @@
4020 4028 saveEb(startDate, endDate);
4021 4029 }
4022 4030  
4023   -
4024   - public void test(String startDate,String endDate) {
4025   - System.out.println("start=" + startDate + "end=" + endDate);
  4031 + /**
  4032 + * 测试专用
  4033 + *
  4034 + * @param startDate
  4035 + * @param endDate
  4036 + */
  4037 + public BaseResponse testAll(String startDate,String endDate) {
4026 4038 saveYf(startDate, endDate);
4027   - saveChuZhen(startDate, endDate);
  4039 + saveChuZhen(startDate, endDate);
4028 4040 saveFuZhen(startDate, endDate);
4029 4041 saveFm(startDate, endDate);
4030 4042 saveChFs(startDate, endDate);
... ... @@ -4032,6 +4044,7 @@
4032 4044 saveEtDa(startDate, endDate);
4033 4045 saveXsrFs(startDate, endDate);
4034 4046 saveEb(startDate, endDate);
  4047 + return new BaseResponse();
4035 4048 }
4036 4049  
4037 4050  
platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterfaceDebug.java View file @ d9f57f6
  1 +package com.lyms.hospitalapi.Cdfy;
  2 +
  3 +import com.lyms.platform.common.result.BaseResponse;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.stereotype.Controller;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +
  10 +/**
  11 + *
  12 + * @Author dongqin
  13 + * @Description 承德公共卫生系统接口(gxk)测试专用
  14 + * @Date 16:04 2019/6/24
  15 + */
  16 +@Controller
  17 +public class CdGwInterfaceDebug {
  18 +
  19 + @Autowired
  20 + private CdGwInterface cdGwInterface;
  21 +
  22 + /**
  23 + * 起止时间需注意mongdn的时差问题
  24 + *
  25 + * @param startTime
  26 + * @param endTime
  27 + * @return
  28 + */
  29 + @RequestMapping(value = "/sync/test",method = RequestMethod.GET)
  30 + private BaseResponse test(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String typeStr){
  31 + System.out.printf("start = %s , end = %s , typeStr = %s", startTime, endTime, typeStr);
  32 + if ("saveYf".equals(typeStr)) {
  33 + return cdGwInterface.saveYf(startTime, endTime);
  34 + }
  35 + if ("saveChuZhen".equals(typeStr)) {
  36 + return cdGwInterface.saveChuZhen(startTime, endTime);
  37 + }
  38 + if ("saveFuZhen".equals(typeStr)) {
  39 + return cdGwInterface.saveFuZhen(startTime, endTime);
  40 + }
  41 + if ("saveFm".equals(typeStr)) {
  42 + return cdGwInterface.saveFm(startTime, endTime);
  43 + }
  44 + if ("saveChFs".equals(typeStr)) {
  45 + return cdGwInterface.saveChFs(startTime, endTime);
  46 + }
  47 + if ("saveEtDa".equals(typeStr)) {
  48 + return cdGwInterface.saveEtDa(startTime, endTime);
  49 + }
  50 + if ("saveXsrFs".equals(typeStr)) {
  51 + return cdGwInterface.saveXsrFs(startTime, endTime);
  52 + }
  53 + if ("saveEb".equals(typeStr)) {
  54 + return cdGwInterface.saveEb(startTime, endTime);
  55 + }
  56 + if ("all".equals(typeStr)) {
  57 + return cdGwInterface.testAll(startTime, endTime);
  58 + }
  59 + return new BaseResponse();
  60 + }
  61 +}