Commit 15e928b5ae615c1216e6d3418083da05ba38ce77

Authored by wtt

Merge remote-tracking branch 'origin/master'

Showing 25 changed files

platform-common/src/main/java/com/lyms/platform/common/utils/AddressUtil.java View file @ 15e928b
... ... @@ -47,7 +47,7 @@
47 47 }
48 48  
49 49 public static void main(String[] ages) {
50   - List<String> addrs = AddressUtil.getAddress("山东省陵城区陵城镇梧桐花园");
  50 + List<String> addrs = AddressUtil.getAddress("山东省德州市陵县陵城镇瑞丰小区");
51 51 for (String ad : addrs) {
52 52 System.out.println(ad);
53 53 }
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java View file @ 15e928b
1 1 package com.lyms.platform.common.utils;
2 2  
  3 +import java.math.BigDecimal;
  4 +import java.text.DecimalFormat;
3 5 import java.util.*;
4 6 import java.util.regex.Matcher;
5 7 import java.util.regex.Pattern;
... ... @@ -265,6 +267,10 @@
265 267 return String.valueOf(str);
266 268 }
267 269  
  270 + public static double formatDouble2(double retainTwoDecimal) {
  271 + BigDecimal bg = new BigDecimal(retainTwoDecimal);
  272 + return bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  273 + }
268 274  
269 275 /**
270 276 * 替换短信中的表达式
platform-dal/src/main/java/com/lyms/platform/pojo/BoneModel.java View file @ 15e928b
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.beans.SerialIdEnum;
4 4 import com.lyms.platform.common.result.BaseModel;
  5 +import com.lyms.platform.common.utils.StringUtils;
5 6 import org.springframework.data.mongodb.core.mapping.Document;
6 7  
7 8 import java.util.Date;
... ... @@ -151,7 +152,8 @@
151 152 }
152 153  
153 154 public void setSos(Double sos) {
154   - this.sos = sos;
  155 +
  156 + this.sos = StringUtils.formatDouble2(sos);
155 157 }
156 158  
157 159 public Double getTvalue() {
... ... @@ -159,7 +161,8 @@
159 161 }
160 162  
161 163 public void setTvalue(Double tvalue) {
162   - this.tvalue = tvalue;
  164 +
  165 + this.tvalue = StringUtils.formatDouble2(tvalue);
163 166 }
164 167  
165 168 public Double getZvalue() {
... ... @@ -167,7 +170,7 @@
167 170 }
168 171  
169 172 public void setZvalue(Double zvalue) {
170   - this.zvalue = zvalue;
  173 + this.zvalue = StringUtils.formatDouble2(zvalue);
171 174 }
172 175  
173 176 public Double getBqi() {
... ... @@ -175,7 +178,7 @@
175 178 }
176 179  
177 180 public void setBqi(Double bqi) {
178   - this.bqi = bqi;
  181 + this.bqi = StringUtils.formatDouble2(bqi);
179 182 }
180 183  
181 184 public Double getRrf() {
... ... @@ -183,7 +186,7 @@
183 186 }
184 187  
185 188 public void setRrf(Double rrf) {
186   - this.rrf = rrf;
  189 + this.rrf = StringUtils.formatDouble2(rrf);
187 190 }
188 191  
189 192 public Double getEoa() {
... ... @@ -191,7 +194,7 @@
191 194 }
192 195  
193 196 public void setEoa(Double eoa) {
194   - this.eoa = eoa;
  197 + this.eoa = StringUtils.formatDouble2(eoa);
195 198 }
196 199  
197 200 public Double getAdultPercent() {
... ... @@ -199,7 +202,7 @@
199 202 }
200 203  
201 204 public void setAdultPercent(Double adultPercent) {
202   - this.adultPercent = adultPercent;
  205 + this.adultPercent = StringUtils.formatDouble2(adultPercent);
203 206 }
204 207  
205 208 public Double getAgePercent() {
... ... @@ -207,7 +210,7 @@
207 210 }
208 211  
209 212 public void setAgePercent(Double agePercent) {
210   - this.agePercent = agePercent;
  213 + this.agePercent = StringUtils.formatDouble2(agePercent);
211 214 }
212 215  
213 216 public Double getAge() {
... ... @@ -215,7 +218,7 @@
215 218 }
216 219  
217 220 public void setAge(Double age) {
218   - this.age = age;
  221 + this.age = StringUtils.formatDouble2(age);
219 222 }
220 223  
221 224 public Integer getType() {
platform-dal/src/main/java/com/lyms/platform/pojo/PreEugenicsBaseModel.java View file @ 15e928b
... ... @@ -365,6 +365,19 @@
365 365 */
366 366 private Map<String, Object> resultAdvice;
367 367  
  368 +
  369 + //0 或者空 未上传国家网 1上传国家网
  370 + private Integer sendCountry;
  371 +
  372 + public Integer getSendCountry() {
  373 + return sendCountry;
  374 + }
  375 +
  376 + public void setSendCountry(Integer sendCountry) {
  377 + this.sendCountry = sendCountry;
  378 + }
  379 +
  380 +
368 381 public String getId() {
369 382 return id;
370 383 }
platform-dal/src/main/java/com/lyms/platform/query/BoneQuery.java View file @ 15e928b
... ... @@ -47,7 +47,9 @@
47 47 private Date lastMensesStart;
48 48 private Date lastMensesEnd;
49 49  
  50 + private Integer result;
50 51  
  52 +
51 53 @Override
52 54 public MongoQuery convertToQuery() {
53 55 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -68,6 +70,10 @@
68 70 condition = condition.and("pid", pid, MongoOper.IS);
69 71 }
70 72  
  73 + if (null != result) {
  74 + condition = condition.and("result", result, MongoOper.IS);
  75 + }
  76 +
71 77 if (CollectionUtils.isNotEmpty(patientIds)) {
72 78 condition = condition.and("patientId", patientIds, MongoOper.IN);
73 79 }
... ... @@ -100,6 +106,14 @@
100 106 condition = condition.andCondition(new MongoCondition(c));
101 107 }
102 108 return condition.toMongoQuery();
  109 + }
  110 +
  111 + public Integer getResult() {
  112 + return result;
  113 + }
  114 +
  115 + public void setResult(Integer result) {
  116 + this.result = result;
103 117 }
104 118  
105 119 public Date getLastMensesEnd() {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BoneController.java View file @ 15e928b
... ... @@ -74,11 +74,12 @@
74 74 @RequestParam(required = false) Integer end,
75 75 @RequestParam(required = false) Integer age,
76 76 @RequestParam(required = false) Integer type,
  77 + @RequestParam(required = false) Integer result,
77 78 @RequestParam(required = true) Integer page,
78 79 @RequestParam(required = true) Integer limit,
79 80 @RequestParam(required = false) String vcCardNo) {
80 81  
81   - return BoneFacade.queryBoneList(queryNo, start, end, age, vcCardNo, type, page, limit, getUserId(request));
  82 + return BoneFacade.queryBoneList(queryNo, start, end, age, vcCardNo, type, result,page, limit, getUserId(request));
82 83  
83 84 }
84 85 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PreEugenicsBaseController.java View file @ 15e928b
... ... @@ -162,5 +162,20 @@
162 162 public BaseResponse setDefectiveChildCheckItem(@PathVariable("id")String id){
163 163 return iPreEugenicsService.setPreEugenicsCheckItem(id);
164 164 }
  165 +
  166 +
  167 +
  168 + /**
  169 + * 标记已经发送国家网
  170 + *
  171 + * @param id
  172 + * @return
  173 + */
  174 + @RequestMapping(method = RequestMethod.GET, value = "/setSendCountry/{id}")
  175 + @ResponseBody
  176 + @TokenRequired
  177 + public BaseResponse setSendCountry(@PathVariable("id")String id) {
  178 + return iPreEugenicsService.setSendCountry(id);
  179 + }
165 180 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BoneFacade.java View file @ 15e928b
... ... @@ -56,12 +56,13 @@
56 56 @Autowired
57 57 private MongoTemplate mongoTemplate;
58 58  
59   - public BaseResponse queryBoneList(String queryNo, Integer start, Integer end, Integer age, String vcCardNo,Integer type ,Integer page, Integer limit, Integer userId) {
  59 + public BaseResponse queryBoneList(String queryNo, Integer start, Integer end, Integer age, String vcCardNo,Integer type ,Integer result,Integer page, Integer limit, Integer userId) {
60 60  
61 61  
62 62 List dataList = new ArrayList();
63 63 String hospitalId = autoMatchFacade.getHospitalId(userId);
64 64 BoneQuery query = new BoneQuery();
  65 + query.setResult(result);
65 66 //孕妇骨密度
66 67 if (type == 0)
67 68 {
... ... @@ -124,6 +125,12 @@
124 125 data.put("cardNo",patients.getCardNo());
125 126 data.put("age", DateUtil.getAge(patients.getBirth(), model.getCreated()));
126 127 data.put("week", DateUtil.getWeekDesc(patients.getLastMenses(), model.getCreated()));
  128 +
  129 + data.put("tvalue", model.getTvalue());
  130 + data.put("sos", model.getSos());
  131 + data.put("position", model.getPosition());
  132 + data.put("result", model.getResult() == 0 ? "正常" : ( model.getResult() == 1 ? "骨质减少" : "骨质疏松"));
  133 +
127 134 data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
128 135 dataList.add(data);
129 136  
... ... @@ -182,6 +189,12 @@
182 189 data.put("mcardNo",babyModel.getMcertNo());
183 190 data.put("age", DateUtil.getBabyMonthAge(babyModel.getBirth(), model.getCreated()));
184 191 data.put("mname", babyModel.getMname());
  192 +
  193 + data.put("zvalue", model.getZvalue());
  194 + data.put("sos", model.getSos());
  195 + data.put("position", model.getPosition());
  196 + data.put("result", model.getResult() == 0 ? "正常" : ( model.getResult() == 1 ? "骨质减少" : "严重骨质减少"));
  197 +
185 198 data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
186 199 dataList.add(data);
187 200  
... ... @@ -222,6 +235,7 @@
222 235 data.put("adultPercent",model.getAdultPercent());
223 236 data.put("agePercent",model.getAgePercent());
224 237 data.put("slAge",model.getAge());
  238 + data.put("result",model.getResult());
225 239 data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
226 240 Date lastMenses = DateUtil.addDay(pat.getLastMenses(),1);
227 241 int week = DateUtil.getWeek(lastMenses,model.getCreated());
228 242  
... ... @@ -231,10 +245,10 @@
231 245 else
232 246 {
233 247 BabyModel babyModel = babyBookbuildingService.queryBabyBuildById(model.getPatientId());
234   - data.put("city", FunvCommonUtil.getBaseicConfigByid(babyModel.getCityId(), basicConfigService));
235   - data.put("area", FunvCommonUtil.getBaseicConfigByid(babyModel.getAreaId(), basicConfigService));
236 248 data.put("userName",babyModel.getName());
237 249 data.put("age", DateUtil.getBabyMonthAge(babyModel.getBirth(), model.getCreated()));
  250 + data.put("ageNum", DateUtil.getMonth(babyModel.getBirth(), model.getCreated()));
  251 + data.put("sex", babyModel.getSex() == null ? "" : SexEnum.getTextById(babyModel.getSex()));
238 252 data.put("position",model.getPosition());
239 253 data.put("sos",model.getSos());
240 254 data.put("tvalue",model.getTvalue());
... ... @@ -245,7 +259,7 @@
245 259 data.put("adultPercent",model.getAdultPercent());
246 260 data.put("agePercent",model.getAgePercent());
247 261 data.put("slAge",model.getAge());
248   - data.put("sex", babyModel.getSex() == null ? "" : SexEnum.getTextById(babyModel.getSex()));
  262 + data.put("result",model.getResult());
249 263 data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
250 264 int month = DateUtil.getBabyAgeMonth(babyModel.getBirth(),model.getCreated());
251 265  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java View file @ 15e928b
... ... @@ -622,6 +622,7 @@
622 622 result.setAreaId(model.getAreaId());
623 623 result.setStreetId(model.getStreetId());
624 624 result.setAddress(model.getAddress());
  625 + result.setChildExtAddrs(model.getChildExtAddrs());
625 626  
626 627 result.setProvinceRegisterId(model.getProvinceRegisterId());
627 628 result.setCityRegisterId(model.getCityRegisterId());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 15e928b
... ... @@ -4991,8 +4991,8 @@
4991 4991 result.setPhone(model.getPhone());
4992 4992 result.setWorkUnit(model.getWorkUnit());
4993 4993 //居住地
4994   - String liveAddress = CommonsHelper.getResidence(model.getProvinceId(), model.getCityId(),
4995   - model.getAreaId(), model.getStreetId(), model.getAddress(), basicConfigService);
  4994 + String liveAddress = CommonsHelper.getResidence(model.getProvinceId(), model.getCityId(),
  4995 + model.getAreaId(), model.getStreetId(),model.getChildExtAddrs(), model.getAddress(), basicConfigService);
4996 4996  
4997 4997 //户籍地址
4998 4998 String addressRegister = CommonsHelper.getResidence(model.getProvinceRegisterId(), model.getCityRegisterId(),
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AntExManagerQueryRequest.java View file @ 15e928b
... ... @@ -86,7 +86,7 @@
86 86 //是否有处理意见 0否 1是
87 87 private Integer isOpinion;
88 88  
89   - //自动诊断试剂
  89 + //自动诊断时间
90 90 private String autoTime;
91 91  
92 92 // 0 未诊断 1已诊断
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PreEugenicsBaseListRequest.java View file @ 15e928b
... ... @@ -57,6 +57,15 @@
57 57 private String area;
58 58 private String street;
59 59  
  60 + private Integer sendCountry;
  61 +
  62 + public Integer getSendCountry() {
  63 + return sendCountry;
  64 + }
  65 +
  66 + public void setSendCountry(Integer sendCountry) {
  67 + this.sendCountry = sendCountry;
  68 + }
60 69  
61 70 public String getSearchType() {
62 71 return searchType;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ResidentsArchiveResult.java View file @ 15e928b
1 1 package com.lyms.platform.operate.web.result;
2 2  
3 3 import java.util.Date;
  4 +import java.util.List;
4 5 import java.util.Map;
5 6  
6 7 /**
... ... @@ -53,6 +54,7 @@
53 54 private String areaId;
54 55 private String streetId;
55 56 private String address;
  57 + private List<String> childExtAddrs;
56 58 //户籍地址
57 59 private String provinceRegisterId;
58 60 private String cityRegisterId;
... ... @@ -162,6 +164,14 @@
162 164  
163 165 // 是否军嫂
164 166 private Integer military;
  167 +
  168 + public List<String> getChildExtAddrs() {
  169 + return childExtAddrs;
  170 + }
  171 +
  172 + public void setChildExtAddrs(List<String> childExtAddrs) {
  173 + this.childExtAddrs = childExtAddrs;
  174 + }
165 175  
166 176 public Integer getMilitary() {
167 177 return military;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IPreEugenicsService.java View file @ 15e928b
... ... @@ -13,5 +13,7 @@
13 13 BaseResponse delete(String id);
14 14  
15 15 BaseResponse setPreEugenicsCheckItem(String id);
  16 +
  17 + BaseResponse setSendCountry(String id);
16 18 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PreEugebicsServiceImpl.java View file @ 15e928b
... ... @@ -279,6 +279,12 @@
279 279 if (StringUtils.isNotEmpty(createUser)) {
280 280 query.addCriteria(Criteria.where("createUser").is(createUser));
281 281 }
  282 +
  283 + Integer sendCountry = param.getSendCountry();
  284 + if (sendCountry != null) {
  285 + query.addCriteria(Criteria.where("sendCountry").is(sendCountry));
  286 + }
  287 +
282 288 String createTime = param.getCreateTime();
283 289 if (StringUtils.isNotEmpty(createTime)) {
284 290 String[] arrs = createTime.split(" - ");
... ... @@ -510,6 +516,22 @@
510 516 PreEugenicsBaseModel model = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), PreEugenicsBaseModel.class);
511 517 if (model != null) {
512 518 lcfyLisService.save(model);
  519 + }
  520 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  521 + }
  522 +
  523 + @Override
  524 + public BaseResponse setSendCountry(String id) {
  525 + PreEugenicsBaseModel model = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), PreEugenicsBaseModel.class);
  526 + if (model != null) {
  527 + if (StringUtils.isEmpty(id)) {
  528 + return new BaseResponse("参数缺失", ErrorCodeConstants.PARAMETER_ERROR);
  529 + }
  530 + model.setSendCountry(1);
  531 + Query query = Query.query(Criteria.where("id").is(id));
  532 + Update update = MongoConvertHelper
  533 + .convertToNativeUpdate(ReflectionUtils.getUpdateField(model));
  534 + mongoTemplate.updateFirst(query, update, PreEugenicsBaseModel.class);
513 535 }
514 536 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
515 537 }
platform-operate-api/src/main/webapp/WEB-INF/lib/IKAnalyzer2012_u6.jar View file @ 15e928b

No preview for this file type

platform-transfer/src/main/java/com/lyms/platform/comm/ApplicationProperties.java View file @ 15e928b
... ... @@ -10,25 +10,16 @@
10 10 @ConfigurationProperties(prefix = "param")
11 11 public class ApplicationProperties {
12 12  
13   - private String microelementPath;
14   - private String bonePath;
  13 + private String dataPath;
15 14 private Integer type;
16 15 private String url;
17 16  
18   - public String getMicroelementPath() {
19   - return microelementPath;
  17 + public String getDataPath() {
  18 + return dataPath;
20 19 }
21 20  
22   - public void setMicroelementPath(String microelementPath) {
23   - this.microelementPath = microelementPath;
24   - }
25   -
26   - public String getBonePath() {
27   - return bonePath;
28   - }
29   -
30   - public void setBonePath(String bonePath) {
31   - this.bonePath = bonePath;
  21 + public void setDataPath(String dataPath) {
  22 + this.dataPath = dataPath;
32 23 }
33 24  
34 25 public Integer getType() {
platform-transfer/src/main/java/com/lyms/platform/worker/BoneTransferWorker.java View file @ 15e928b
  1 +package com.lyms.platform.worker;
  2 +
  3 +import com.lyms.platform.comm.ApplicationProperties;
  4 +import com.lyms.platform.conn.BoneConnectionFactory;
  5 +import com.lyms.platform.conn.inf.ConnectionFactoryMethod;
  6 +import com.lyms.platform.conn.inf.IConnection;
  7 +import org.apache.commons.httpclient.util.DateUtil;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import java.sql.Connection;
  12 +import java.sql.ResultSet;
  13 +import java.sql.SQLException;
  14 +import java.sql.Statement;
  15 +import java.util.Date;
  16 +import java.util.HashMap;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + * 骨密度
  21 + */
  22 +@Component
  23 +public class BoneTransferWorker extends TransferAbstract implements ITransfer{
  24 +
  25 + @Autowired
  26 + private ApplicationProperties properties;
  27 +
  28 + @Override
  29 + public void doTransfer() {
  30 + System.out.println("getBoneRecords start");
  31 + Connection conn = null;
  32 + Statement sta = null;
  33 + ResultSet rst = null;
  34 + ConnectionFactoryMethod factoryMethod = new BoneConnectionFactory();
  35 + IConnection iConnection = factoryMethod.createConnection(properties.getDataPath());
  36 + try {
  37 +
  38 + conn = iConnection.getConnection();
  39 + sta = conn.createStatement();
  40 + String sql = "select PatientID,ZScore,TScore,dbSos,dbBqi,dbRrf,dbEoa,YoungAdult,ageMatched,dbAge,PartDisplayName from PatientInfo where status is null and DayTimeOfSave > "+ DateUtil.formatDate(new Date(),"yyyy-MM-dd");
  41 + rst = sta.executeQuery(sql);
  42 + while (rst.next()) {
  43 + Map map = new HashMap();
  44 +
  45 + String PatientID = rst.getString("PatientID"); //身份证后八位
  46 + //String position = rst.getString("");
  47 + map.put("cardNo",PatientID);
  48 +
  49 + String PartDisplayName = rst.getString("PartDisplayName");
  50 + map.put("position",PartDisplayName);
  51 +
  52 + String ZScore = rst.getString("ZScore");
  53 + String TScore = rst.getString("TScore");
  54 + String dbSos = rst.getString("dbSos");
  55 +
  56 + String bqi = rst.getString("dbBqi");
  57 + String rrf = rst.getString("dbRrf");
  58 + String eoa = rst.getString("dbEoa");
  59 +
  60 + String adultPercent = rst.getString("YoungAdult");
  61 + String agePercent = rst.getString("ageMatched");
  62 + String age = rst.getString("dbAge");
  63 +
  64 + map.put("zvalue",ZScore);
  65 + map.put("tvalue",TScore);
  66 + map.put("sos",dbSos);
  67 +
  68 + map.put("bqi",bqi);
  69 + map.put("rrf",rrf);
  70 + map.put("eoa",eoa);
  71 +
  72 + map.put("adultPercent",adultPercent);
  73 + map.put("agePercent",agePercent);
  74 + map.put("age",age);
  75 + map.put("type",1); //
  76 +
  77 + if (map.size() > 0 && PatientID != null)
  78 + {
  79 + String response = send(map, properties.getUrl() + "/saveBone");
  80 + if (response.contains("0"))
  81 + {
  82 + sta.executeUpdate("update PatientInfo set status='1' where PatientID='"+PatientID+"'");
  83 + conn.commit();
  84 + }
  85 + }
  86 + }
  87 + } catch (Exception e) {
  88 + try {
  89 + conn.rollback();
  90 + } catch (SQLException e1) {
  91 + e1.printStackTrace();
  92 + }
  93 + }
  94 + finally {
  95 + iConnection.close(conn, sta,rst);
  96 + }
  97 + }
  98 +}
platform-transfer/src/main/java/com/lyms/platform/worker/BoneWorker.java View file @ 15e928b
1   -package com.lyms.platform.worker;
2   -
3   -import com.lyms.platform.comm.ApplicationProperties;
4   -import com.lyms.platform.comm.HttpClientUtil;
5   -import com.lyms.platform.comm.JsonUtil;
6   -import com.lyms.platform.conn.BoneConnectionFactory;
7   -import com.lyms.platform.conn.inf.ConnectionFactoryMethod;
8   -import com.lyms.platform.conn.inf.IConnection;
9   -import org.apache.commons.httpclient.util.DateUtil;
10   -import org.springframework.beans.factory.annotation.Autowired;
11   -import org.springframework.scheduling.annotation.Scheduled;
12   -import org.springframework.stereotype.Component;
13   -
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 BoneWorker {
27   -
28   - @Autowired
29   - private ApplicationProperties properties;
30   -
31   - @Scheduled(cron = "0 0/1 * * * ?")
32   - public void getBoneRecords()
33   - {
34   - System.out.println("getBoneRecords start");
35   - Connection conn = null;
36   - Statement sta = null;
37   - ResultSet rst = null;
38   - ConnectionFactoryMethod factoryMethod = new BoneConnectionFactory();
39   - IConnection iConnection = factoryMethod.createConnection(properties.getBonePath());
40   - try {
41   -
42   - conn = iConnection.getConnection();
43   - sta = conn.createStatement();
44   - rst = sta.executeQuery("select PatientID,ZScore,TScore,dbSos,dbBqi,dbRrf,dbEoa,YoungAdult,ageMatched,dbAge,PartDisplayName from PatientInfo where status is null and DayTimeOfSave > #"+ DateUtil.formatDate(new Date(),"yyyy-MM-dd")+"#");
45   - while (rst.next()) {
46   - Map map = new HashMap();
47   -
48   - String PatientID = rst.getString("PatientID"); //身份证后八位
49   - //String position = rst.getString("");
50   - map.put("cardNo",PatientID);
51   -
52   - String PartDisplayName = rst.getString("PartDisplayName");
53   - map.put("position",PartDisplayName);
54   -
55   - String ZScore = rst.getString("ZScore");
56   - String TScore = rst.getString("TScore");
57   - String dbSos = rst.getString("dbSos");
58   -
59   - String bqi = rst.getString("dbBqi");
60   - String rrf = rst.getString("dbRrf");
61   - String eoa = rst.getString("dbEoa");
62   -
63   - String adultPercent = rst.getString("YoungAdult");
64   - String agePercent = rst.getString("ageMatched");
65   - String age = rst.getString("dbAge");
66   -
67   - map.put("zvalue",ZScore);
68   - map.put("tvalue",TScore);
69   - map.put("sos",dbSos);
70   -
71   - map.put("bqi",bqi);
72   - map.put("rrf",rrf);
73   - map.put("eoa",eoa);
74   -
75   - map.put("adultPercent",adultPercent);
76   - map.put("agePercent",agePercent);
77   - map.put("age",age);
78   - map.put("type",1); //
79   -
80   - if (map.size() > 0 && PatientID != null)
81   - {
82   - String response = autoTransfer(map);
83   - if (response.contains("0"))
84   - {
85   - sta.executeUpdate("update PatientInfo set status='1' where PatientID='"+PatientID+"'");
86   - conn.commit();
87   - }
88   - }
89   - }
90   - } catch (Exception e) {
91   - try {
92   - conn.rollback();
93   - } catch (SQLException e1) {
94   - e1.printStackTrace();
95   - }
96   - }
97   - finally {
98   - iConnection.close(conn, sta,rst);
99   - }
100   - }
101   -
102   - public String autoTransfer(Map<String,Object> data)
103   - {
104   - if (data != null && data.size() > 0)
105   - {
106   - String json = JsonUtil.obj2Str(data);
107   - System.out.println(json);
108   - String result = HttpClientUtil.doPostSSL(properties.getUrl() + "/saveBone", json);
109   - System.out.println("http result= "+result);
110   - return result;
111   - }
112   - return "";
113   - }
114   -}
platform-transfer/src/main/java/com/lyms/platform/worker/ITransfer.java View file @ 15e928b
  1 +package com.lyms.platform.worker;
  2 +
  3 +import java.util.Map;
  4 +
  5 +/**
  6 + * Created by Administrator on 2020-03-23.
  7 + */
  8 +public interface ITransfer {
  9 +
  10 + void doTransfer();
  11 +
  12 + String send(Map<String,Object> data,String path);
  13 +}
platform-transfer/src/main/java/com/lyms/platform/worker/MicroelementTransferWorker.java View file @ 15e928b
  1 +package com.lyms.platform.worker;
  2 +
  3 +import com.lyms.platform.comm.ApplicationProperties;
  4 +import com.lyms.platform.comm.StringUtils;
  5 +import com.lyms.platform.conn.*;
  6 +import com.lyms.platform.conn.inf.ConnectionFactoryMethod;
  7 +import com.lyms.platform.conn.inf.IConnection;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import java.sql.Connection;
  12 +import java.sql.ResultSet;
  13 +import java.sql.SQLException;
  14 +import java.sql.Statement;
  15 +import java.util.ArrayList;
  16 +import java.util.HashMap;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +@Component
  20 +public class MicroelementTransferWorker extends TransferAbstract implements ITransfer{
  21 +
  22 + @Autowired
  23 + private ApplicationProperties properties;
  24 +
  25 + public void doTransfer()
  26 + {
  27 + System.out.println("getMicroelementRecords start");
  28 + Connection conn = null;
  29 + Statement sta = null;
  30 + ResultSet rst = null;
  31 +
  32 + ConnectionFactoryMethod factoryMethod = new MicroelementConnectionFactory();
  33 + IConnection iConnection = factoryMethod.createConnection(properties.getDataPath());
  34 + try {
  35 + conn = iConnection.getConnection();
  36 + sta = conn.createStatement();
  37 + rst = sta.executeQuery("select * from BaseInfo where status is null ");
  38 + while (rst.next()){
  39 + Map<String,Object> data = new HashMap();
  40 + String numberCode = rst.getString("编号");
  41 + String autoId = rst.getString("AUTOID");
  42 + data.put("numberCode",numberCode);
  43 + data.put("type",properties.getType());
  44 + data.put("autoId",autoId);
  45 + getMicroelementRecords(data);
  46 + }
  47 + }
  48 + catch (SQLException e) {
  49 + }
  50 + finally {
  51 + iConnection.close(conn, sta,rst);
  52 + }
  53 + }
  54 +
  55 +
  56 + private void getMicroelementRecords(Map<String,Object> data)
  57 + {
  58 + Connection conn = null;
  59 + Statement sta = null;
  60 + ResultSet rst = null;
  61 + ConnectionFactoryMethod factoryMethod = new MicroelementConnectionFactory();
  62 + IConnection iConnection = factoryMethod.createConnection(properties.getDataPath());
  63 + try {
  64 + conn = iConnection.getConnection();
  65 + String autoId = data.get("autoId").toString();
  66 + sta = conn.createStatement();
  67 + rst = sta.executeQuery("select * from ItemsInfo where BaseAutoId = "+autoId);
  68 +
  69 + List<Map> microelements = new ArrayList();
  70 + while (rst.next()) {
  71 + Map map = new HashMap();
  72 + String eleName = rst.getString("元素名称");
  73 + String value = rst.getString("测量值");
  74 + String result = StringUtils.checkNum(value);
  75 + map.put("result",result);
  76 + map.put("unit",value.contains("mmol") ? "mmol/l" : (value.contains("umol") ? "umol/l" : "ug/l"));
  77 + map.put("eleName",eleName);
  78 + map.put("refValue","");//TODO
  79 + microelements.add(map);
  80 + }
  81 + data.put("microelements", microelements);
  82 + data.remove("autoId");
  83 + if (microelements.size() > 0)
  84 + {
  85 + String response = send(data, properties.getUrl() + "/saveMicroelement");
  86 + if (response.contains("0"))
  87 + {
  88 + sta.executeUpdate("update BaseInfo set status='1' where AUTOID="+autoId);
  89 + conn.commit();
  90 + }
  91 + }
  92 + }
  93 + catch (Exception e)
  94 + {
  95 + try {
  96 + conn.rollback();
  97 + } catch (SQLException e1) {
  98 + e1.printStackTrace();
  99 + }
  100 + }
  101 + finally {
  102 + iConnection.close(conn, sta,rst);
  103 + }
  104 + }
  105 +
  106 +}
platform-transfer/src/main/java/com/lyms/platform/worker/MicroelementWorker.java View file @ 15e928b
1   -package com.lyms.platform.worker;
2   -
3   -import com.lyms.platform.comm.ApplicationProperties;
4   -import com.lyms.platform.comm.HttpClientUtil;
5   -import com.lyms.platform.comm.JsonUtil;
6   -import com.lyms.platform.comm.StringUtils;
7   -import com.lyms.platform.conn.*;
8   -import com.lyms.platform.conn.inf.ConnectionFactoryMethod;
9   -import com.lyms.platform.conn.inf.IConnection;
10   -import org.springframework.beans.factory.annotation.Autowired;
11   -import org.springframework.context.annotation.Configuration;
12   -import org.springframework.scheduling.annotation.EnableScheduling;
13   -import org.springframework.scheduling.annotation.Scheduled;
14   -import org.springframework.stereotype.Component;
15   -
16   -import java.sql.Connection;
17   -import java.sql.ResultSet;
18   -import java.sql.SQLException;
19   -import java.sql.Statement;
20   -import java.util.ArrayList;
21   -import java.util.HashMap;
22   -import java.util.List;
23   -import java.util.Map;
24   -@Configuration
25   -@EnableScheduling
26   -@Component
27   -public class MicroelementWorker {
28   -
29   - @Autowired
30   - private ApplicationProperties properties;
31   -
32   - @Scheduled(cron = "0 0/1 * * * ?")
33   - public void getMicroelementRecords()
34   - {
35   - System.out.println("getMicroelementRecords start");
36   - Connection conn = null;
37   - Statement sta = null;
38   - ResultSet rst = null;
39   -
40   - ConnectionFactoryMethod factoryMethod = new MicroelementConnectionFactory();
41   - IConnection iConnection = factoryMethod.createConnection(properties.getMicroelementPath());
42   - try {
43   - conn = iConnection.getConnection();
44   - sta = conn.createStatement();
45   - rst = sta.executeQuery("select * from BaseInfo where status is null ");
46   - while (rst.next()){
47   - Map<String,Object> data = new HashMap();
48   - String numberCode = rst.getString("编号");
49   - String autoId = rst.getString("AUTOID");
50   - data.put("numberCode",numberCode);
51   - data.put("type",properties.getType());
52   - data.put("autoId",autoId);
53   - getMicroelementRecords(data);
54   - }
55   - }
56   - catch (SQLException e) {
57   - }
58   - finally {
59   - iConnection.close(conn, sta,rst);
60   - }
61   - }
62   -
63   -
64   - public void getMicroelementRecords(Map<String,Object> data)
65   - {
66   - Connection conn = null;
67   - Statement sta = null;
68   - ResultSet rst = null;
69   - ConnectionFactoryMethod factoryMethod = new MicroelementConnectionFactory();
70   - IConnection iConnection = factoryMethod.createConnection(properties.getMicroelementPath());
71   - try {
72   - conn = iConnection.getConnection();
73   - String autoId = data.get("autoId").toString();
74   - sta = conn.createStatement();
75   - rst = sta.executeQuery("select * from ItemsInfo where BaseAutoId = "+autoId);
76   -
77   - List<Map> microelements = new ArrayList();
78   - while (rst.next()) {
79   - Map map = new HashMap();
80   - String eleName = rst.getString("元素名称");
81   - String value = rst.getString("测量值");
82   - String result = StringUtils.checkNum(value);
83   - map.put("result",result);
84   - map.put("unit",value.contains("mmol") ? "mmol/l" : (value.contains("umol") ? "umol/l" : "ug/l"));
85   - map.put("eleName",eleName);
86   - map.put("refValue","");//TODO
87   - microelements.add(map);
88   - }
89   - data.put("microelements", microelements);
90   - data.remove("autoId");
91   - if (microelements.size() > 0)
92   - {
93   - String response = autoTransfer(data);
94   - if (response.contains("0"))
95   - {
96   - sta.executeUpdate("update BaseInfo set status='1' where AUTOID="+autoId);
97   - conn.commit();
98   - }
99   - }
100   - }
101   - catch (Exception e)
102   - {
103   - try {
104   - conn.rollback();
105   - } catch (SQLException e1) {
106   - e1.printStackTrace();
107   - }
108   - }
109   - finally {
110   - iConnection.close(conn, sta,rst);
111   - }
112   - }
113   -
114   - public String autoTransfer(Map<String,Object> data)
115   - {
116   - if (data != null && data.size() > 0)
117   - {
118   - String json = JsonUtil.obj2Str(data);
119   - System.out.println(json);
120   - String result = HttpClientUtil.doPostSSL(properties.getUrl() + "/saveMicroelement", json);
121   - System.out.println("http result= "+result);
122   - return result;
123   - }
124   - return "";
125   - }
126   -
127   -}
platform-transfer/src/main/java/com/lyms/platform/worker/TransferAbstract.java View file @ 15e928b
  1 +package com.lyms.platform.worker;
  2 +
  3 +import com.lyms.platform.comm.HttpClientUtil;
  4 +import com.lyms.platform.comm.JsonUtil;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * Created by Administrator on 2020-03-23.
  10 + */
  11 +public abstract class TransferAbstract implements ITransfer {
  12 +
  13 + public abstract void doTransfer();
  14 +
  15 + @Override
  16 + public String send(Map<String,Object> data,String path) {
  17 + if (data != null && data.size() > 0)
  18 + {
  19 + String json = JsonUtil.obj2Str(data);
  20 + System.out.println(json);
  21 + String result = HttpClientUtil.doPostSSL(path, json);
  22 + System.out.println("http result= "+result);
  23 + return result;
  24 + }
  25 + return "";
  26 + }
  27 +}
platform-transfer/src/main/java/com/lyms/platform/worker/TransferWorker.java View file @ 15e928b
  1 +package com.lyms.platform.worker;
  2 +
  3 +import org.springframework.beans.factory.annotation.Autowired;
  4 +import org.springframework.scheduling.annotation.EnableScheduling;
  5 +import org.springframework.scheduling.annotation.Scheduled;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +/**
  9 + * Created by Administrator on 2020-03-23.
  10 + */
  11 +@Component
  12 +@EnableScheduling
  13 +public class TransferWorker extends TransferAbstract implements ITransfer {
  14 +
  15 + @Autowired
  16 + private BoneTransferWorker boneTransferWorker;
  17 +
  18 + @Autowired
  19 + private MicroelementTransferWorker microelementTransferWorker;
  20 +
  21 + @Override
  22 + @Scheduled(cron = "0 0/1 * * * ?")
  23 + public void doTransfer() {
  24 + boneTransferWorker.doTransfer();
  25 + }
  26 +
  27 +
  28 +}
platform-transfer/src/main/resources/application.yml View file @ 15e928b
1 1 server:
2 2 port: 8888
3 3  
4   -
5 4 param:
6   - #微量元素access路径
7   - microelement-path: D://tc.mdb
8   - #骨密度access数据库路径
9   - bone-path: D://EK-8800181001-net_Plus//System//Patient.mdb
  5 + #access数据库路径
  6 + data-path: D://EK-8800181001-net_Plus//System//Patient.mdb
10 7 #区域url地址
11 8 url: https://dev-rp-api.healthbaby.com.cn
12 9 type: 0 # 0孕妇 1儿童