Commit 1963bde1f36f9bd0acc7250a90003216b6e44e12

Authored by liquanyu
1 parent 23cb5ce5f7
Exists in master and in 1 other branch dev

骨密度

Showing 4 changed files with 211 additions and 112 deletions

platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java View file @ 1963bde
1   -package com.lyms.platform.microelement;
2   -
3   -import com.lyms.platform.common.utils.HttpClientUtil;
4   -import com.lyms.platform.common.utils.JsonUtil;
5   -import com.lyms.platform.common.utils.PropertiesUtils;
6   -import com.lyms.platform.common.utils.StringUtils;
7   -import com.lyms.platform.conn.MicroelementConnection;
8   -
9   -import java.sql.Connection;
10   -import java.sql.ResultSet;
11   -import java.sql.SQLException;
12   -import java.sql.Statement;
13   -import java.util.ArrayList;
14   -import java.util.HashMap;
15   -import java.util.List;
16   -import java.util.Map;
17   -
18   -public class MicroelementWorker {
19   -
20   - public static final String url = PropertiesUtils.getPropertyValue("url");
21   -
22   - public static void getMicroelementRecords()
23   - {
24   - System.out.println("getMicroelementRecords start");
25   - Connection conn = null;
26   - Statement sta = null;
27   - ResultSet rst = null;
28   - try {
29   - conn = MicroelementConnection.getConnection();
30   - sta = conn.createStatement();
31   - rst = sta.executeQuery("select * from BaseInfo where status is null ");
32   - while (rst.next()){
33   - Map<String,Object> data = new HashMap<>();
34   - String numberCode = rst.getString("编号");
35   - String autoId = rst.getString("AUTOID");
36   - data.put("numberCode",numberCode);
37   - data.put("autoId",autoId);
38   - getMicroelementRecords(data);
39   - }
40   - }
41   - catch (SQLException e) {
42   - }
43   - finally {
44   - MicroelementConnection.close(conn, sta,rst);
45   - }
46   - }
47   -
48   -
49   - public static void getMicroelementRecords(Map<String,Object> data)
50   - {
51   - Connection conn = null;
52   - Statement sta = null;
53   - ResultSet rst = null;
54   - try {
55   - conn = MicroelementConnection.getConnection();
56   - String autoId = data.get("autoId").toString();
57   - sta = conn.createStatement();
58   - rst = sta.executeQuery("select * from ItemsInfo where BaseAutoId = "+autoId);
59   -
60   - List<Map> microelements = new ArrayList<>();
61   - while (rst.next()) {
62   - Map map = new HashMap();
63   - String eleName = rst.getString("元素名称");
64   - String value = rst.getString("测量值");
65   - String result = StringUtils.checkNum(value);
66   - map.put("result",result);
67   - map.put("unit",value.contains("mmol") ? "mmol/l" : (value.contains("umol") ? "umol/l" : "ug/l"));
68   - map.put("eleName",eleName);
69   - map.put("refValue","");//TODO
70   - microelements.add(map);
71   - }
72   - data.put("microelements", microelements);
73   - data.remove("autoId");
74   - if (microelements.size() > 0)
75   - {
76   - String response = autoTransfer(data);
77   - if (response.contains("0"))
78   - {
79   - sta.executeUpdate("update BaseInfo set status='1' where AUTOID="+autoId);
80   - conn.commit();
81   - }
82   - }
83   -
84   - }
85   - catch (Exception e) {
86   - try {
87   - conn.rollback();
88   - } catch (SQLException e1) {
89   - e1.printStackTrace();
90   - }
91   - }
92   - finally {
93   - MicroelementConnection.close(conn, sta,rst);
94   - }
95   - }
96   -
97   - public static String autoTransfer(Map<String,Object> data)
98   - {
99   - if (data != null && data.size() > 0)
100   - {
101   - String json = JsonUtil.obj2Str(data);
102   - System.out.println(json);
103   - String result = HttpClientUtil.doPostSSL(url+"/saveMicroelement",json);
104   - System.out.println("http result= "+result);
105   - return result;
106   - }
107   - return "";
108   - }
109   -
110   -}
platform-transfer/src/main/java/com/lyms/platform/worker/BoneWorker.java View file @ 1963bde
  1 +package com.lyms.platform.worker;
  2 +
  3 +import com.lyms.platform.common.utils.HttpClientUtil;
  4 +import com.lyms.platform.common.utils.JsonUtil;
  5 +import com.lyms.platform.common.utils.PropertiesUtils;
  6 +import com.lyms.platform.common.utils.StringUtils;
  7 +import com.lyms.platform.conn.MicroelementConnection;
  8 +
  9 +import java.sql.Connection;
  10 +import java.sql.ResultSet;
  11 +import java.sql.SQLException;
  12 +import java.sql.Statement;
  13 +import java.util.HashMap;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * 骨密度
  18 + */
  19 +public class BoneWorker {
  20 +
  21 + public static final String url = PropertiesUtils.getPropertyValue("url");
  22 +
  23 + public static void getBoneRecords()
  24 + {
  25 + System.out.println("getBoneRecords start");
  26 + Connection conn = null;
  27 + Statement sta = null;
  28 + ResultSet rst = null;
  29 + try {
  30 + conn = MicroelementConnection.getConnection();
  31 + sta = conn.createStatement();
  32 + rst = sta.executeQuery("select PatientID,ZScore,TScore,dbSos,dbBqi,dbRrf,dbEoa,YoungAdult,ageMatched,dbAge from PatientInfo where status is null");
  33 + while (rst.next()) {
  34 + Map map = new HashMap();
  35 +
  36 + String PatientID = rst.getString("PatientID"); //身份证后八位
  37 + //String position = rst.getString("");
  38 + map.put("cardNo",PatientID);
  39 + map.put("position","左侧桡骨远端1/3处");
  40 +
  41 + String ZScore = rst.getString("ZScore");
  42 + String TScore = rst.getString("TScore");
  43 + String dbSos = rst.getString("dbSos");
  44 +
  45 + String bqi = rst.getString("dbBqi");
  46 + String rrf = rst.getString("dbRrf");
  47 + String eoa = rst.getString("dbEoa");
  48 +
  49 + String adultPercent = rst.getString("YoungAdult");
  50 + String agePercent = rst.getString("ageMatched");
  51 + String age = rst.getString("dbAge");
  52 +
  53 + map.put("zvalue",ZScore);
  54 + map.put("tvalue",TScore);
  55 + map.put("sos",dbSos);
  56 +
  57 + map.put("bqi",bqi);
  58 + map.put("rrf",rrf);
  59 + map.put("eoa",eoa);
  60 +
  61 + map.put("adultPercent",adultPercent);
  62 + map.put("agePercent",agePercent);
  63 + map.put("age",age);
  64 +
  65 + if (map.size() > 0 && StringUtils.isNotEmpty(PatientID))
  66 + {
  67 + String response = autoTransfer(map);
  68 + if (response.contains("0"))
  69 + {
  70 + sta.executeUpdate("update PatientInfo set status='1' where PatientID='"+PatientID+"'");
  71 + conn.commit();
  72 + }
  73 + }
  74 + }
  75 + } catch (Exception e) {
  76 + try {
  77 + conn.rollback();
  78 + } catch (SQLException e1) {
  79 + e1.printStackTrace();
  80 + }
  81 + }
  82 + finally {
  83 + MicroelementConnection.close(conn, sta,rst);
  84 + }
  85 + }
  86 +
  87 + public static String autoTransfer(Map<String,Object> data)
  88 + {
  89 + if (data != null && data.size() > 0)
  90 + {
  91 + String json = JsonUtil.obj2Str(data);
  92 + System.out.println(json);
  93 + String result = HttpClientUtil.doPostSSL(url+"/saveBone",json);
  94 + System.out.println("http result= "+result);
  95 + return result;
  96 + }
  97 + return "";
  98 + }
  99 +}
platform-transfer/src/main/java/com/lyms/platform/worker/MicroelementWorker.java View file @ 1963bde
  1 +package com.lyms.platform.worker;
  2 +
  3 +import com.lyms.platform.common.utils.HttpClientUtil;
  4 +import com.lyms.platform.common.utils.JsonUtil;
  5 +import com.lyms.platform.common.utils.PropertiesUtils;
  6 +import com.lyms.platform.common.utils.StringUtils;
  7 +import com.lyms.platform.conn.MicroelementConnection;
  8 +
  9 +import java.sql.Connection;
  10 +import java.sql.ResultSet;
  11 +import java.sql.SQLException;
  12 +import java.sql.Statement;
  13 +import java.util.ArrayList;
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +public class MicroelementWorker {
  19 +
  20 + public static final String url = PropertiesUtils.getPropertyValue("url");
  21 +
  22 + public static void getMicroelementRecords()
  23 + {
  24 + System.out.println("getMicroelementRecords start");
  25 + Connection conn = null;
  26 + Statement sta = null;
  27 + ResultSet rst = null;
  28 + try {
  29 + conn = MicroelementConnection.getConnection();
  30 + sta = conn.createStatement();
  31 + rst = sta.executeQuery("select * from BaseInfo where status is null ");
  32 + while (rst.next()){
  33 + Map<String,Object> data = new HashMap<>();
  34 + String numberCode = rst.getString("编号");
  35 + String autoId = rst.getString("AUTOID");
  36 + data.put("numberCode",numberCode);
  37 + data.put("autoId",autoId);
  38 + getMicroelementRecords(data);
  39 + }
  40 + }
  41 + catch (SQLException e) {
  42 + }
  43 + finally {
  44 + MicroelementConnection.close(conn, sta,rst);
  45 + }
  46 + }
  47 +
  48 +
  49 + public static void getMicroelementRecords(Map<String,Object> data)
  50 + {
  51 + Connection conn = null;
  52 + Statement sta = null;
  53 + ResultSet rst = null;
  54 + try {
  55 + conn = MicroelementConnection.getConnection();
  56 + String autoId = data.get("autoId").toString();
  57 + sta = conn.createStatement();
  58 + rst = sta.executeQuery("select * from ItemsInfo where BaseAutoId = "+autoId);
  59 +
  60 + List<Map> microelements = new ArrayList<>();
  61 + while (rst.next()) {
  62 + Map map = new HashMap();
  63 + String eleName = rst.getString("元素名称");
  64 + String value = rst.getString("测量值");
  65 + String result = StringUtils.checkNum(value);
  66 + map.put("result",result);
  67 + map.put("unit",value.contains("mmol") ? "mmol/l" : (value.contains("umol") ? "umol/l" : "ug/l"));
  68 + map.put("eleName",eleName);
  69 + map.put("refValue","");//TODO
  70 + microelements.add(map);
  71 + }
  72 + data.put("microelements", microelements);
  73 + data.remove("autoId");
  74 + if (microelements.size() > 0)
  75 + {
  76 + String response = autoTransfer(data);
  77 + if (response.contains("0"))
  78 + {
  79 + sta.executeUpdate("update BaseInfo set status='1' where AUTOID="+autoId);
  80 + conn.commit();
  81 + }
  82 + }
  83 +
  84 + }
  85 + catch (Exception e) {
  86 + try {
  87 + conn.rollback();
  88 + } catch (SQLException e1) {
  89 + e1.printStackTrace();
  90 + }
  91 + }
  92 + finally {
  93 + MicroelementConnection.close(conn, sta,rst);
  94 + }
  95 + }
  96 +
  97 + public static String autoTransfer(Map<String,Object> data)
  98 + {
  99 + if (data != null && data.size() > 0)
  100 + {
  101 + String json = JsonUtil.obj2Str(data);
  102 + System.out.println(json);
  103 + String result = HttpClientUtil.doPostSSL(url+"/saveMicroelement",json);
  104 + System.out.println("http result= "+result);
  105 + return result;
  106 + }
  107 + return "";
  108 + }
  109 +
  110 +}
platform-transfer/src/main/resources/spring/applicationContext-quartz.xml View file @ 1963bde
... ... @@ -9,8 +9,8 @@
9 9 http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
10 10 http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
11 11  
12   - <bean id="microelementWorker" class="com.lyms.platform.microelement.MicroelementWorker"></bean>
13   - <bean id="boneWorker" class="com.lyms.platform.bone.BoneWorker"></bean>
  12 + <bean id="microelementWorker" class="com.lyms.platform.worker.MicroelementWorker"></bean>
  13 + <bean id="boneWorker" class="com.lyms.platform.worker.BoneWorker"></bean>
14 14 <!-- 微量元素 -->
15 15 <bean id="microelementWorkTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
16 16 <!-- 要调用的bean -->