Commit 55c519235d6e50b8d5cc10d63e145105fd7ff290

Authored by liquanyu
1 parent 99400db100

update code

Showing 5 changed files with 429 additions and 361 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/JdbcUtil.java View file @ 55c5192
... ... @@ -226,6 +226,21 @@
226 226 return con;
227 227 }
228 228  
  229 +
  230 + public static Connection getQhdMysqlConnection() {
  231 + Connection con = null;
  232 + try {
  233 + Class.forName("com.mysql.jdbc.Driver");
  234 + String url = "jdbc:mysql://127.0.0.1:3306/platform_dev?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
  235 + String userName = "root";
  236 + String pwd = "";
  237 + con = DriverManager.getConnection(url, userName, pwd);
  238 + } catch (Exception e) {
  239 + e.printStackTrace();
  240 + }
  241 + return con;
  242 + }
  243 +
229 244 public static void freeConnection(Connection connection, PreparedStatement ps, ResultSet rs) {
230 245 try {
231 246 if (rs != null) {
... ... @@ -306,6 +321,9 @@
306 321 return list;
307 322 }
308 323  
  324 +
  325 +
  326 +
309 327 public static Object getOralceSingleObjBySql(String sql) {
310 328 Connection conn = getOracleConnection();
311 329 PreparedStatement pst = null;
... ... @@ -332,6 +350,27 @@
332 350  
333 351 public static Object getMysqlSingleObjBySql(String sql) {
334 352 Connection conn = getMysqlConnection();
  353 + PreparedStatement pst = null;
  354 + ResultSet rs = null;
  355 + try {
  356 + pst = conn.prepareStatement(sql);
  357 + rs = pst.executeQuery();
  358 + int count = rs.getMetaData().getColumnCount();
  359 + for (int i = 1; i <= count; i++) {
  360 + String columnName = rs.getMetaData().getColumnName(i);
  361 + while (rs.next()) {
  362 + return rs.getObject(columnName);
  363 + }
  364 +
  365 + }
  366 + } catch (Exception e) {
  367 + e.printStackTrace();
  368 + } finally {
  369 + freeConnection(conn, pst, rs);
  370 + }
  371 + return null;
  372 + }
  373 + public static Object getQhdMysqlSingleObjBySql(String sql,Connection conn ) {
335 374 PreparedStatement pst = null;
336 375 ResultSet rs = null;
337 376 try {
platform-job-index/src/main/java/com/lyms/platform/job/index/service/SyncDataService.java View file @ 55c5192
... ... @@ -935,7 +935,7 @@
935 935 model.setmLevelId(id);
936 936 }
937 937  
938   - String zhuchanOrg = DataUtil.getString(map.get("PI_BIRTHASPHYXIA"));
  938 + String zhuchanOrg = DataUtil.getString(map.get("PI_HOSPITALNAME"));
939 939 if (zhuchanOrg != null && !"".equals(zhuchanOrg)) {
940 940 String id = DataUtil.getString(JDBCUtil.getMysqlSingleObjBySql("select id from organization where name = '" + zhuchanOrg + "'"));
941 941 model.setDeliverOrg(id);
... ... @@ -1235,6 +1235,14 @@
1235 1235  
1236 1236 public static void main(String[] args)
1237 1237 {
  1238 +// List<Map<String, Object>> list = JDBCUtil.getOracleListDataBySql(" select replace(m.PI_ID,'-','') as ID,m.* from MOMMY_PATIENTINFO m where m.pi_bookbuildinghospitalid='62' " );
  1239 +// for (Map map : list)
  1240 +// {
  1241 +// String zhuchanOrg = DataUtil.getString(map.get("PI_HOSPITALNAME"));
  1242 +// String id = DataUtil.getString(map.get("ID"));
  1243 +// System.out.println(id + " " + zhuchanOrg);
  1244 +// }
  1245 +
1238 1246  
1239 1247 }
1240 1248  
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/FmItem.java View file @ 55c5192
... ... @@ -43,7 +43,7 @@
43 43 private String jsz;//接生者
44 44  
45 45 public String getSyxh() {
46   - return syxh;
  46 + return trim(syxh);
47 47 }
48 48  
49 49 public void setSyxh(String syxh) {
... ... @@ -51,7 +51,7 @@
51 51 }
52 52  
53 53 public String getYexh() {
54   - return yexh;
  54 + return trim(yexh);
55 55 }
56 56  
57 57 public void setYexh(String yexh) {
... ... @@ -59,7 +59,7 @@
59 59 }
60 60  
61 61 public String getJlrq() {
62   - return jlrq;
  62 + return trim(jlrq);
63 63 }
64 64  
65 65 public void setJlrq(String jlrq) {
... ... @@ -67,7 +67,7 @@
67 67 }
68 68  
69 69 public String getSsrq() {
70   - return ssrq;
  70 + return trim(ssrq);
71 71 }
72 72  
73 73 public void setSsrq(String ssrq) {
... ... @@ -75,7 +75,7 @@
75 75 }
76 76  
77 77 public String getSsj() {
78   - return ssj;
  78 + return trim(ssj);
79 79 }
80 80  
81 81 public void setSsj(String ssj) {
... ... @@ -83,7 +83,7 @@
83 83 }
84 84  
85 85 public String getYexb() {
86   - return yexb;
  86 + return trim(yexb);
87 87 }
88 88  
89 89 public void setYexb(String yexb) {
... ... @@ -91,7 +91,7 @@
91 91 }
92 92  
93 93 public String getRc() {
94   - return rc;
  94 + return trim(rc);
95 95 }
96 96  
97 97 public void setRc(String rc) {
... ... @@ -99,7 +99,7 @@
99 99 }
100 100  
101 101 public String getJts() {
102   - return jts;
  102 + return trim(jts);
103 103 }
104 104  
105 105 public void setJts(String jts) {
... ... @@ -107,7 +107,7 @@
107 107 }
108 108  
109 109 public String getDjt() {
110   - return djt;
  110 + return trim(djt);
111 111 }
112 112  
113 113 public void setDjt(String djt) {
... ... @@ -115,7 +115,7 @@
115 115 }
116 116  
117 117 public String getCjc() {
118   - return cjc;
  118 + return trim(cjc);
119 119 }
120 120  
121 121 public void setCjc(String cjc) {
... ... @@ -123,7 +123,7 @@
123 123 }
124 124  
125 125 public String getZx() {
126   - return zx;
  126 + return trim(zx);
127 127 }
128 128  
129 129 public void setZx(String zx) {
... ... @@ -131,7 +131,7 @@
131 131 }
132 132  
133 133 public String getTz() {
134   - return tz;
  134 + return trim(tz);
135 135 }
136 136  
137 137 public void setTz(String tz) {
... ... @@ -139,7 +139,7 @@
139 139 }
140 140  
141 141 public String getSc() {
142   - return sc;
  142 + return trim(sc);
143 143 }
144 144  
145 145 public void setSc(String sc) {
... ... @@ -147,7 +147,7 @@
147 147 }
148 148  
149 149 public String getSh() {
150   - return sh;
  150 + return trim(sh);
151 151 }
152 152  
153 153 public void setSh(String sh) {
... ... @@ -155,7 +155,7 @@
155 155 }
156 156  
157 157 public String getJx() {
158   - return jx;
  158 + return trim(jx);
159 159 }
160 160  
161 161 public void setJx(String jx) {
... ... @@ -163,7 +163,7 @@
163 163 }
164 164  
165 165 public String getYfz() {
166   - return yfz;
  166 + return trim(yfz);
167 167 }
168 168  
169 169 public void setYfz(String yfz) {
... ... @@ -171,7 +171,7 @@
171 171 }
172 172  
173 173 public String getWfz() {
174   - return wfz;
  174 + return trim(wfz);
175 175 }
176 176  
177 177 public void setWfz(String wfz) {
... ... @@ -179,7 +179,7 @@
179 179 }
180 180  
181 181 public String getSfz() {
182   - return sfz;
  182 + return trim(sfz);
183 183 }
184 184  
185 185 public void setSfz(String sfz) {
... ... @@ -187,7 +187,7 @@
187 187 }
188 188  
189 189 public String getPfz() {
190   - return pfz;
  190 + return trim(pfz);
191 191 }
192 192  
193 193 public void setPfz(String pfz) {
... ... @@ -195,7 +195,7 @@
195 195 }
196 196  
197 197 public String getCcqk() {
198   - return ccqk;
  198 + return trim(ccqk);
199 199 }
200 200  
201 201 public void setCcqk(String ccqk) {
... ... @@ -203,7 +203,7 @@
203 203 }
204 204  
205 205 public String getFmfs() {
206   - return fmfs;
  206 + return trim(fmfs);
207 207 }
208 208  
209 209 public void setFmfs(String fmfs) {
... ... @@ -211,7 +211,7 @@
211 211 }
212 212  
213 213 public String getTpmcfs() {
214   - return tpmcfs;
  214 + return trim(tpmcfs);
215 215 }
216 216  
217 217 public void setTpmcfs(String tpmcfs) {
... ... @@ -219,7 +219,7 @@
219 219 }
220 220  
221 221 public String getYeqk() {
222   - return yeqk;
  222 + return trim(yeqk);
223 223 }
224 224  
225 225 public void setYeqk(String yeqk) {
... ... @@ -227,7 +227,7 @@
227 227 }
228 228  
229 229 public String getSw() {
230   - return sw;
  230 + return trim(sw);
231 231 }
232 232  
233 233 public void setSw(String sw) {
... ... @@ -235,7 +235,7 @@
235 235 }
236 236  
237 237 public String getSffq() {
238   - return sffq;
  238 + return trim(sffq);
239 239 }
240 240  
241 241 public void setSffq(String sffq) {
... ... @@ -243,7 +243,7 @@
243 243 }
244 244  
245 245 public String getFqyy() {
246   - return fqyy;
  246 + return trim(fqyy);
247 247 }
248 248  
249 249 public void setFqyy(String fqyy) {
... ... @@ -251,7 +251,7 @@
251 251 }
252 252  
253 253 public String getHyqk() {
254   - return hyqk;
  254 + return trim(hyqk);
255 255 }
256 256  
257 257 public void setHyqk(String hyqk) {
... ... @@ -267,7 +267,7 @@
267 267 }
268 268  
269 269 public String getYc() {
270   - return yc;
  270 + return trim(yc);
271 271 }
272 272  
273 273 public void setYc(String yc) {
... ... @@ -275,7 +275,7 @@
275 275 }
276 276  
277 277 public String getSfgw() {
278   - return sfgw;
  278 + return trim(sfgw);
279 279 }
280 280  
281 281 public void setSfgw(String sfgw) {
... ... @@ -283,7 +283,7 @@
283 283 }
284 284  
285 285 public String getMctpslxl() {
286   - return mctpslxl;
  286 + return trim(mctpslxl);
287 287 }
288 288  
289 289 public void setMctpslxl(String mctpslxl) {
... ... @@ -291,7 +291,7 @@
291 291 }
292 292  
293 293 public String getChexxsxl() {
294   - return chexxsxl;
  294 + return trim(chexxsxl);
295 295 }
296 296  
297 297 public void setChexxsxl(String chexxsxl) {
... ... @@ -299,7 +299,7 @@
299 299 }
300 300  
301 301 public String getQjqk() {
302   - return qjqk;
  302 + return trim(qjqk);
303 303 }
304 304  
305 305 public void setQjqk(String qjqk) {
... ... @@ -307,7 +307,7 @@
307 307 }
308 308  
309 309 public String getSrks() {
310   - return srks;
  310 + return trim(srks);
311 311 }
312 312  
313 313 public void setSrks(String srks) {
314 314  
... ... @@ -315,11 +315,20 @@
315 315 }
316 316  
317 317 public String getJsz() {
318   - return jsz;
  318 + return trim(jsz);
319 319 }
320 320  
321 321 public void setJsz(String jsz) {
322 322 this.jsz = jsz;
  323 + }
  324 +
  325 + public String trim(String str)
  326 + {
  327 + if (str != null)
  328 + {
  329 + return str.trim();
  330 + }
  331 + return "";
323 332 }
324 333  
325 334 @Override
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java View file @ 55c5192
... ... @@ -45,9 +45,9 @@
45 45 private UsersService usersService;
46 46  
47 47 public void fmTimerWork() {
48   - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  48 + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
49 49 Date end = new Date();
50   - Date start = new Date(end.getTime()-1000*60*60*24*6);
  50 + Date start = new Date(end.getTime()-1000*60*60);
51 51 String startStr = fmt.format(start);
52 52 String endStr = fmt.format(end);
53 53 System.out.println("start="+startStr+"end="+endStr);
54 54  
55 55  
56 56  
57 57  
58 58  
59 59  
60 60  
... ... @@ -98,329 +98,304 @@
98 98 QueryRunner queryRunner = new QueryRunner();
99 99 SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHH:mm:ss");
100 100 SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
101   - try {//select count(*) from JHMK_FMJL where CONVERT(varchar(16),SSRQ, 20) > CONVERT(varchar(16),'20170110', 20)
102   - List<FmItem> list = queryRunner.query(conn, "select "+cloumns+" from JHMK_FMJL where " +
103   - " CONVERT(varchar(50),SSRQ, 20) > CONVERT(varchar(50),'"+start+"', 20) and CONVERT(varchar(50),SSRQ, 20) <= CONVERT(varchar(50),'"+end+"', 20)" +
104   - " and SYXH not in (select SYXH from JHMK_FMJL where JSZ is not null and SC is not null and TZ is not null and YFZ is not null and SH is not null and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 '))", new BeanListHandler<FmItem>(FmItem.class));
  101 + try {
  102 + String sql ="select "+cloumns+" from JHMK_FMJL where " +
  103 + " CONVERT(DATETIME,left(SSRQ,8)+' '+RIGHT(SSRQ,8),20) > CONVERT(DATETIME,'"+start+"', 120) and CONVERT(DATETIME,left(SSRQ,8)+' '+RIGHT(SSRQ,8),20) <= CONVERT(DATETIME,'"+end+"', 120)" +
  104 + " and SYXH not in (select SYXH from JHMK_FMJL where JSZ is not null and SC is not null and TZ is not null and YFZ is not null and SH is not null" +
  105 + " and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 '))";
  106 + List<FmItem> list = queryRunner.query(conn, sql, new BeanListHandler<FmItem>(FmItem.class));
  107 + ExceptionUtils.catchException("size=" + list.size());
  108 + if (CollectionUtils.isNotEmpty(list)) {
  109 + for (FmItem item : list) {
  110 + try {
  111 + String dueDateStr = item.getSsrq();
  112 + if (!StringUtils.isNotEmpty(dueDateStr)) {
  113 + continue;
  114 + }
  115 + Date dueDate = fmt.parse(dueDateStr);
  116 + FmPatInfo patInfo = getFmPatInfoById(item.getSyxh());
  117 + if (patInfo != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patInfo.getLXDH())) {
  118 + PatientsQuery query = new PatientsQuery();
  119 + query.setYn(YnEnums.YES.getId());
  120 + query.setType(1); //孕妇
  121 + query.setDueStatus(0); //未终止妊娠
  122 + query.setPhone(patInfo.getLXDH());
  123 + List<Patients> patientses = patientsService.queryPatient(query);
  124 + if (CollectionUtils.isNotEmpty(patientses)) {
  125 + Patients patient = patientses.get(0);
  126 + UsersQuery usersQuery = new UsersQuery();
  127 + usersQuery.setName(item.getJsz());
  128 + usersQuery.setYn(YnEnums.YES.getId());
  129 + List<Users> users = usersService.queryUsers(usersQuery);
  130 + if (!CollectionUtils.isNotEmpty(users)) {
  131 + usersQuery.setName("产房");
  132 + users = usersService.queryUsers(usersQuery);
  133 + }
105 134  
106   - ExceptionUtils.catchException("size="+list.size());
  135 + if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null) {
  136 + MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
107 137  
108   - if (CollectionUtils.isNotEmpty(list)) {
109   - for (FmItem item : list)
110   - {
111   - FmPatInfo patInfo = getFmPatInfoById(item.getSyxh());
112   - System.out.println("patinfo="+patInfo);
113   - System.out.println("item="+item);
114   - }
115   - }
  138 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(item.getSsrq())) {
  139 + continue;
  140 + }
116 141  
  142 + deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
  143 + deliverAddRequest.setParentId(patient.getId());
  144 + deliverAddRequest.setPid(patient.getPid());
  145 + if (StringUtils.isNotEmpty(item.getRc())) {
  146 + String week = "";
  147 + if (item.getRc().split("\\u002B").length > 1) {
  148 + week = item.getRc().split("\\u002B")[0] + "周";
  149 + week += item.getRc().split("\\u002B")[1] + "天";
  150 + } else {
  151 + week = item.getRc() + "周";
  152 + week += item.getJts() + "天";
  153 + }
  154 + deliverAddRequest.setDueWeek(week);
  155 + }
117 156  
118   -// if (CollectionUtils.isNotEmpty(list)) {
119   -// for(FmItem item : list)
120   -// {
121   -// String dueDateStr = item.getSsrq();
122   -// if (!StringUtils.isNotEmpty(dueDateStr))
123   -// {
124   -// continue;
125   -// }
126   -// Date dueDate = fmt.parse(dueDateStr);
127   -// FmPatInfo patInfo = getFmPatInfoById(item.getSyxh());
128   -// if (patInfo != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patInfo.getLXDH()))
129   -// {
130   -// PatientsQuery query = new PatientsQuery();
131   -// query.setYn(YnEnums.YES.getId());
132   -// query.setType(1); //孕妇
133   -// query.setDueStatus(0); //未终止妊娠
134   -// query.setPhone(patInfo.getLXDH());
135   -// List<Patients> patientses = patientsService.queryPatient(query);
136   -// if (CollectionUtils.isNotEmpty(patientses))
137   -// {
138   -// Patients patient = patientses.get(0);
139   -//
140   -// UsersQuery usersQuery = new UsersQuery();
141   -// usersQuery.setName(item.getJsz());
142   -// usersQuery.setYn(YnEnums.YES.getId());
143   -// List<Users> users = usersService.queryUsers(usersQuery);
144   -// if (!CollectionUtils.isNotEmpty(users))
145   -// {
146   -// usersQuery.setName("产房");
147   -// users = usersService.queryUsers(usersQuery);
148   -// }
149   -//
150   -// if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null)
151   -// {
152   -// MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
153   -//
154   -// if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(item.getSsrq()))
155   -// {
156   -// continue;
157   -// }
158   -//
159   -// deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
160   -// deliverAddRequest.setParentId(patient.getId());
161   -// deliverAddRequest.setPid(patient.getPid());
162   -// if (StringUtils.isNotEmpty(item.getRc()))
163   -// {
164   -// String week = "";
165   -// if (item.getRc().split("\\u002B").length > 1)
166   -// {
167   -// week = item.getRc().split("\\u002B")[0]+"周";
168   -// week+= item.getRc().split("\\u002B")[1]+"天";
169   -// }
170   -// else
171   -// {
172   -// week = item.getRc()+"周";
173   -// week+=item.getJts()+"天";
174   -// }
175   -// deliverAddRequest.setDueWeek(week);
176   -// }
177   -//
178   -// deliverAddRequest.setTireNumber(1);//TODO 胎数
179   -// deliverAddRequest.setPlacenta("1");//TODO 胎盘
180   -//
181   -// if ("完好".equals(item.getHyqk()))
182   -// {
183   -// deliverAddRequest.setPerinealCondition("full");
184   -// }
185   -// else if ("会阴切开".equals(item.getHyqk()))
186   -// {
187   -// deliverAddRequest.setPerinealCondition("split");
188   -// }
189   -//
190   -// if ("一度裂伤".equals(item.getHyqk()))
191   -// {
192   -// deliverAddRequest.setSiLielevel(1);
193   -// }
194   -// else if ("二度裂伤".equals(item.getHyqk()))
195   -// {
196   -// deliverAddRequest.setSiLielevel(2);
197   -// }
198   -// else if ("三度裂伤".equals(item.getHyqk()))
199   -// {
200   -// deliverAddRequest.setSiLielevel(3);
201   -// }
202   -//
203   -// if (StringUtils.isNotEmpty(item.getChexxsxl()))
204   -// {
205   -// deliverAddRequest.settHloseBloodL(Double.parseDouble(item.getChexxsxl()));
206   -// }
207   -//
208   -// //胎盘信息
209   -// List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
210   -// MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
211   -// extPlacenta.setMcType(FmTypeEnums.getIdByName(item.getFmfs())); //分娩方式
212   -// String tpmcType = "";
213   -// if ("手术产".equals(item.getTpmcfs()))
214   -// {
215   -// tpmcType = TpmcTypeEnums.O2.getId();
216   -// }
217   -// else if ("自然产出".equals(item.getTpmcfs()))
218   -// {
219   -// tpmcType = TpmcTypeEnums.O.getId();
220   -// }
221   -// extPlacenta.setTpmcType(tpmcType);
222   -// extPlacentas.add(extPlacenta);
223   -//
224   -// //儿童
225   -// List<MaternalDeliverModel.Baby> babies = new ArrayList<>();
226   -// MaternalDeliverModel.Baby baby = new MaternalDeliverModel.Baby();
227   -// Map<String,String> as = new HashMap<>();
228   -// as.put("pf1", item.getYfz());
229   -// as.put("pf5", item.getWfz());
230   -// as.put("pf10", item.getSfz());
231   -// baby.setApgarScore(JsonUtil.obj2JsonString(as));
232   -// baby.setBabyGender("男".equals(item.getYexb()) ? "1" : "0");
233   -// baby.setBabyHeight(item.getSc());//新生儿生长
234   -// baby.setBabyWeight(item.getTz());//新生儿重量
235   -// baby.setDeformity("无".equals(item.getJx()) ? 0 : 1); //畸形 0非畸形 1畸形
236   -// baby.setAsphyxiaM(item.getZx()); //窒息分钟
237   -// baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(item.getCcqk())); // 妊娠结局
238   -// baby.setBabyHealthy(item.getYeqk()); //新生儿疾病
239   -// baby.setDueTime(fmt1.format(dueDate));//分娩时间
240   -// babies.add(baby);
241   -// matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId());
242   -// }
243   -//
244   -// }
245   -// }
246   -// }
247   -// }
  157 + deliverAddRequest.setTireNumber(1);//TODO 胎数
  158 + deliverAddRequest.setPlacenta("1");//TODO 胎盘
248 159  
  160 + if ("完好".equals(item.getHyqk())) {
  161 + deliverAddRequest.setPerinealCondition("full");
  162 + } else if ("会阴切开".equals(item.getHyqk())) {
  163 + deliverAddRequest.setPerinealCondition("split");
  164 + }
  165 +
  166 + if ("一度裂伤".equals(item.getHyqk())) {
  167 + deliverAddRequest.setSiLielevel(1);
  168 + } else if ("二度裂伤".equals(item.getHyqk())) {
  169 + deliverAddRequest.setSiLielevel(2);
  170 + } else if ("三度裂伤".equals(item.getHyqk())) {
  171 + deliverAddRequest.setSiLielevel(3);
  172 + }
  173 +
  174 + if (StringUtils.isNotEmpty(item.getChexxsxl())) {
  175 + deliverAddRequest.settHloseBloodL(Double.parseDouble(item.getChexxsxl()));
  176 + }
  177 +
  178 + //胎盘信息
  179 + List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
  180 + MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
  181 + extPlacenta.setMcType(FmTypeEnums.getIdByName(item.getFmfs())); //分娩方式
  182 + String tpmcType = "";
  183 + if ("手术产".equals(item.getTpmcfs())) {
  184 + tpmcType = TpmcTypeEnums.O2.getId();
  185 + } else if ("自然产出".equals(item.getTpmcfs())) {
  186 + tpmcType = TpmcTypeEnums.O.getId();
  187 + }
  188 + extPlacenta.setTpmcType(tpmcType);
  189 + extPlacentas.add(extPlacenta);
  190 +
  191 + //儿童
  192 + List<MaternalDeliverModel.Baby> babies = new ArrayList<>();
  193 + MaternalDeliverModel.Baby baby = new MaternalDeliverModel.Baby();
  194 + Map<String, String> as = new HashMap<>();
  195 + as.put("pf1", item.getYfz());
  196 + as.put("pf5", item.getWfz());
  197 + as.put("pf10", item.getSfz());
  198 + baby.setApgarScore(JsonUtil.obj2JsonString(as));
  199 + baby.setBabyGender(" 男 ".equals(item.getYexb()) ? "1" : "0");
  200 + baby.setBabyHeight(item.getSc());//新生儿生长
  201 + baby.setBabyWeight(item.getTz());//新生儿重量
  202 + baby.setDeformity("无".equals(item.getJx()) ? 0 : 1); //畸形 0非畸形 1畸形
  203 + baby.setAsphyxiaM(item.getZx()); //窒息分钟
  204 + baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(item.getCcqk())); // 妊娠结局
  205 + baby.setBabyHealthy(item.getYeqk()); //新生儿疾病
  206 + baby.setDueTime(fmt1.format(dueDate));//分娩时间
  207 + babies.add(baby);
  208 + deliverAddRequest.setFmHospital("216"); //设置为秦皇岛分娩医院
  209 +
  210 + matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId());
  211 + }
  212 +
  213 + }
  214 + }
  215 +
  216 + } catch (Exception e)
  217 + {
  218 + ExceptionUtils.catchException(e, "数据异常");
  219 + continue;
  220 + }
  221 + }
  222 + }
  223 +
249 224 List<FmItem> duoTaiList = queryRunner.query(conn, "select * from JHMK_FMJL where JSZ is not null and SC is not null and TZ is not null and YFZ is not null " +
250 225 " and SH is not null and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 ') and " +
251   - " CONVERT(varchar(50),SSRQ, 20) > CONVERT(varchar(50),'"+start+"', 20) and CONVERT(varchar(50),SSRQ, 20) <= CONVERT(varchar(50),'"+end+"', 20)", new BeanListHandler<FmItem>(FmItem.class));
252   -// if (CollectionUtils.isNotEmpty(duoTaiList)) {
253   -// Map<String,List<FmItem>> maps = new HashMap<>();
254   -// for(FmItem item : duoTaiList)
255   -// {
256   -// if (maps.containsKey(item.getSyxh()))
257   -// {
258   -// maps.get(item.getSyxh()).add(item);
259   -// }
260   -// else
261   -// {
262   -// List items = new ArrayList<FmItem>();
263   -// items.add(item);
264   -// maps.put(item.getSyxh(),items);
265   -// }
266   -//
267   -// }
268   -// if (maps.size() > 0)
269   -// {
270   -// for(String key : maps.keySet())
271   -// {
272   -// List<FmItem> items = maps.get(key);
273   -// FmItem item = items.get(0);
274   -//
275   -// String dueDateStr = item.getSsrq();
276   -// if (!StringUtils.isNotEmpty(dueDateStr))
277   -// {
278   -// continue;
279   -// }
280   -// Date dueDate = fmt.parse(dueDateStr);
281   -// FmPatInfo patInfo = getFmPatInfoById(item.getSyxh());
282   -// if (patInfo != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patInfo.getLXDH()))
283   -// {
284   -// PatientsQuery query = new PatientsQuery();
285   -// query.setYn(YnEnums.YES.getId());
286   -// query.setType(1); //孕妇
287   -// query.setDueStatus(0); //未终止妊娠
288   -// query.setPhone(patInfo.getLXDH());
289   -// List<Patients> patientses = patientsService.queryPatient(query);
290   -// if (CollectionUtils.isNotEmpty(patientses))
291   -// {
292   -// Patients patient = patientses.get(0);
293   -//
294   -// UsersQuery usersQuery = new UsersQuery();
295   -// usersQuery.setName(item.getJsz());
296   -// usersQuery.setYn(YnEnums.YES.getId());
297   -// List<Users> users = usersService.queryUsers(usersQuery);
298   -// if (!CollectionUtils.isNotEmpty(users))
299   -// {
300   -// usersQuery.setName("产房");
301   -// users = usersService.queryUsers(usersQuery);
302   -// }
303   -//
304   -// if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null)
305   -// {
306   -// MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
307   -//
308   -// if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(item.getSsrq()))
309   -// {
310   -// continue;
311   -// }
312   -//
313   -// deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
314   -// deliverAddRequest.setParentId(patient.getId());
315   -// deliverAddRequest.setPid(patient.getPid());
316   -// if (StringUtils.isNotEmpty(item.getRc()))
317   -// {
318   -// String week = "";
319   -// if (item.getRc().split("\\u002B").length > 1)
320   -// {
321   -// week = item.getRc().split("\\u002B")[0]+"周";
322   -// week+= item.getRc().split("\\u002B")[1]+"天";
323   -// }
324   -// else
325   -// {
326   -// week = item.getRc()+"周";
327   -// week+=item.getJts()+"天";
328   -// }
329   -// deliverAddRequest.setDueWeek(week);
330   -// }
331   -//
332   -// deliverAddRequest.setTireNumber(items.size());//TODO 胎数
333   -// deliverAddRequest.setPlacenta(items.size()+"");//TODO 胎盘
334   -//
335   -// if ("完好".equals(item.getHyqk()))
336   -// {
337   -// deliverAddRequest.setPerinealCondition("full");
338   -// }
339   -// else if ("会阴切开".equals(item.getHyqk()))
340   -// {
341   -// deliverAddRequest.setPerinealCondition("split");
342   -// }
343   -//
344   -// if ("一度裂伤".equals(item.getHyqk()))
345   -// {
346   -// deliverAddRequest.setSiLielevel(1);
347   -// }
348   -// else if ("二度裂伤".equals(item.getHyqk()))
349   -// {
350   -// deliverAddRequest.setSiLielevel(2);
351   -// }
352   -// else if ("三度裂伤".equals(item.getHyqk()))
353   -// {
354   -// deliverAddRequest.setSiLielevel(3);
355   -// }
356   -//
357   -// if (StringUtils.isNotEmpty(item.getChexxsxl()))
358   -// {
359   -// deliverAddRequest.settHloseBloodL(Double.parseDouble(item.getChexxsxl()));
360   -// }
361   -//
362   -// //胎盘信息
363   -// List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
364   -// //儿童
365   -// List<MaternalDeliverModel.Baby> babies = new ArrayList<>();
366   -//
367   -// for (FmItem item1 : items)
368   -// {
369   -//
370   -// String dueDateStr1 = item1.getSsrq();
371   -// if (!StringUtils.isNotEmpty(dueDateStr1))
372   -// {
373   -// continue;
374   -// }
375   -// Date dueDate1 = fmt.parse(dueDateStr1);
376   -//
377   -// MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
378   -// extPlacenta.setMcType(FmTypeEnums.getIdByName(item1.getFmfs())); //分娩方式
379   -// String tpmcType = "";
380   -// if ("手术产".equals(item1.getTpmcfs()))
381   -// {
382   -// tpmcType = TpmcTypeEnums.O2.getId();
383   -// }
384   -// else if ("自然产出".equals(item1.getTpmcfs()))
385   -// {
386   -// tpmcType = TpmcTypeEnums.O.getId();
387   -// }
388   -// extPlacenta.setTpmcType(tpmcType);
389   -// extPlacentas.add(extPlacenta);
390   -//
391   -// MaternalDeliverModel.Baby baby = new MaternalDeliverModel.Baby();
392   -// Map<String,String> as = new HashMap<>();
393   -// as.put("pf1",item1.getYfz());
394   -// as.put("pf5",item1.getWfz());
395   -// as.put("pf10", item1.getSfz());
396   -// baby.setApgarScore(JsonUtil.obj2JsonString(as));
397   -// baby.setBabyGender("男".equals(item1.getYexb()) ? "1" : "0");
398   -// baby.setBabyHeight(item1.getSc());//新生儿生长
399   -// baby.setBabyWeight(item1.getTz());//新生儿重量
400   -// baby.setDeformity("无".equals(item1.getJx()) ? 0 : 1); //畸形 0非畸形 1畸形
401   -// baby.setAsphyxiaM(item1.getZx()); //窒息分钟
402   -// baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(item1.getCcqk())); // 妊娠结局
403   -// baby.setBabyHealthy(item1.getYeqk()); //新生儿疾病
404   -// baby.setDueTime(fmt1.format(dueDate1));//分娩时间
405   -// babies.add(baby);
406   -//
407   -// }
408   -// matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId());
409   -// }
410   -//
411   -// }
412   -// }
413   -// }
414   -// }
415   -// }
  226 + " CONVERT(DATETIME,left(SSRQ,8)+' '+RIGHT(SSRQ,8),20) > CONVERT(DATETIME,'"+start+"', 120) and CONVERT(DATETIME,left(SSRQ,8)+' '+RIGHT(SSRQ,8),20) <= CONVERT(DATETIME,'"+end+"', 120)", new BeanListHandler<FmItem>(FmItem.class));
  227 + if (CollectionUtils.isNotEmpty(duoTaiList)) {
  228 + Map<String,List<FmItem>> maps = new HashMap<>();
  229 + for(FmItem item : duoTaiList)
  230 + {
  231 + if (maps.containsKey(item.getSyxh()))
  232 + {
  233 + maps.get(item.getSyxh()).add(item);
  234 + }
  235 + else
  236 + {
  237 + List items = new ArrayList<FmItem>();
  238 + items.add(item);
  239 + maps.put(item.getSyxh(),items);
  240 + }
  241 +
  242 + }
  243 + if (maps.size() > 0)
  244 + {
  245 + for(String key : maps.keySet())
  246 + {
  247 + List<FmItem> items = maps.get(key);
  248 + FmItem item = items.get(0);
  249 +
  250 + String dueDateStr = item.getSsrq();
  251 + if (!StringUtils.isNotEmpty(dueDateStr))
  252 + {
  253 + continue;
  254 + }
  255 + Date dueDate = fmt.parse(dueDateStr);
  256 + FmPatInfo patInfo = getFmPatInfoById(item.getSyxh());
  257 + if (patInfo != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patInfo.getLXDH()))
  258 + {
  259 + PatientsQuery query = new PatientsQuery();
  260 + query.setYn(YnEnums.YES.getId());
  261 + query.setType(1); //孕妇
  262 + query.setDueStatus(0); //未终止妊娠
  263 + query.setPhone(patInfo.getLXDH());
  264 + List<Patients> patientses = patientsService.queryPatient(query);
  265 + if (CollectionUtils.isNotEmpty(patientses))
  266 + {
  267 + Patients patient = patientses.get(0);
  268 +
  269 + UsersQuery usersQuery = new UsersQuery();
  270 + usersQuery.setName(item.getJsz());
  271 + usersQuery.setYn(YnEnums.YES.getId());
  272 + List<Users> users = usersService.queryUsers(usersQuery);
  273 + if (!CollectionUtils.isNotEmpty(users))
  274 + {
  275 + usersQuery.setName("产房");
  276 + users = usersService.queryUsers(usersQuery);
  277 + }
  278 +
  279 + if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null)
  280 + {
  281 + MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
  282 +
  283 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(item.getSsrq()))
  284 + {
  285 + continue;
  286 + }
  287 +
  288 + deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
  289 + deliverAddRequest.setParentId(patient.getId());
  290 + deliverAddRequest.setPid(patient.getPid());
  291 + if (StringUtils.isNotEmpty(item.getRc()))
  292 + {
  293 + String week = "";
  294 + if (item.getRc().split("\\u002B").length > 1)
  295 + {
  296 + week = item.getRc().split("\\u002B")[0]+"周";
  297 + week+= item.getRc().split("\\u002B")[1]+"天";
  298 + }
  299 + else
  300 + {
  301 + week = item.getRc()+"周";
  302 + week+=item.getJts()+"天";
  303 + }
  304 + deliverAddRequest.setDueWeek(week);
  305 + }
  306 +
  307 + deliverAddRequest.setTireNumber(items.size());//TODO 胎数
  308 + deliverAddRequest.setPlacenta(items.size()+"");//TODO 胎盘
  309 +
  310 + if ("完好".equals(item.getHyqk()))
  311 + {
  312 + deliverAddRequest.setPerinealCondition("full");
  313 + }
  314 + else if ("会阴切开".equals(item.getHyqk()))
  315 + {
  316 + deliverAddRequest.setPerinealCondition("split");
  317 + }
  318 +
  319 + if ("一度裂伤".equals(item.getHyqk()))
  320 + {
  321 + deliverAddRequest.setSiLielevel(1);
  322 + }
  323 + else if ("二度裂伤".equals(item.getHyqk()))
  324 + {
  325 + deliverAddRequest.setSiLielevel(2);
  326 + }
  327 + else if ("三度裂伤".equals(item.getHyqk()))
  328 + {
  329 + deliverAddRequest.setSiLielevel(3);
  330 + }
  331 +
  332 + if (StringUtils.isNotEmpty(item.getChexxsxl()))
  333 + {
  334 + deliverAddRequest.settHloseBloodL(Double.parseDouble(item.getChexxsxl()));
  335 + }
  336 +
  337 + //胎盘信息
  338 + List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
  339 + //儿童
  340 + List<MaternalDeliverModel.Baby> babies = new ArrayList<>();
  341 +
  342 + for (FmItem item1 : items)
  343 + {
  344 +
  345 + String dueDateStr1 = item1.getSsrq();
  346 + if (!StringUtils.isNotEmpty(dueDateStr1))
  347 + {
  348 + continue;
  349 + }
  350 + Date dueDate1 = fmt.parse(dueDateStr1);
  351 +
  352 + MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
  353 + extPlacenta.setMcType(FmTypeEnums.getIdByName(item1.getFmfs())); //分娩方式
  354 + String tpmcType = "";
  355 + if ("手术产".equals(item1.getTpmcfs()))
  356 + {
  357 + tpmcType = TpmcTypeEnums.O2.getId();
  358 + }
  359 + else if ("自然产出".equals(item1.getTpmcfs()))
  360 + {
  361 + tpmcType = TpmcTypeEnums.O.getId();
  362 + }
  363 + extPlacenta.setTpmcType(tpmcType);
  364 + extPlacentas.add(extPlacenta);
  365 +
  366 + MaternalDeliverModel.Baby baby = new MaternalDeliverModel.Baby();
  367 + Map<String,String> as = new HashMap<>();
  368 + as.put("pf1",item1.getYfz());
  369 + as.put("pf5",item1.getWfz());
  370 + as.put("pf10", item1.getSfz());
  371 + baby.setApgarScore(JsonUtil.obj2JsonString(as));
  372 + baby.setBabyGender("男".equals(item1.getYexb()) ? "1" : "0");
  373 + baby.setBabyHeight(item1.getSc());//新生儿生长
  374 + baby.setBabyWeight(item1.getTz());//新生儿重量
  375 + baby.setDeformity("无".equals(item1.getJx()) ? 0 : 1); //畸形 0非畸形 1畸形
  376 + baby.setAsphyxiaM(item1.getZx()); //窒息分钟
  377 + baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(item1.getCcqk())); // 妊娠结局
  378 + baby.setBabyHealthy(item1.getYeqk()); //新生儿疾病
  379 + baby.setDueTime(fmt1.format(dueDate1));//分娩时间
  380 + babies.add(baby);
  381 +
  382 + }
  383 + deliverAddRequest.setFmHospital("216");
  384 + matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId());
  385 + }
  386 +
  387 + }
  388 + }
  389 + }
  390 + }
  391 + }
416 392 DbUtils.closeQuietly(conn);
417 393 } catch (SQLException e) {
418 394 ExceptionUtils.catchException(e, "sql执行异常");
419 395 e.printStackTrace();
420   -// } catch (ParseException e) {
421   -// ExceptionUtils.catchException(e,"分娩日期解析错误");
422   -// e.printStackTrace();
423   -// }
  396 + } catch (ParseException e) {
  397 + ExceptionUtils.catchException(e,"分娩日期解析错误");
  398 + e.printStackTrace();
424 399 }finally {
425 400 DbUtils.closeQuietly(conn);
426 401 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 55c5192
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3 import com.lyms.hospitalapi.qhdfy.QhdfyHisService;
  4 +import com.lyms.platform.biz.JdbcUtil;
4 5 import com.lyms.platform.biz.service.*;
5 6 import com.lyms.platform.common.enums.YnEnums;
6 7 import com.lyms.platform.common.utils.CompressEncodeingUtil;
7 8 import com.lyms.platform.common.utils.DateUtil;
  9 +import com.lyms.platform.common.utils.ExceptionUtils;
8 10 import com.lyms.platform.common.utils.JsonUtil;
9 11 import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade;
10 12 import com.lyms.platform.operate.web.facade.BabyCheckFacade;
... ... @@ -30,6 +32,7 @@
30 32 import org.springframework.web.bind.annotation.ResponseBody;
31 33  
32 34 import java.io.File;
  35 +import java.io.IOException;
33 36 import java.util.*;
34 37  
35 38 /**
36 39  
37 40  
38 41  
... ... @@ -944,26 +947,60 @@
944 947 return "updateBabyFmHospital finish";
945 948 }
946 949  
  950 + @RequestMapping(value = "/updateBabyFmHid", method = RequestMethod.GET)
  951 + @ResponseBody
  952 + public String updateBabyFmHid(@RequestParam(required = true) String hid) {
  953 + List<String> list = null;
  954 + try {
  955 + list = FileUtils.readLines(new File("D:\\QHD.csv"), "gbk");
  956 + for (String line:list) {
  957 + String ss[] = line.split(",");
  958 + if (ss.length > 1 && ss[0].trim().length() > 0) {
  959 + if (ss[0] != null)
  960 + {
  961 + String id = ss[0].replace("-","");
  962 + String name = ss[1];
  963 + String oid = (String)JdbcUtil.getQhdMysqlSingleObjBySql("select id from organization where name = '" + name + "'",JdbcUtil.getQhdMysqlConnection());
  964 + BabyModelQuery babyModelQuery = new BabyModelQuery();
  965 + babyModelQuery.setYn(YnEnums.YES.getId());
  966 + babyModelQuery.setId(id);
  967 +
  968 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  969 + if (CollectionUtils.isNotEmpty(models) && com.lyms.platform.common.utils.StringUtils.isNotEmpty(oid)) {
  970 + BabyModel model = models.get(0);
  971 + model.setDeliverOrg(oid);
  972 + babyBookbuildingService.updateBabyBuild(model, model.getId());
  973 + }
  974 + }
  975 + }
  976 + }
  977 + } catch (IOException e) {
  978 + ExceptionUtils.catchException(e,"跟新异常");
  979 + e.printStackTrace();
  980 + }
  981 + return "updateBabyFmHid finish";
  982 + }
  983 +
947 984 public static void main(String[] a) {
948 985 try {
949   - List<String> list = FileUtils.readLines(new File("D:\\temp\\qhdfy_lost1.csv"));
  986 + List<String> list = FileUtils.readLines(new File("D:\\QHD.csv"), "gbk");
950 987 List<String> linenums = new ArrayList<>();
951 988 for (String line:list) {
952 989 String ss[] = line.split(",");
953 990 if (ss.length > 0 && ss[0].trim().length() > 0) {
954   - linenums.add(ss[0].trim());
  991 + System.out.println(ss[0]+" "+ ss[1]);
955 992 }
956 993 }
957   - List<String> list1 = FileUtils.readLines(new File("D:\\temp\\qhd-jd.csv"), "utf-8");
958   - StringBuffer sb = new StringBuffer();
959   - for (String line:list1) {
960   - String ss[] = line.split(",");
961   - if (ss.length > 0 && ss[0].trim().length() > 0 && linenums.contains(ss[0].trim())) {
962   - sb.append(line);
963   - sb.append("\r\n");
964   - }
965   - }
966   - FileUtils.writeStringToFile(new File("d:\\temp\\qhdfy_lost_data.csv"), sb.toString());
  994 +// List<String> list1 = FileUtils.readLines(new File("D:\\temp\\qhd-jd.csv"), "utf-8");
  995 +// StringBuffer sb = new StringBuffer();
  996 +// for (String line:list1) {
  997 +// String ss[] = line.split(",");
  998 +// if (ss.length > 0 && ss[0].trim().length() > 0 && linenums.contains(ss[0].trim())) {
  999 +// sb.append(line);
  1000 +// sb.append("\r\n");
  1001 +// }
  1002 +// }
  1003 +// FileUtils.writeStringToFile(new File("d:\\temp\\qhdfy_lost_data.csv"), sb.toString());
967 1004 } catch (Exception e) {
968 1005 e.printStackTrace();
969 1006 }