From bc0039581c7950b427f68908a6b1b0772f5b3aac Mon Sep 17 00:00:00 2001 From: liquanyu Date: Wed, 17 Jun 2020 17:21:03 +0800 Subject: [PATCH] update --- .../java/com/lyms/platform/conn/PihConnection.java | 32 ++ .../lyms/platform/conn/PihConnectionFactory.java | 15 + .../java/com/lyms/platform/model/PihModel.java | 348 +++++++++++++++++++++ .../lyms/platform/worker/PihTransferWorker.java | 124 ++++++++ .../src/main/resources/application-test.yml | 11 + .../src/main/resources/application-xlxfy.yml | 11 + .../src/main/resources/application.yml | 10 +- 7 files changed, 544 insertions(+), 7 deletions(-) create mode 100644 platform-transfer/src/main/java/com/lyms/platform/conn/PihConnection.java create mode 100644 platform-transfer/src/main/java/com/lyms/platform/conn/PihConnectionFactory.java create mode 100644 platform-transfer/src/main/java/com/lyms/platform/model/PihModel.java create mode 100644 platform-transfer/src/main/java/com/lyms/platform/worker/PihTransferWorker.java create mode 100644 platform-transfer/src/main/resources/application-test.yml create mode 100644 platform-transfer/src/main/resources/application-xlxfy.yml diff --git a/platform-transfer/src/main/java/com/lyms/platform/conn/PihConnection.java b/platform-transfer/src/main/java/com/lyms/platform/conn/PihConnection.java new file mode 100644 index 0000000..8c70d82 --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/conn/PihConnection.java @@ -0,0 +1,32 @@ +package com.lyms.platform.conn; + +import com.lyms.platform.conn.inf.BaseConnection; + +import java.sql.Connection; +import java.sql.DriverManager; + +/** + * 妊高症连接 + */ +public class PihConnection extends BaseConnection { + + private String path; + protected PihConnection(String path) + { + this.path = path; + } + + @Override + public Connection getConnection() + { + Connection conn = null; + try { + Class.forName("com.hxtt.sql.access.AccessDriver"); + String url = "jdbc:Access:///"+path; + conn = DriverManager.getConnection(url, "", ""); + } catch (Exception e) { + e.printStackTrace(); + } + return conn; + } +} diff --git a/platform-transfer/src/main/java/com/lyms/platform/conn/PihConnectionFactory.java b/platform-transfer/src/main/java/com/lyms/platform/conn/PihConnectionFactory.java new file mode 100644 index 0000000..461398d --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/conn/PihConnectionFactory.java @@ -0,0 +1,15 @@ +package com.lyms.platform.conn; + + +import com.lyms.platform.conn.inf.ConnectionFactoryMethod; +import com.lyms.platform.conn.inf.IConnection; + +/** + * 妊高症连接 + */ +public class PihConnectionFactory implements ConnectionFactoryMethod { + @Override + public IConnection createConnection(String path) { + return new BoneConnection(path); + } +} diff --git a/platform-transfer/src/main/java/com/lyms/platform/model/PihModel.java b/platform-transfer/src/main/java/com/lyms/platform/model/PihModel.java new file mode 100644 index 0000000..95b1230 --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/model/PihModel.java @@ -0,0 +1,348 @@ +package com.lyms.platform.model; + + + +import java.util.Date; + +public class PihModel { + + private String id; + private String ssyBT;//收缩压 + private String szyBT;//舒张压 + private String cvp;//脉压 + private String meanAP;//平均动脉压 + private String pbpi;//血压指数 + private String bsa;//体表面积 + private String totalBloodVolume;//总血容量 + private String sff;//波形系数 + private String bmi;//体重指数 + private String cardiacOutput;//心输出力 + private String wzzl;//外周助力 + private String aestheticVolume;//美博量 + private String cl;//心脏指数 + private String cardiacIndex;//心博指数 + private String compliance;//顺应性 + private String heartRate;//心率 + private String cbf;//中心血流量 + private String bloodViscosity;//血液沾度 + private String arTime;//平均滞留时间 + + private String parameterResult;//分析结果 + private String pulseWave;//脉搏波形 + private String operator;//操作者 + private String suggest;//操作者建议 + + + private Date created;//创建时间 + private Date modified; //修改时间 + private String yn; + private String pid; + private String patientId;// patient的主键 + private String hospitalId;//医院id + private int checkWeek; //测量孕周 + private Date lastMenses; + //患者姓名 + private String name; + private String phone; + //身份证号码 + private String cardNo; + //0.临时数据,1.院内数据 + private Integer state; + private Date birth; + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Date getBirth() { + return birth; + } + + public void setBirth(Date birth) { + this.birth = birth; + } + + public int getCheckWeek() { + return checkWeek; + } + + public void setCheckWeek(int checkWeek) { + this.checkWeek = checkWeek; + } + + public Date getLastMenses() { + return lastMenses; + } + + public void setLastMenses(Date lastMenses) { + this.lastMenses = lastMenses; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getModified() { + return modified; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + public String getYn() { + return yn; + } + + public void setYn(String yn) { + this.yn = yn; + } + + public String getPatientId() { + return patientId; + } + + public void setPatientId(String patientId) { + this.patientId = patientId; + } + + public String getHospitalId() { + return hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSsyBT() { + return ssyBT; + } + + public void setSsyBT(String ssyBT) { + this.ssyBT = ssyBT; + } + + public String getSzyBT() { + return szyBT; + } + + public void setSzyBT(String szyBT) { + this.szyBT = szyBT; + } + + public String getCvp() { + return cvp; + } + + public void setCvp(String cvp) { + this.cvp = cvp; + } + + public String getMeanAP() { + return meanAP; + } + + public void setMeanAP(String meanAP) { + this.meanAP = meanAP; + } + + public String getPbpi() { + return pbpi; + } + + public void setPbpi(String pbpi) { + this.pbpi = pbpi; + } + + public String getBsa() { + return bsa; + } + + public void setBsa(String bsa) { + this.bsa = bsa; + } + + public String getTotalBloodVolume() { + return totalBloodVolume; + } + + public void setTotalBloodVolume(String totalBloodVolume) { + this.totalBloodVolume = totalBloodVolume; + } + + public String getSff() { + return sff; + } + + public void setSff(String sff) { + this.sff = sff; + } + + public String getBmi() { + return bmi; + } + + public void setBmi(String bmi) { + this.bmi = bmi; + } + + public String getCardiacOutput() { + return cardiacOutput; + } + + public void setCardiacOutput(String cardiacOutput) { + this.cardiacOutput = cardiacOutput; + } + + public String getWzzl() { + return wzzl; + } + + public void setWzzl(String wzzl) { + this.wzzl = wzzl; + } + + public String getAestheticVolume() { + return aestheticVolume; + } + + public void setAestheticVolume(String aestheticVolume) { + this.aestheticVolume = aestheticVolume; + } + + public String getCl() { + return cl; + } + + public void setCl(String cl) { + this.cl = cl; + } + + public String getCardiacIndex() { + return cardiacIndex; + } + + public void setCardiacIndex(String cardiacIndex) { + this.cardiacIndex = cardiacIndex; + } + + public String getCompliance() { + return compliance; + } + + public void setCompliance(String compliance) { + this.compliance = compliance; + } + + public String getHeartRate() { + return heartRate; + } + + public void setHeartRate(String heartRate) { + this.heartRate = heartRate; + } + + public String getCbf() { + return cbf; + } + + public void setCbf(String cbf) { + this.cbf = cbf; + } + + public String getBloodViscosity() { + return bloodViscosity; + } + + public void setBloodViscosity(String bloodViscosity) { + this.bloodViscosity = bloodViscosity; + } + + public String getArTime() { + return arTime; + } + + public void setArTime(String arTime) { + this.arTime = arTime; + } + + public String getParameterResult() { + return parameterResult; + } + + public void setParameterResult(String parameterResult) { + this.parameterResult = parameterResult; + } + + public String getPulseWave() { + return pulseWave; + } + + public void setPulseWave(String pulseWave) { + this.pulseWave = pulseWave; + } + + public String getOperator() { + return operator; + } + + public void setOperator(String operator) { + this.operator = operator; + } + + public String getSuggest() { + return suggest; + } + + public void setSuggest(String suggest) { + this.suggest = suggest; + } +} diff --git a/platform-transfer/src/main/java/com/lyms/platform/worker/PihTransferWorker.java b/platform-transfer/src/main/java/com/lyms/platform/worker/PihTransferWorker.java new file mode 100644 index 0000000..7b3e56a --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/worker/PihTransferWorker.java @@ -0,0 +1,124 @@ +package com.lyms.platform.worker; + +import com.lyms.platform.comm.ApplicationProperties; +import com.lyms.platform.comm.JsonUtil; +import com.lyms.platform.conn.BoneConnectionFactory; +import com.lyms.platform.conn.inf.ConnectionFactoryMethod; +import com.lyms.platform.conn.inf.IConnection; +import org.apache.commons.httpclient.util.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 妊高症 + */ +@Component +public class PihTransferWorker extends TransferAbstract implements ITransfer{ + + @Autowired + private ApplicationProperties properties; + + @Override + public void doTransfer() { + System.out.println("getBoneRecords start"); + Connection conn = null; + Statement sta = null; + ResultSet rst = null; + ConnectionFactoryMethod factoryMethod = new BoneConnectionFactory(); + IConnection iConnection = factoryMethod.createConnection(properties.getDataPath()); + try { + + conn = iConnection.getConnection(); + sta = conn.createStatement(); + String sql = "select from PatientInfo where status is null and DayTimeOfSave > "+ DateUtil.formatDate(new Date(),"yyyy-MM-dd"); + rst = sta.executeQuery(sql); + while (rst.next()) { + Map map = new HashMap(); + +// map.put("ssyBT",);//收缩压 +// map.put("szyBT",);//舒张压 +// map.put("cvp",);//脉压 +// map.put("meanAP",);//平均动脉压 +// map.put("pbpi",);//血压指数 +// map.put("bsa",);//体表面积 +// map.put("totalBloodVolume",);//总血容量 +// map.put("sff",);//波形系数 +// map.put("bmi",);//体重指数 +// map.put("cardiacOutput",);//心输出力 +// map.put("wzzl",);//外周助力 +// map.put("aestheticVolume",);//美博量 +// map.put("cl",);//心脏指数 +// map.put("cardiacIndex",);//心博指数 +// map.put("compliance",);//顺应性 +// map.put("heartRate",);//心率 +// map.put("cbf",);//中心血流量 +// map.put("bloodViscosity",);//血液沾度 +// map.put("arTime",);//平均滞留时间 +// map.put("parameterResult",);//分析结果 +// map.put("pulseWave",);//脉搏波形 +// map.put("operator",);//操作者 +// map.put("suggest",);//操作者建议 + + map.put("type",properties.getType()); // + map.put("hospitalId",properties.getHospitalId()); // + + if (map.size() > 0) + { + String response = send(map, properties.getUrl() + "/pih/add"); + Map data = JsonUtil.jkstr2Obj(response, Map.class); + if ("0".equals(String.valueOf(data.get("errorcode")))) { + + sta.executeUpdate("update PatientInfo set status='1' where PatientID=''"); + conn.commit(); + } + } + } + } catch (Exception e) { + try { + conn.rollback(); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + finally { + iConnection.close(conn, sta,rst); + } + } + + private String readPluseWave(String fileName) + { + + String inputFile="C:\\Users\\Administrator\\Desktop\\test.pcm"; + String outputFile="C:\\Users\\Administrator\\Desktop\\test_result.pcm"; + +// InputStream inputStream = null; +// try { +// inputStream = new FileInputStream(inputFile); +// }catch (Exception e) +// { +// +// } +// +// +// long fileSize=new File(inputFile).length(); +// System.out.println(fileSize); +// byte[] allBytes = new byte[(int) fileSize]; //存疑。 +// inputStream.read(allBytes); +// outputStream.write(allBytes); +// +// inputStream.close(); +// outputStream.close(); + return null; + + } +} diff --git a/platform-transfer/src/main/resources/application-test.yml b/platform-transfer/src/main/resources/application-test.yml new file mode 100644 index 0000000..08915b9 --- /dev/null +++ b/platform-transfer/src/main/resources/application-test.yml @@ -0,0 +1,11 @@ +#测试环境 +server: + port: 8888 + +param: + #access数据库路径 + data-path: D://EK-8800181001-net_Plus//System//Patient.mdb + #区域url地址 + url: https://dev-rp-api.healthbaby.com.cn + type: 0 # 0孕妇 1儿童 + hospital-id: 2100001514 #216 \ No newline at end of file diff --git a/platform-transfer/src/main/resources/application-xlxfy.yml b/platform-transfer/src/main/resources/application-xlxfy.yml new file mode 100644 index 0000000..38d8270 --- /dev/null +++ b/platform-transfer/src/main/resources/application-xlxfy.yml @@ -0,0 +1,11 @@ +#兴隆县妇幼保健院骨密配置 +server: + port: 8888 + +param: + #access数据库路径 兴隆县妇幼保健院骨密度地址 D://EK-8800181001-net_Plus//System//Patient.mdb + data-path: D://EK-8800181001-net_Plus//System//Patient.mdb + #区域url地址 + url: https://area-chengde-api.healthbaby.com.cn:12356 + type: 0 # 0孕妇 1儿童 + hospital-id: 2100001514 #兴隆县妇幼保健院 \ No newline at end of file diff --git a/platform-transfer/src/main/resources/application.yml b/platform-transfer/src/main/resources/application.yml index 1d603cd..a153cf8 100644 --- a/platform-transfer/src/main/resources/application.yml +++ b/platform-transfer/src/main/resources/application.yml @@ -1,10 +1,6 @@ server: port: 8888 -param: - #access数据库路径 - data-path: D://EK-8800181001-net_Plus//System//Patient.mdb - #区域url地址 - url: https://area-chengde-api.healthbaby.com.cn:12356 - type: 0 # 0孕妇 1儿童 - hospital-id: 2100001514 #兴隆县妇幼保健院 \ No newline at end of file +spring: + profiles: + active: test \ No newline at end of file -- 1.8.3.1