Commit bc0039581c7950b427f68908a6b1b0772f5b3aac

Authored by liquanyu
1 parent 4986e6eb39

update

Showing 7 changed files with 544 additions and 7 deletions

platform-transfer/src/main/java/com/lyms/platform/conn/PihConnection.java View file @ bc00395
  1 +package com.lyms.platform.conn;
  2 +
  3 +import com.lyms.platform.conn.inf.BaseConnection;
  4 +
  5 +import java.sql.Connection;
  6 +import java.sql.DriverManager;
  7 +
  8 +/**
  9 + * 妊高症连接
  10 + */
  11 +public class PihConnection extends BaseConnection {
  12 +
  13 + private String path;
  14 + protected PihConnection(String path)
  15 + {
  16 + this.path = path;
  17 + }
  18 +
  19 + @Override
  20 + public Connection getConnection()
  21 + {
  22 + Connection conn = null;
  23 + try {
  24 + Class.forName("com.hxtt.sql.access.AccessDriver");
  25 + String url = "jdbc:Access:///"+path;
  26 + conn = DriverManager.getConnection(url, "", "");
  27 + } catch (Exception e) {
  28 + e.printStackTrace();
  29 + }
  30 + return conn;
  31 + }
  32 +}
platform-transfer/src/main/java/com/lyms/platform/conn/PihConnectionFactory.java View file @ bc00395
  1 +package com.lyms.platform.conn;
  2 +
  3 +
  4 +import com.lyms.platform.conn.inf.ConnectionFactoryMethod;
  5 +import com.lyms.platform.conn.inf.IConnection;
  6 +
  7 +/**
  8 + * 妊高症连接
  9 + */
  10 +public class PihConnectionFactory implements ConnectionFactoryMethod {
  11 + @Override
  12 + public IConnection createConnection(String path) {
  13 + return new BoneConnection(path);
  14 + }
  15 +}
platform-transfer/src/main/java/com/lyms/platform/model/PihModel.java View file @ bc00395
  1 +package com.lyms.platform.model;
  2 +
  3 +
  4 +
  5 +import java.util.Date;
  6 +
  7 +public class PihModel {
  8 +
  9 + private String id;
  10 + private String ssyBT;//收缩压
  11 + private String szyBT;//舒张压
  12 + private String cvp;//脉压
  13 + private String meanAP;//平均动脉压
  14 + private String pbpi;//血压指数
  15 + private String bsa;//体表面积
  16 + private String totalBloodVolume;//总血容量
  17 + private String sff;//波形系数
  18 + private String bmi;//体重指数
  19 + private String cardiacOutput;//心输出力
  20 + private String wzzl;//外周助力
  21 + private String aestheticVolume;//美博量
  22 + private String cl;//心脏指数
  23 + private String cardiacIndex;//心博指数
  24 + private String compliance;//顺应性
  25 + private String heartRate;//心率
  26 + private String cbf;//中心血流量
  27 + private String bloodViscosity;//血液沾度
  28 + private String arTime;//平均滞留时间
  29 +
  30 + private String parameterResult;//分析结果
  31 + private String pulseWave;//脉搏波形
  32 + private String operator;//操作者
  33 + private String suggest;//操作者建议
  34 +
  35 +
  36 + private Date created;//创建时间
  37 + private Date modified; //修改时间
  38 + private String yn;
  39 + private String pid;
  40 + private String patientId;// patient的主键
  41 + private String hospitalId;//医院id
  42 + private int checkWeek; //测量孕周
  43 + private Date lastMenses;
  44 + //患者姓名
  45 + private String name;
  46 + private String phone;
  47 + //身份证号码
  48 + private String cardNo;
  49 + //0.临时数据,1.院内数据
  50 + private Integer state;
  51 + private Date birth;
  52 +
  53 + public String getPhone() {
  54 + return phone;
  55 + }
  56 +
  57 + public void setPhone(String phone) {
  58 + this.phone = phone;
  59 + }
  60 +
  61 + public Date getBirth() {
  62 + return birth;
  63 + }
  64 +
  65 + public void setBirth(Date birth) {
  66 + this.birth = birth;
  67 + }
  68 +
  69 + public int getCheckWeek() {
  70 + return checkWeek;
  71 + }
  72 +
  73 + public void setCheckWeek(int checkWeek) {
  74 + this.checkWeek = checkWeek;
  75 + }
  76 +
  77 + public Date getLastMenses() {
  78 + return lastMenses;
  79 + }
  80 +
  81 + public void setLastMenses(Date lastMenses) {
  82 + this.lastMenses = lastMenses;
  83 + }
  84 +
  85 + public String getPid() {
  86 + return pid;
  87 + }
  88 +
  89 + public void setPid(String pid) {
  90 + this.pid = pid;
  91 + }
  92 +
  93 + public String getName() {
  94 + return name;
  95 + }
  96 +
  97 + public void setName(String name) {
  98 + this.name = name;
  99 + }
  100 +
  101 + public String getCardNo() {
  102 + return cardNo;
  103 + }
  104 +
  105 + public void setCardNo(String cardNo) {
  106 + this.cardNo = cardNo;
  107 + }
  108 +
  109 + public Integer getState() {
  110 + return state;
  111 + }
  112 +
  113 + public void setState(Integer state) {
  114 + this.state = state;
  115 + }
  116 +
  117 + public Date getCreated() {
  118 + return created;
  119 + }
  120 +
  121 + public void setCreated(Date created) {
  122 + this.created = created;
  123 + }
  124 +
  125 + public Date getModified() {
  126 + return modified;
  127 + }
  128 +
  129 + public void setModified(Date modified) {
  130 + this.modified = modified;
  131 + }
  132 +
  133 + public String getYn() {
  134 + return yn;
  135 + }
  136 +
  137 + public void setYn(String yn) {
  138 + this.yn = yn;
  139 + }
  140 +
  141 + public String getPatientId() {
  142 + return patientId;
  143 + }
  144 +
  145 + public void setPatientId(String patientId) {
  146 + this.patientId = patientId;
  147 + }
  148 +
  149 + public String getHospitalId() {
  150 + return hospitalId;
  151 + }
  152 +
  153 + public void setHospitalId(String hospitalId) {
  154 + this.hospitalId = hospitalId;
  155 + }
  156 +
  157 + public String getId() {
  158 + return id;
  159 + }
  160 +
  161 + public void setId(String id) {
  162 + this.id = id;
  163 + }
  164 +
  165 + public String getSsyBT() {
  166 + return ssyBT;
  167 + }
  168 +
  169 + public void setSsyBT(String ssyBT) {
  170 + this.ssyBT = ssyBT;
  171 + }
  172 +
  173 + public String getSzyBT() {
  174 + return szyBT;
  175 + }
  176 +
  177 + public void setSzyBT(String szyBT) {
  178 + this.szyBT = szyBT;
  179 + }
  180 +
  181 + public String getCvp() {
  182 + return cvp;
  183 + }
  184 +
  185 + public void setCvp(String cvp) {
  186 + this.cvp = cvp;
  187 + }
  188 +
  189 + public String getMeanAP() {
  190 + return meanAP;
  191 + }
  192 +
  193 + public void setMeanAP(String meanAP) {
  194 + this.meanAP = meanAP;
  195 + }
  196 +
  197 + public String getPbpi() {
  198 + return pbpi;
  199 + }
  200 +
  201 + public void setPbpi(String pbpi) {
  202 + this.pbpi = pbpi;
  203 + }
  204 +
  205 + public String getBsa() {
  206 + return bsa;
  207 + }
  208 +
  209 + public void setBsa(String bsa) {
  210 + this.bsa = bsa;
  211 + }
  212 +
  213 + public String getTotalBloodVolume() {
  214 + return totalBloodVolume;
  215 + }
  216 +
  217 + public void setTotalBloodVolume(String totalBloodVolume) {
  218 + this.totalBloodVolume = totalBloodVolume;
  219 + }
  220 +
  221 + public String getSff() {
  222 + return sff;
  223 + }
  224 +
  225 + public void setSff(String sff) {
  226 + this.sff = sff;
  227 + }
  228 +
  229 + public String getBmi() {
  230 + return bmi;
  231 + }
  232 +
  233 + public void setBmi(String bmi) {
  234 + this.bmi = bmi;
  235 + }
  236 +
  237 + public String getCardiacOutput() {
  238 + return cardiacOutput;
  239 + }
  240 +
  241 + public void setCardiacOutput(String cardiacOutput) {
  242 + this.cardiacOutput = cardiacOutput;
  243 + }
  244 +
  245 + public String getWzzl() {
  246 + return wzzl;
  247 + }
  248 +
  249 + public void setWzzl(String wzzl) {
  250 + this.wzzl = wzzl;
  251 + }
  252 +
  253 + public String getAestheticVolume() {
  254 + return aestheticVolume;
  255 + }
  256 +
  257 + public void setAestheticVolume(String aestheticVolume) {
  258 + this.aestheticVolume = aestheticVolume;
  259 + }
  260 +
  261 + public String getCl() {
  262 + return cl;
  263 + }
  264 +
  265 + public void setCl(String cl) {
  266 + this.cl = cl;
  267 + }
  268 +
  269 + public String getCardiacIndex() {
  270 + return cardiacIndex;
  271 + }
  272 +
  273 + public void setCardiacIndex(String cardiacIndex) {
  274 + this.cardiacIndex = cardiacIndex;
  275 + }
  276 +
  277 + public String getCompliance() {
  278 + return compliance;
  279 + }
  280 +
  281 + public void setCompliance(String compliance) {
  282 + this.compliance = compliance;
  283 + }
  284 +
  285 + public String getHeartRate() {
  286 + return heartRate;
  287 + }
  288 +
  289 + public void setHeartRate(String heartRate) {
  290 + this.heartRate = heartRate;
  291 + }
  292 +
  293 + public String getCbf() {
  294 + return cbf;
  295 + }
  296 +
  297 + public void setCbf(String cbf) {
  298 + this.cbf = cbf;
  299 + }
  300 +
  301 + public String getBloodViscosity() {
  302 + return bloodViscosity;
  303 + }
  304 +
  305 + public void setBloodViscosity(String bloodViscosity) {
  306 + this.bloodViscosity = bloodViscosity;
  307 + }
  308 +
  309 + public String getArTime() {
  310 + return arTime;
  311 + }
  312 +
  313 + public void setArTime(String arTime) {
  314 + this.arTime = arTime;
  315 + }
  316 +
  317 + public String getParameterResult() {
  318 + return parameterResult;
  319 + }
  320 +
  321 + public void setParameterResult(String parameterResult) {
  322 + this.parameterResult = parameterResult;
  323 + }
  324 +
  325 + public String getPulseWave() {
  326 + return pulseWave;
  327 + }
  328 +
  329 + public void setPulseWave(String pulseWave) {
  330 + this.pulseWave = pulseWave;
  331 + }
  332 +
  333 + public String getOperator() {
  334 + return operator;
  335 + }
  336 +
  337 + public void setOperator(String operator) {
  338 + this.operator = operator;
  339 + }
  340 +
  341 + public String getSuggest() {
  342 + return suggest;
  343 + }
  344 +
  345 + public void setSuggest(String suggest) {
  346 + this.suggest = suggest;
  347 + }
  348 +}
platform-transfer/src/main/java/com/lyms/platform/worker/PihTransferWorker.java View file @ bc00395
  1 +package com.lyms.platform.worker;
  2 +
  3 +import com.lyms.platform.comm.ApplicationProperties;
  4 +import com.lyms.platform.comm.JsonUtil;
  5 +import com.lyms.platform.conn.BoneConnectionFactory;
  6 +import com.lyms.platform.conn.inf.ConnectionFactoryMethod;
  7 +import com.lyms.platform.conn.inf.IConnection;
  8 +import org.apache.commons.httpclient.util.DateUtil;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.io.File;
  13 +import java.io.InputStream;
  14 +import java.sql.Connection;
  15 +import java.sql.ResultSet;
  16 +import java.sql.SQLException;
  17 +import java.sql.Statement;
  18 +import java.util.Date;
  19 +import java.util.HashMap;
  20 +import java.util.Map;
  21 +
  22 +/**
  23 + * 妊高症
  24 + */
  25 +@Component
  26 +public class PihTransferWorker extends TransferAbstract implements ITransfer{
  27 +
  28 + @Autowired
  29 + private ApplicationProperties properties;
  30 +
  31 + @Override
  32 + public void doTransfer() {
  33 + System.out.println("getBoneRecords start");
  34 + Connection conn = null;
  35 + Statement sta = null;
  36 + ResultSet rst = null;
  37 + ConnectionFactoryMethod factoryMethod = new BoneConnectionFactory();
  38 + IConnection iConnection = factoryMethod.createConnection(properties.getDataPath());
  39 + try {
  40 +
  41 + conn = iConnection.getConnection();
  42 + sta = conn.createStatement();
  43 + String sql = "select from PatientInfo where status is null and DayTimeOfSave > "+ DateUtil.formatDate(new Date(),"yyyy-MM-dd");
  44 + rst = sta.executeQuery(sql);
  45 + while (rst.next()) {
  46 + Map map = new HashMap();
  47 +
  48 +// map.put("ssyBT",);//收缩压
  49 +// map.put("szyBT",);//舒张压
  50 +// map.put("cvp",);//脉压
  51 +// map.put("meanAP",);//平均动脉压
  52 +// map.put("pbpi",);//血压指数
  53 +// map.put("bsa",);//体表面积
  54 +// map.put("totalBloodVolume",);//总血容量
  55 +// map.put("sff",);//波形系数
  56 +// map.put("bmi",);//体重指数
  57 +// map.put("cardiacOutput",);//心输出力
  58 +// map.put("wzzl",);//外周助力
  59 +// map.put("aestheticVolume",);//美博量
  60 +// map.put("cl",);//心脏指数
  61 +// map.put("cardiacIndex",);//心博指数
  62 +// map.put("compliance",);//顺应性
  63 +// map.put("heartRate",);//心率
  64 +// map.put("cbf",);//中心血流量
  65 +// map.put("bloodViscosity",);//血液沾度
  66 +// map.put("arTime",);//平均滞留时间
  67 +// map.put("parameterResult",);//分析结果
  68 +// map.put("pulseWave",);//脉搏波形
  69 +// map.put("operator",);//操作者
  70 +// map.put("suggest",);//操作者建议
  71 +
  72 + map.put("type",properties.getType()); //
  73 + map.put("hospitalId",properties.getHospitalId()); //
  74 +
  75 + if (map.size() > 0)
  76 + {
  77 + String response = send(map, properties.getUrl() + "/pih/add");
  78 + Map<String, String> data = JsonUtil.jkstr2Obj(response, Map.class);
  79 + if ("0".equals(String.valueOf(data.get("errorcode")))) {
  80 +
  81 + sta.executeUpdate("update PatientInfo set status='1' where PatientID=''");
  82 + conn.commit();
  83 + }
  84 + }
  85 + }
  86 + } catch (Exception e) {
  87 + try {
  88 + conn.rollback();
  89 + } catch (SQLException e1) {
  90 + e1.printStackTrace();
  91 + }
  92 + }
  93 + finally {
  94 + iConnection.close(conn, sta,rst);
  95 + }
  96 + }
  97 +
  98 + private String readPluseWave(String fileName)
  99 + {
  100 +
  101 + String inputFile="C:\\Users\\Administrator\\Desktop\\test.pcm";
  102 + String outputFile="C:\\Users\\Administrator\\Desktop\\test_result.pcm";
  103 +
  104 +// InputStream inputStream = null;
  105 +// try {
  106 +// inputStream = new FileInputStream(inputFile);
  107 +// }catch (Exception e)
  108 +// {
  109 +//
  110 +// }
  111 +//
  112 +//
  113 +// long fileSize=new File(inputFile).length();
  114 +// System.out.println(fileSize);
  115 +// byte[] allBytes = new byte[(int) fileSize]; //存疑。
  116 +// inputStream.read(allBytes);
  117 +// outputStream.write(allBytes);
  118 +//
  119 +// inputStream.close();
  120 +// outputStream.close();
  121 + return null;
  122 +
  123 + }
  124 +}
platform-transfer/src/main/resources/application-test.yml View file @ bc00395
  1 +#测试环境
  2 +server:
  3 + port: 8888
  4 +
  5 +param:
  6 + #access数据库路径
  7 + data-path: D://EK-8800181001-net_Plus//System//Patient.mdb
  8 + #区域url地址
  9 + url: https://dev-rp-api.healthbaby.com.cn
  10 + type: 0 # 0孕妇 1儿童
  11 + hospital-id: 2100001514 #216
platform-transfer/src/main/resources/application-xlxfy.yml View file @ bc00395
  1 +#兴隆县妇幼保健院骨密配置
  2 +server:
  3 + port: 8888
  4 +
  5 +param:
  6 + #access数据库路径 兴隆县妇幼保健院骨密度地址 D://EK-8800181001-net_Plus//System//Patient.mdb
  7 + data-path: D://EK-8800181001-net_Plus//System//Patient.mdb
  8 + #区域url地址
  9 + url: https://area-chengde-api.healthbaby.com.cn:12356
  10 + type: 0 # 0孕妇 1儿童
  11 + hospital-id: 2100001514 #兴隆县妇幼保健院
platform-transfer/src/main/resources/application.yml View file @ bc00395
1 1 server:
2 2 port: 8888
3 3  
4   -param:
5   - #access数据库路径
6   - data-path: D://EK-8800181001-net_Plus//System//Patient.mdb
7   - #区域url地址
8   - url: https://area-chengde-api.healthbaby.com.cn:12356
9   - type: 0 # 0孕妇 1儿童
10   - hospital-id: 2100001514 #兴隆县妇幼保健院
  4 +spring:
  5 + profiles:
  6 + active: test