diff --git a/platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java b/platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java deleted file mode 100644 index a393cbb..0000000 --- a/platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.lyms.platform.microelement; - -import com.lyms.platform.common.utils.HttpClientUtil; -import com.lyms.platform.common.utils.JsonUtil; -import com.lyms.platform.common.utils.PropertiesUtils; -import com.lyms.platform.common.utils.StringUtils; -import com.lyms.platform.conn.MicroelementConnection; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class MicroelementWorker { - - public static final String url = PropertiesUtils.getPropertyValue("url"); - - public static void getMicroelementRecords() - { - System.out.println("getMicroelementRecords start"); - Connection conn = null; - Statement sta = null; - ResultSet rst = null; - try { - conn = MicroelementConnection.getConnection(); - sta = conn.createStatement(); - rst = sta.executeQuery("select * from BaseInfo where status is null "); - while (rst.next()){ - Map data = new HashMap<>(); - String numberCode = rst.getString("编号"); - String autoId = rst.getString("AUTOID"); - data.put("numberCode",numberCode); - data.put("autoId",autoId); - getMicroelementRecords(data); - } - } - catch (SQLException e) { - } - finally { - MicroelementConnection.close(conn, sta,rst); - } - } - - - public static void getMicroelementRecords(Map data) - { - Connection conn = null; - Statement sta = null; - ResultSet rst = null; - try { - conn = MicroelementConnection.getConnection(); - String autoId = data.get("autoId").toString(); - sta = conn.createStatement(); - rst = sta.executeQuery("select * from ItemsInfo where BaseAutoId = "+autoId); - - List microelements = new ArrayList<>(); - while (rst.next()) { - Map map = new HashMap(); - String eleName = rst.getString("元素名称"); - String value = rst.getString("测量值"); - String result = StringUtils.checkNum(value); - map.put("result",result); - map.put("unit",value.contains("mmol") ? "mmol/l" : (value.contains("umol") ? "umol/l" : "ug/l")); - map.put("eleName",eleName); - map.put("refValue","");//TODO - microelements.add(map); - } - data.put("microelements", microelements); - data.remove("autoId"); - if (microelements.size() > 0) - { - String response = autoTransfer(data); - if (response.contains("0")) - { - sta.executeUpdate("update BaseInfo set status='1' where AUTOID="+autoId); - conn.commit(); - } - } - - } - catch (Exception e) { - try { - conn.rollback(); - } catch (SQLException e1) { - e1.printStackTrace(); - } - } - finally { - MicroelementConnection.close(conn, sta,rst); - } - } - - public static String autoTransfer(Map data) - { - if (data != null && data.size() > 0) - { - String json = JsonUtil.obj2Str(data); - System.out.println(json); - String result = HttpClientUtil.doPostSSL(url+"/saveMicroelement",json); - System.out.println("http result= "+result); - return result; - } - return ""; - } - -} diff --git a/platform-transfer/src/main/java/com/lyms/platform/worker/BoneWorker.java b/platform-transfer/src/main/java/com/lyms/platform/worker/BoneWorker.java new file mode 100644 index 0000000..bac6619 --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/worker/BoneWorker.java @@ -0,0 +1,99 @@ +package com.lyms.platform.worker; + +import com.lyms.platform.common.utils.HttpClientUtil; +import com.lyms.platform.common.utils.JsonUtil; +import com.lyms.platform.common.utils.PropertiesUtils; +import com.lyms.platform.common.utils.StringUtils; +import com.lyms.platform.conn.MicroelementConnection; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Map; + +/** + * 骨密度 + */ +public class BoneWorker { + + public static final String url = PropertiesUtils.getPropertyValue("url"); + + public static void getBoneRecords() + { + System.out.println("getBoneRecords start"); + Connection conn = null; + Statement sta = null; + ResultSet rst = null; + try { + conn = MicroelementConnection.getConnection(); + sta = conn.createStatement(); + rst = sta.executeQuery("select PatientID,ZScore,TScore,dbSos,dbBqi,dbRrf,dbEoa,YoungAdult,ageMatched,dbAge from PatientInfo where status is null"); + while (rst.next()) { + Map map = new HashMap(); + + String PatientID = rst.getString("PatientID"); //身份证后八位 + //String position = rst.getString(""); + map.put("cardNo",PatientID); + map.put("position","左侧桡骨远端1/3处"); + + String ZScore = rst.getString("ZScore"); + String TScore = rst.getString("TScore"); + String dbSos = rst.getString("dbSos"); + + String bqi = rst.getString("dbBqi"); + String rrf = rst.getString("dbRrf"); + String eoa = rst.getString("dbEoa"); + + String adultPercent = rst.getString("YoungAdult"); + String agePercent = rst.getString("ageMatched"); + String age = rst.getString("dbAge"); + + map.put("zvalue",ZScore); + map.put("tvalue",TScore); + map.put("sos",dbSos); + + map.put("bqi",bqi); + map.put("rrf",rrf); + map.put("eoa",eoa); + + map.put("adultPercent",adultPercent); + map.put("agePercent",agePercent); + map.put("age",age); + + if (map.size() > 0 && StringUtils.isNotEmpty(PatientID)) + { + String response = autoTransfer(map); + if (response.contains("0")) + { + sta.executeUpdate("update PatientInfo set status='1' where PatientID='"+PatientID+"'"); + conn.commit(); + } + } + } + } catch (Exception e) { + try { + conn.rollback(); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + finally { + MicroelementConnection.close(conn, sta,rst); + } + } + + public static String autoTransfer(Map data) + { + if (data != null && data.size() > 0) + { + String json = JsonUtil.obj2Str(data); + System.out.println(json); + String result = HttpClientUtil.doPostSSL(url+"/saveBone",json); + System.out.println("http result= "+result); + return result; + } + return ""; + } +} diff --git a/platform-transfer/src/main/java/com/lyms/platform/worker/MicroelementWorker.java b/platform-transfer/src/main/java/com/lyms/platform/worker/MicroelementWorker.java new file mode 100644 index 0000000..4ed07f8 --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/worker/MicroelementWorker.java @@ -0,0 +1,110 @@ +package com.lyms.platform.worker; + +import com.lyms.platform.common.utils.HttpClientUtil; +import com.lyms.platform.common.utils.JsonUtil; +import com.lyms.platform.common.utils.PropertiesUtils; +import com.lyms.platform.common.utils.StringUtils; +import com.lyms.platform.conn.MicroelementConnection; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MicroelementWorker { + + public static final String url = PropertiesUtils.getPropertyValue("url"); + + public static void getMicroelementRecords() + { + System.out.println("getMicroelementRecords start"); + Connection conn = null; + Statement sta = null; + ResultSet rst = null; + try { + conn = MicroelementConnection.getConnection(); + sta = conn.createStatement(); + rst = sta.executeQuery("select * from BaseInfo where status is null "); + while (rst.next()){ + Map data = new HashMap<>(); + String numberCode = rst.getString("编号"); + String autoId = rst.getString("AUTOID"); + data.put("numberCode",numberCode); + data.put("autoId",autoId); + getMicroelementRecords(data); + } + } + catch (SQLException e) { + } + finally { + MicroelementConnection.close(conn, sta,rst); + } + } + + + public static void getMicroelementRecords(Map data) + { + Connection conn = null; + Statement sta = null; + ResultSet rst = null; + try { + conn = MicroelementConnection.getConnection(); + String autoId = data.get("autoId").toString(); + sta = conn.createStatement(); + rst = sta.executeQuery("select * from ItemsInfo where BaseAutoId = "+autoId); + + List microelements = new ArrayList<>(); + while (rst.next()) { + Map map = new HashMap(); + String eleName = rst.getString("元素名称"); + String value = rst.getString("测量值"); + String result = StringUtils.checkNum(value); + map.put("result",result); + map.put("unit",value.contains("mmol") ? "mmol/l" : (value.contains("umol") ? "umol/l" : "ug/l")); + map.put("eleName",eleName); + map.put("refValue","");//TODO + microelements.add(map); + } + data.put("microelements", microelements); + data.remove("autoId"); + if (microelements.size() > 0) + { + String response = autoTransfer(data); + if (response.contains("0")) + { + sta.executeUpdate("update BaseInfo set status='1' where AUTOID="+autoId); + conn.commit(); + } + } + + } + catch (Exception e) { + try { + conn.rollback(); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + finally { + MicroelementConnection.close(conn, sta,rst); + } + } + + public static String autoTransfer(Map data) + { + if (data != null && data.size() > 0) + { + String json = JsonUtil.obj2Str(data); + System.out.println(json); + String result = HttpClientUtil.doPostSSL(url+"/saveMicroelement",json); + System.out.println("http result= "+result); + return result; + } + return ""; + } + +} diff --git a/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml b/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml index 7c98cb4..31a1b20 100644 --- a/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml +++ b/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml @@ -9,8 +9,8 @@ http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> - - + +