Commit 4997989b006e322ae822996f570c181f519b32c7
1 parent
f22dc7e60f
Exists in
master
and in
1 other branch
update
Showing 11 changed files with 350 additions and 128 deletions
- platform-common/src/main/java/com/lyms/platform/common/Test.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/hs/JDBCUtil.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/hs/SyncBaseInfoService.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/hs/SyncHsPatientService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SyncHsDataController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
platform-common/src/main/java/com/lyms/platform/common/Test.java
View file @
4997989
1 | 1 | package com.lyms.platform.common; |
2 | 2 | |
3 | 3 | |
4 | +import com.lyms.platform.common.utils.DateUtil; | |
5 | +import com.lyms.platform.common.utils.StringUtils; | |
4 | 6 | |
7 | +import java.util.Date; | |
8 | + | |
5 | 9 | public class Test { |
6 | 10 | public static void main(String[] args) { |
11 | + String fmWeekStr = "37+2"; | |
12 | + Date da = DateUtil.parseYMD("0001-01-01"); | |
13 | + System.out.println(da); | |
7 | 14 | |
8 | 15 | } |
9 | 16 |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
4997989
... | ... | @@ -370,11 +370,15 @@ |
370 | 370 | if (d == null) { |
371 | 371 | return null; |
372 | 372 | } |
373 | + lock.lock(); | |
373 | 374 | try { |
374 | 375 | return y_m_d_h_m.format(d); |
375 | 376 | } catch (Exception e) { |
376 | 377 | return null; |
377 | 378 | } |
379 | + finally { | |
380 | + lock.unlock(); | |
381 | + } | |
378 | 382 | } |
379 | 383 | |
380 | 384 | |
381 | 385 | |
... | ... | @@ -624,11 +628,15 @@ |
624 | 628 | if (d == null) { |
625 | 629 | return null; |
626 | 630 | } |
631 | + lock.lock(); | |
627 | 632 | try { |
628 | 633 | return y_m_d_h_m_s.format(d); |
629 | 634 | } catch (Exception e) { |
630 | 635 | return null; |
631 | 636 | } |
637 | + finally { | |
638 | + lock.unlock(); | |
639 | + } | |
632 | 640 | } |
633 | 641 | |
634 | 642 | |
... | ... | @@ -1569,9 +1577,12 @@ |
1569 | 1577 | |
1570 | 1578 | public static void main(String[] args) { |
1571 | 1579 | |
1572 | - Date start = DateUtil.addDay(parseDate("2020-02-18"),1); | |
1573 | - Date end = parseDate("2020-03-01"); | |
1574 | - System.out.println(getWeek(start, end)); | |
1580 | + Date last = parseDate("2020-02-29"); | |
1581 | + | |
1582 | + | |
1583 | + Date st = DateUtil.addDay(last, 280); | |
1584 | + | |
1585 | + System.out.println(getyyyy_MM_dd(st)); | |
1575 | 1586 | } |
1576 | 1587 | |
1577 | 1588 | } |
platform-operate-api/src/main/java/com/lyms/hospitalapi/hs/JDBCUtil.java
View file @
4997989
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | // static String oracle_name = "LYMS_ODS"; |
21 | 21 | // static String oracle_pwd = "Welcome1"; |
22 | 22 | |
23 | - static String mysql_url = "jdbc:mysql://127.0.0.1:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
23 | + static String mysql_url = "jdbc:mysql://127.0.0.1:3306/platform_cert?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
24 | 24 | static String mysql_name = "lyms_chengdu"; |
25 | 25 | static String mysql_pwd = "Lyms123456"; |
26 | 26 | |
... | ... | @@ -52,7 +52,7 @@ |
52 | 52 | return con; |
53 | 53 | } |
54 | 54 | |
55 | - public static void closeConnection(Connection connection, PreparedStatement ps, ResultSet rs) { | |
55 | + public static void closeConnection(Connection connection, Statement ps, ResultSet rs) { | |
56 | 56 | try { |
57 | 57 | if (rs != null) { |
58 | 58 | rs.close(); |
... | ... | @@ -137,6 +137,25 @@ |
137 | 137 | closeConnection(conn, pst, rs); |
138 | 138 | } |
139 | 139 | return list; |
140 | + } | |
141 | + | |
142 | + | |
143 | + | |
144 | + | |
145 | + public static int mysqlUpdate(String sql) { | |
146 | + Connection conn = getMysqlConnection(); | |
147 | + Statement pst = null; | |
148 | + ResultSet rs = null; | |
149 | + List<Map<String, Object>> list = new ArrayList<>(); | |
150 | + try { | |
151 | + pst = conn.createStatement(); | |
152 | + return pst.executeUpdate(sql); | |
153 | + } catch (Exception e) { | |
154 | + e.printStackTrace(); | |
155 | + } finally { | |
156 | + closeConnection(conn, pst, rs); | |
157 | + } | |
158 | + return 0; | |
140 | 159 | } |
141 | 160 | |
142 | 161 | public static Object getOralceSingleObjBySql(String sql) { |
platform-operate-api/src/main/java/com/lyms/hospitalapi/hs/SyncBaseInfoService.java
View file @
4997989
... | ... | @@ -3,7 +3,9 @@ |
3 | 3 | import com.lyms.platform.biz.service.BasicConfigService; |
4 | 4 | import com.lyms.platform.common.enums.UserTypeEnum; |
5 | 5 | import com.lyms.platform.common.enums.YnEnums; |
6 | +import com.lyms.platform.common.utils.DateUtil; | |
6 | 7 | import com.lyms.platform.common.utils.MD5Utils; |
8 | +import com.lyms.platform.common.utils.StringUtils; | |
7 | 9 | import com.lyms.platform.permission.model.Organization; |
8 | 10 | import com.lyms.platform.permission.model.OrganizationQuery; |
9 | 11 | import com.lyms.platform.permission.model.Users; |
... | ... | @@ -20,6 +22,8 @@ |
20 | 22 | import java.util.Date; |
21 | 23 | import java.util.List; |
22 | 24 | import java.util.Map; |
25 | +import java.util.concurrent.CountDownLatch; | |
26 | +import java.util.concurrent.TimeUnit; | |
23 | 27 | |
24 | 28 | /** |
25 | 29 | * Created by Administrator on 2020-04-10. |
... | ... | @@ -138,6 +142,47 @@ |
138 | 142 | |
139 | 143 | public static String getString(Object obj) { |
140 | 144 | return obj == null ? null : String.valueOf(obj); |
145 | + } | |
146 | + | |
147 | + | |
148 | + public void doHandleBirth(String ckNo1,String ckPrefix1) | |
149 | + { | |
150 | + int page = 0; | |
151 | + | |
152 | + //查询孕妇档案 | |
153 | + do { | |
154 | + String sql1 = "SELECT ck_no,ck_prefix from cert_birthnocheck ORDER BY ck_opertime desc limit "+page+",100"; | |
155 | + System.out.println(sql1); | |
156 | + List<Map<String, Object>> list = JDBCUtil.getMysqlListDataBySql(sql1); | |
157 | + if (CollectionUtils.isEmpty(list)) | |
158 | + { | |
159 | + System.out.println("查询数据完成"); | |
160 | + break; | |
161 | + } | |
162 | + if (CollectionUtils.isNotEmpty(list)) | |
163 | + { | |
164 | + for(Map<String, Object> data : list) | |
165 | + { | |
166 | + String ckNo = getString(data.get("ck_no")); | |
167 | + String ckPrefix = getString(data.get("ck_prefix")); | |
168 | + | |
169 | + String sql = "SELECT M.CK_NO,M.CK_PREGDAY,M.CK_BABBYBIRTHDAY,M.CK_PREFIX FROM MOMMY_BIRTHNOCHECK M WHERE M.CK_NO='"+ckNo+"' AND M.CK_PREFIX='"+ckPrefix+"'"; | |
170 | + | |
171 | + List<Map<String, Object>> list1 = JDBCUtil.getOracleListDataBySql(sql); | |
172 | + if (CollectionUtils.isNotEmpty(list1)) | |
173 | + { | |
174 | + Map<String, Object> obj = list1.get(0); | |
175 | + Date birth = HsDataUtil.getDate(obj.get("CK_BABBYBIRTHDAY")); | |
176 | + String day = HsDataUtil.getString(obj.get("CK_PREGDAY")); | |
177 | + System.out.println(DateUtil.getyyyy_MM_dd_hms(birth)); | |
178 | + int count = JDBCUtil.mysqlUpdate(" update cert_birthnocheck set ck_pregday="+day+",ck_babbybirthday='"+ DateUtil.getyyyy_MM_dd_hms(birth)+"' where ck_no='"+ckNo+"' and ck_prefix='"+ckPrefix+"'"); | |
179 | + System.out.println("update count "+count); | |
180 | + | |
181 | + } | |
182 | + } | |
183 | + } | |
184 | + page++; | |
185 | + }while (true); | |
141 | 186 | } |
142 | 187 | |
143 | 188 | } |
platform-operate-api/src/main/java/com/lyms/hospitalapi/hs/SyncHsPatientService.java
View file @
4997989
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | /** |
43 | 43 | * 同步孕妇 |
44 | 44 | */ |
45 | - public void synchsPatientData() { | |
45 | + public void synchsPatientData(String startDate,String endDate) { | |
46 | 46 | //初始化数据 |
47 | 47 | HsDataUtil.initData(mongoTemplate); |
48 | 48 | |
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | " mp.*, p_birthday, p_name, vc.VC_CARDNO from MOMMY_PATIENT mp " + |
58 | 58 | " left join Plat_Patient pp on mp.p_platpatientid = pp.p_id left join (select max(VC_OPERTIME) as OPERTIME, " + |
59 | 59 | " VC_CARDNO, VC_PATIENTNO from MOMMY_VISITCARD group by VC_CARDNO, VC_PATIENTNO) vc " + |
60 | - " on vc.VC_PATIENTNO = mp.P_NO order by mp.P_FILINGTIME desc) temp where ROWNUM <="+pageEnd+") pat where pat.rowno >= "+pageStart; | |
60 | + " on vc.VC_PATIENTNO = mp.P_NO where mp.P_FILINGTIME >= to_date('"+startDate+"','yyyy-MM-dd') AND mp.P_FILINGTIME <= to_date('"+endDate+"','yyyy-MM-dd') order by mp.P_FILINGTIME asc) temp where ROWNUM <="+pageEnd+") pat where pat.rowno >= "+pageStart; | |
61 | 61 | System.out.println(sql); |
62 | 62 | List<Map<String, Object>> list = JDBCUtil.getOracleListDataBySql(sql); |
63 | 63 | if (!CollectionUtils.isNotEmpty(list)) |
... | ... | @@ -131,7 +131,7 @@ |
131 | 131 | |
132 | 132 | Date lastmenstrualperiod = null; |
133 | 133 | try { |
134 | - if (StringUtils.isEmpty(HsDataUtil.getString(map.get("P_LASTMENSTRUALPERIOD")))) | |
134 | + if (StringUtils.isEmpty(HsDataUtil.getString(map.get("P_LASTMENSTRUALPERIOD"))) || (StringUtils.isNotEmpty(HsDataUtil.getString(map.get("P_LASTMENSTRUALPERIOD"))) && "0001-01-01".equals(HsDataUtil.getString(map.get("P_LASTMENSTRUALPERIOD"))))) | |
135 | 135 | { |
136 | 136 | List<Map<String, Object>> chanList = null; |
137 | 137 | if (StringUtils.isNotEmpty(HsDataUtil.getString(map.get("P_PLATPATIENTID")))) { |
... | ... | @@ -149,7 +149,7 @@ |
149 | 149 | lastmenstrualperiod = DateUtil.addWeek(fmDate,-Integer.parseInt(weeks[0])); |
150 | 150 | if (weeks.length > 1 && StringUtils.isNotEmpty(weeks[1])) |
151 | 151 | { |
152 | - lastmenstrualperiod = DateUtil.addWeek(lastmenstrualperiod,-Integer.parseInt(weeks[1])); | |
152 | + lastmenstrualperiod = DateUtil.addDay(lastmenstrualperiod, -Integer.parseInt(weeks[1])); | |
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
... | ... | @@ -180,7 +180,7 @@ |
180 | 180 | patients.setBuildDays(DateUtil.getDays(HsDataUtil.getDate(map.get("P_LASTMENSTRUALPERIOD")), HsDataUtil.getDate(map.get("P_FILINGTIME")))); |
181 | 181 | |
182 | 182 | |
183 | - patients.setId(String.valueOf(map.get("PID"))); | |
183 | + | |
184 | 184 | patients.setYn(HsDataUtil.getInteger(map.get("P_ISVALID"))); //是否有效 |
185 | 185 | patients.setBuildType(0); |
186 | 186 | patients.setBirth(HsDataUtil.getDate(map.get("P_BIRTHDAY"))); |
... | ... | @@ -493,8 +493,9 @@ |
493 | 493 | patients.setFmWeek(DateUtil.getDays(HsDataUtil.getDate(map.get("P_LASTMENSTRUALPERIOD")), fmDate)); |
494 | 494 | |
495 | 495 | String hname = HsDataUtil.getOraHosptalById(HsDataUtil.getString(fmMap.get("PDR_DELIVERORGANIZATIONID"))); |
496 | - String id = HsDataUtil.getMysqlHosptalByName(hname); | |
497 | - patients.setFmHospital(id); | |
496 | + String hid = HsDataUtil.getMysqlHosptalByName(hname); | |
497 | + patients.setFmHospital(hid); | |
498 | + patients.setFmHospital(hid); | |
498 | 499 | if (StringUtils.isNotEmpty(HsDataUtil.getString(fmMap.get("PDR_DELIVERYMODE")))) |
499 | 500 | { |
500 | 501 | |
501 | 502 | |
502 | 503 | |
... | ... | @@ -511,12 +512,25 @@ |
511 | 512 | } |
512 | 513 | patients.setFmType(JsonUtil.obj2Str(deliveryMode)); |
513 | 514 | } |
515 | + String patientId = String.valueOf(map.get("PID")); | |
516 | + PersonModel dbPerson = mongoTemplate.findOne(Query.query(Criteria.where("cardNo").is(HsDataUtil.getString(map.get("P_CARDNO"))).and("yn").is(1).and("type").ne(2)), PersonModel.class); | |
517 | + if (dbPerson != null) | |
518 | + { | |
519 | + patients.setPid(dbPerson.getId()); | |
520 | + } | |
521 | + else | |
522 | + { | |
523 | + patients.setPid(patientId); | |
524 | + } | |
525 | + patients.setId(patientId); | |
514 | 526 | |
515 | - craeteFm(fmMap,String.valueOf(map.get("PID")),HsDataUtil.getDate(map.get("P_LASTMENSTRUALPERIOD")), id, patients); | |
527 | + | |
528 | + craeteFm(fmMap,HsDataUtil.getDate(map.get("P_LASTMENSTRUALPERIOD")), hid, patients); | |
529 | + | |
516 | 530 | } |
517 | 531 | } |
518 | 532 | |
519 | - | |
533 | + patients.setId(String.valueOf(map.get("PID"))); | |
520 | 534 | patients.setType(type); //患者类型 |
521 | 535 | |
522 | 536 | PersonModel dbPerson = mongoTemplate.findOne(Query.query(Criteria.where("cardNo").is(HsDataUtil.getString(map.get("P_CARDNO"))).and("yn").is(1).and("type").ne(2)), PersonModel.class); |
523 | 537 | |
524 | 538 | |
... | ... | @@ -705,16 +719,16 @@ |
705 | 719 | * @param last |
706 | 720 | * @param fmHospitalId |
707 | 721 | */ |
708 | - private void craeteFm(Map<String,Object> fmMap,String patientId,Date last,String fmHospitalId,Patients patients) { | |
722 | + private void craeteFm(Map<String,Object> fmMap,Date last,String fmHospitalId,Patients patients) { | |
709 | 723 | |
710 | 724 | try { |
711 | 725 | MaternalDeliverModel deliverModel = new MaternalDeliverModel(); |
712 | - deliverModel.setParentId(patientId); | |
713 | - deliverModel.setPid(patientId); | |
726 | + deliverModel.setParentId(patients.getId()); | |
727 | + deliverModel.setPid(patients.getPid()); | |
714 | 728 | deliverModel.setDueDate(DateUtil.getyyyy_MM_dd(HsDataUtil.getDate(fmMap.get("PDR_CHILDBIRTHDAY")))); |
715 | 729 | deliverModel.setDueDate1(HsDataUtil.getDate(fmMap.get("PDR_CHILDBIRTHDAY"))); |
716 | 730 | deliverModel.setFmType("1"); |
717 | - deliverModel.setDueWeek(DateUtil.getWeekDesc(last, DateUtil.addDay(HsDataUtil.getDate(fmMap.get("PDR_CHILDBIRTHDAY")),-1))); | |
731 | + deliverModel.setDueWeek(DateUtil.getWeekDesc(last, DateUtil.addDay(HsDataUtil.getDate(fmMap.get("PDR_CHILDBIRTHDAY")),-2))); | |
718 | 732 | |
719 | 733 | |
720 | 734 | if(StringUtils.isNotEmpty(HsDataUtil.getString(fmMap.get("PDR_AFTERONEHIGHBLOOD2"))) && |
... | ... | @@ -740,7 +754,7 @@ |
740 | 754 | deliverModel.settHloseBloodL(HsDataUtil.getDouble(fmMap.get("PDR_BLOODLOSSAFTERONE2"))); |
741 | 755 | deliverModel.setrHloseBloodL(HsDataUtil.getDouble(fmMap.get("PDR_BLOODLOSSAFTERONE24"))); |
742 | 756 | deliverModel.setsHloseBloodL(HsDataUtil.getDouble(fmMap.get("PDR_3AND2BLOOD"))); |
743 | - deliverModel.setBreath(HsDataUtil.getString(fmMap.get("PDR_MIANCHUHOUFENZHONG"))); | |
757 | + deliverModel.setBreath(HsDataUtil.getString(fmMap.get("PDR_HUXI"))); | |
744 | 758 | deliverModel.setPulse(HsDataUtil.getString(fmMap.get("PDR_AFTERONEMAIBO"))); |
745 | 759 | |
746 | 760 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
View file @
4997989
1 | 1 | package com.lyms.platform.operate.web; |
2 | 2 | |
3 | -import com.lyms.platform.common.utils.MD5; | |
4 | -import com.lyms.platform.pojo.BasicConfig; | |
5 | -import net.sourceforge.pinyin4j.PinyinHelper; | |
6 | -import org.apache.log4j.Logger; | |
7 | -import sun.misc.Unsafe; | |
3 | +import org.apache.commons.lang.StringUtils; | |
4 | +import org.apache.http.HttpEntity; | |
5 | +import org.apache.http.client.ClientProtocolException; | |
6 | +import org.apache.http.client.config.RequestConfig; | |
7 | +import org.apache.http.client.methods.CloseableHttpResponse; | |
8 | +import org.apache.http.client.methods.HttpPost; | |
9 | +import org.apache.http.entity.ContentType; | |
10 | +import org.apache.http.entity.mime.MultipartEntityBuilder; | |
11 | +import org.apache.http.entity.mime.content.FileBody; | |
12 | +import org.apache.http.entity.mime.content.StringBody; | |
13 | +import org.apache.http.impl.client.CloseableHttpClient; | |
14 | +import org.apache.http.impl.client.HttpClients; | |
15 | +import org.apache.http.util.EntityUtils; | |
8 | 16 | |
9 | -import java.lang.reflect.Field; | |
10 | -import java.text.SimpleDateFormat; | |
11 | -import java.util.*; | |
17 | +import java.io.File; | |
18 | +import java.io.IOException; | |
12 | 19 | |
13 | 20 | /** |
14 | 21 | * Created by Administrator on 2016/8/22 0022. |
15 | 22 | */ |
16 | 23 | public class Test { |
17 | 24 | |
18 | - private static org.apache.log4j.Logger log = Logger.getLogger("HTTP-INVOKE"); | |
25 | + final static long TIME = 1000 * 90; | |
26 | + | |
19 | 27 | public static void main(String[] args) throws Exception { |
20 | 28 | |
21 | -// Map<String, Object> resutl = getSignParams("bisp-czsfy", "czsfy123$"); | |
22 | -// System.out.println(resutl); | |
23 | - System.out.println("360102199003079318".substring("360102199003079318".length() - 8)); | |
24 | - } | |
25 | - | |
26 | - public static boolean contain(String value, String content) { | |
27 | - return content.contains(value); | |
28 | - } | |
29 | - public static Map<String, Object> getSignParams(String syscode, String secret) { | |
30 | - Map<String, Object> signParams = new HashMap<>(); | |
31 | - signParams.put("syscode", syscode); | |
32 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
33 | - signParams.put("timestamp", sdf.format(new Date())); | |
34 | - String unencryptedStr = getUnencryptedStr(signParams); | |
35 | - String sign2 = MD5.getMD5(secret + unencryptedStr + secret);//获取数字签名 | |
36 | - signParams.put("sign", sign2); | |
37 | - return signParams; | |
38 | - } | |
39 | - | |
40 | - public static String getUnencryptedStr(Map<String, Object> signParams) { | |
41 | - List<String> paramsList = new ArrayList<>(); | |
42 | - for (String key : signParams.keySet()) { | |
43 | - if ("sign".equals(key)) { | |
44 | - continue; | |
45 | - } | |
46 | - String value = (String) signParams.get(key); | |
47 | - paramsList.add(key + value);//将参数转换成key+value格式 | |
29 | + File dir = new File("F:\\aa"); | |
30 | + File[] files = dir.listFiles(); | |
31 | + for (File file : files) | |
32 | + { | |
33 | + upload("https://cert-hengshui-api.healthbaby.com.cn:8787/cp/common/importSignature", file, file.getName()); | |
34 | + Thread.sleep(TIME); | |
48 | 35 | } |
49 | - Object[] paramsArray = (Object[]) paramsList.toArray(); | |
50 | - Arrays.sort(paramsArray);//ascii码排序 | |
51 | - String unencryptedStr = "";//待加密字符串 | |
52 | - for (Object paramStr : paramsArray) { | |
53 | - unencryptedStr += paramStr; | |
54 | - } | |
55 | - return unencryptedStr; | |
56 | 36 | } |
57 | 37 | |
58 | 38 | |
59 | - public static Integer getLevel(Integer total) { | |
60 | - if (total == null) { | |
61 | - return 0; | |
62 | - } else if (total == 0) { | |
63 | - return 0; | |
64 | - } else if ((total&8)==8) { | |
65 | - return 8; | |
66 | - } else if ((total&4)==4) { | |
67 | - return 4; | |
68 | - } else if ((total&1)==1) { | |
69 | - return 1; | |
70 | - } else if ((total&2)==2) { | |
71 | - return 2; | |
72 | - } else { | |
73 | - return 0; | |
74 | - } | |
75 | - } | |
76 | - | |
77 | - public static void configData(BasicConfig bs, List<BasicConfig> basicConfigList,Map<String, List<BasicConfig>> slaveBasicConfigMap) { | |
78 | - | |
79 | - if (slaveBasicConfigMap.containsKey(bs.getId())) { | |
80 | - bs.setBasicConfigs(slaveBasicConfigMap.get(bs.getId())); | |
81 | - for(BasicConfig basicConfig:bs.getBasicConfigs()){ | |
82 | - configData(basicConfig,basicConfigList,slaveBasicConfigMap); | |
83 | - } | |
84 | - } | |
85 | - } | |
86 | - | |
87 | - | |
88 | - /** | |
89 | - * 功能:实现汉语拼音序比较 | |
90 | - */ | |
91 | - static class ComparatorPinYin implements Comparator<String> { | |
92 | - @Override | |
93 | - public int compare(String o1, String o2) { | |
94 | - return ToPinYinString(o1).compareTo(ToPinYinString(o2)); | |
95 | - } | |
96 | - | |
97 | - private String ToPinYinString(String str) { | |
98 | - | |
99 | - StringBuilder sb = new StringBuilder(); | |
100 | - String[] arr = null; | |
101 | - | |
102 | - for (int i = 0; i < str.length(); i++) { | |
103 | - arr = PinyinHelper.toHanyuPinyinStringArray(str.charAt(i)); | |
104 | - if (arr != null && arr.length > 0) { | |
105 | - for (String string : arr) { | |
106 | - sb.append(string); | |
107 | - } | |
39 | + public static void upload(String url,File file,String filename) { | |
40 | + CloseableHttpClient httpclient = HttpClients.createDefault(); | |
41 | + try { | |
42 | + HttpPost httppost = new HttpPost(url); | |
43 | + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(2000000).setSocketTimeout(2000000).build(); | |
44 | + httppost.setConfig(requestConfig); | |
45 | + FileBody bin = new FileBody(file); | |
46 | + StringBody comment = new StringBody(filename, ContentType.TEXT_PLAIN); | |
47 | + HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("file", bin).addPart("filename", comment).build(); | |
48 | + httppost.setEntity(reqEntity); | |
49 | + httppost.setHeader("Authorization","12b82e5ef40605bdf213b3c60c4dc69e"); | |
50 | + CloseableHttpResponse response = httpclient.execute(httppost); | |
51 | + try { | |
52 | + System.out.println(response.getStatusLine()); | |
53 | + HttpEntity resEntity = response.getEntity(); | |
54 | + if (resEntity != null) { | |
55 | + String responseEntityStr = EntityUtils.toString(response.getEntity()); | |
56 | + System.out.println(file.getName()+"===="+responseEntityStr); | |
108 | 57 | } |
58 | + EntityUtils.consume(resEntity); | |
59 | + } finally { | |
60 | + response.close(); | |
109 | 61 | } |
110 | - | |
111 | - return sb.toString(); | |
62 | + } catch (ClientProtocolException e) { | |
63 | + e.printStackTrace(); | |
64 | + } catch (IOException e) { | |
65 | + e.printStackTrace(); | |
66 | + } finally { | |
67 | + try { | |
68 | + httpclient.close(); | |
69 | + } catch (IOException e) { | |
70 | + e.printStackTrace(); | |
71 | + } | |
112 | 72 | } |
113 | 73 | } |
74 | + | |
114 | 75 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SyncHsDataController.java
View file @
4997989
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | import org.springframework.stereotype.Controller; |
8 | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
9 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
10 | +import org.springframework.web.bind.annotation.RequestParam; | |
10 | 11 | import org.springframework.web.bind.annotation.ResponseBody; |
11 | 12 | |
12 | 13 | /** |
13 | 14 | |
... | ... | @@ -32,10 +33,18 @@ |
32 | 33 | return "syncBaseInfo starting..........."; |
33 | 34 | } |
34 | 35 | |
36 | + | |
37 | + @RequestMapping(value = "/doHandleBirth", method = RequestMethod.GET) | |
38 | + @ResponseBody | |
39 | + public String doHandleBirth(@RequestParam(required = false)String ckNo,@RequestParam(required = false) String ckPrefix) { | |
40 | + syncBaseInfoService.doHandleBirth( ckNo, ckPrefix); | |
41 | + return "doHandleBirth starting..........."; | |
42 | + } | |
43 | + | |
35 | 44 | @RequestMapping(value = "/synchsPatientData", method = RequestMethod.GET) |
36 | 45 | @ResponseBody |
37 | - public String synchsPatientData() { | |
38 | - syncHsPatientService.synchsPatientData(); | |
46 | + public String synchsPatientData(String start,String end) { | |
47 | + syncHsPatientService.synchsPatientData(start,end); | |
39 | 48 | return "synchsPatientData starting..........."; |
40 | 49 | } |
41 | 50 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
4997989
... | ... | @@ -32,10 +32,7 @@ |
32 | 32 | import com.lyms.platform.operate.web.worker.*; |
33 | 33 | import com.lyms.platform.permission.dao.master.CouponMapper; |
34 | 34 | import com.lyms.platform.permission.model.*; |
35 | -import com.lyms.platform.permission.service.BabyDiagnoseService; | |
36 | -import com.lyms.platform.permission.service.CouponService; | |
37 | -import com.lyms.platform.permission.service.OrganizationService; | |
38 | -import com.lyms.platform.permission.service.PatientServiceService; | |
35 | +import com.lyms.platform.permission.service.*; | |
39 | 36 | import com.lyms.platform.pojo.*; |
40 | 37 | import com.lyms.platform.query.*; |
41 | 38 | import com.mongodb.Mongo; |
42 | 39 | |
... | ... | @@ -87,7 +84,10 @@ |
87 | 84 | @Autowired |
88 | 85 | private PatientsService patientsService; |
89 | 86 | |
87 | + @Autowired | |
88 | + private UsersService usersService; | |
90 | 89 | |
90 | + | |
91 | 91 | @Autowired |
92 | 92 | private TrackDownRecordService trackDownRecordService; |
93 | 93 | |
... | ... | @@ -3504,8 +3504,7 @@ |
3504 | 3504 | for (BloodSugar bloodSugar : tempList) { |
3505 | 3505 | if (bloodSugar != null) { |
3506 | 3506 | Patients pat = patientsService.findOnePatientById(bloodSugar.getParentId()); |
3507 | - if (pat != null) | |
3508 | - { | |
3507 | + if (pat != null) { | |
3509 | 3508 | bloodSugar.setRiskFactorId(pat.getRiskFactorId()); |
3510 | 3509 | |
3511 | 3510 | Query query = Query.query(Criteria.where("id").is(bloodSugar.getId())); |
... | ... | @@ -3521,6 +3520,118 @@ |
3521 | 3520 | } |
3522 | 3521 | |
3523 | 3522 | return "syncBloodSugar finish"; |
3523 | + } | |
3524 | + | |
3525 | + | |
3526 | + | |
3527 | + @ResponseBody | |
3528 | + @RequestMapping(value = "/updateHsFmPatients", method = RequestMethod.GET) | |
3529 | + public String syncPatientsFmInfo(@RequestParam(required = false) String hospitalId,String startDate,String endDate) { | |
3530 | + final MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
3531 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
3532 | + matDeliverQuery.setCreatedStart(DateUtil.parseYMD(startDate)); | |
3533 | + matDeliverQuery.setEndStart(DateUtil.parseYMD(endDate)); | |
3534 | + if (StringUtils.isNotEmpty(hospitalId)) { | |
3535 | + matDeliverQuery.setFmHospital(hospitalId); | |
3536 | + } | |
3537 | + // 查询 | |
3538 | + List<MaternalDeliverModel> maternalDeliverModelList = matDeliverService.query(matDeliverQuery); | |
3539 | + System.out.println("本次读取了【" + maternalDeliverModelList.size() + "】条数据"); | |
3540 | + int batchSize = 1000; | |
3541 | + int end = 0; | |
3542 | + for (int i = 0; i < maternalDeliverModelList.size(); i += batchSize) { | |
3543 | + end = (end + batchSize); | |
3544 | + if (end > maternalDeliverModelList.size()) { | |
3545 | + end = maternalDeliverModelList.size(); | |
3546 | + } | |
3547 | + final List<MaternalDeliverModel> tempList = maternalDeliverModelList.subList(i, end); | |
3548 | + new Thread(new Runnable() { | |
3549 | + @Override | |
3550 | + public void run() { | |
3551 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
3552 | + for (MaternalDeliverModel maternalDeliverModel : tempList) { | |
3553 | + Patients patients = patientsService.findOnePatientById(maternalDeliverModel.getParentId()); | |
3554 | + if (patients != null && StringUtils.isNotEmpty(maternalDeliverModel.getFmHospital()) | |
3555 | + && StringUtils.isNotEmpty(patients.getHospitalId())) { | |
3556 | + if (!maternalDeliverModel.getFmHospital().equals(patients.getHospitalId())) | |
3557 | + { | |
3558 | + String source = patients.getId(); | |
3559 | + patients.setId(null); | |
3560 | + patients.setEnable("2"); | |
3561 | + patients.setHospitalId(maternalDeliverModel.getFmHospital()); | |
3562 | + patients.setSource(source); | |
3563 | + | |
3564 | + if(StringUtils.isEmpty(patients.getBookbuildingDoctor())) | |
3565 | + { | |
3566 | + UsersQuery usersQuery = new UsersQuery(); | |
3567 | + usersQuery.setOrgId(Integer.valueOf(maternalDeliverModel.getFmHospital())); | |
3568 | + List<Users> users = usersService.queryUsers(usersQuery); | |
3569 | + if (CollectionUtils.isNotEmpty(users)) | |
3570 | + { | |
3571 | + patients.setBookbuildingDoctor(users.get(0).getId()+""); | |
3572 | + } | |
3573 | + } | |
3574 | + | |
3575 | + patientsService.addPatient(patients); | |
3576 | + System.out.println(patients.getId()); | |
3577 | + maternalDeliverModel.setParentId(patients.getId()); | |
3578 | + matDeliverService.updateOne(maternalDeliverModel,maternalDeliverModel.getId()); | |
3579 | + } | |
3580 | + } | |
3581 | + } | |
3582 | + } | |
3583 | + } | |
3584 | + }).start(); | |
3585 | + } | |
3586 | + return "updateHsFmPatients start......"; | |
3587 | + } | |
3588 | + | |
3589 | + | |
3590 | + | |
3591 | + | |
3592 | + @ResponseBody | |
3593 | + @RequestMapping(value = "/updatePatientBuildDoctor", method = RequestMethod.GET) | |
3594 | + public String updatePatientBuildDoctor(@RequestParam(required = false) String hospitalId,String startDate,String endDate) { | |
3595 | + PatientsQuery patientQuery = new PatientsQuery(); | |
3596 | + patientQuery.setCreatedTimeStart(DateUtil.parseYMD(startDate)); | |
3597 | + patientQuery.setCreatedTimeEnd(DateUtil.parseYMD(endDate)); | |
3598 | + if (StringUtils.isNotEmpty(hospitalId)) { | |
3599 | + patientQuery.setFmHospital(hospitalId); | |
3600 | + } | |
3601 | + // 查询 | |
3602 | + List<Patients> patientses = patientsService.queryPatient(patientQuery); | |
3603 | + System.out.println("本次读取了【" + patientses.size() + "】条数据"); | |
3604 | + int batchSize = 1000; | |
3605 | + int end = 0; | |
3606 | + for (int i = 0; i < patientses.size(); i += batchSize) { | |
3607 | + end = (end + batchSize); | |
3608 | + if (end > patientses.size()) { | |
3609 | + end = patientses.size(); | |
3610 | + } | |
3611 | + final List<Patients> tempList = patientses.subList(i, end); | |
3612 | + new Thread(new Runnable() { | |
3613 | + @Override | |
3614 | + public void run() { | |
3615 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
3616 | + for (Patients patients : tempList) { | |
3617 | + if(StringUtils.isEmpty(patients.getBookbuildingDoctor())) | |
3618 | + { | |
3619 | + UsersQuery usersQuery = new UsersQuery(); | |
3620 | + usersQuery.setOrgId(Integer.valueOf(patients.getHospitalId())); | |
3621 | + List<Users> users = usersService.queryUsers(usersQuery); | |
3622 | + if (CollectionUtils.isNotEmpty(users)) | |
3623 | + { | |
3624 | + patients.setBookbuildingDoctor(users.get(0).getId() + ""); | |
3625 | + patientsService.updatePatient(patients); | |
3626 | + System.out.println(patients.getId()); | |
3627 | + } | |
3628 | + } | |
3629 | + } | |
3630 | + } | |
3631 | + } | |
3632 | + }).start(); | |
3633 | + } | |
3634 | + return "updatePatientBuildDoctor start......"; | |
3524 | 3635 | } |
3525 | 3636 | |
3526 | 3637 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
4997989
... | ... | @@ -3205,7 +3205,8 @@ |
3205 | 3205 | patientsQuery.setEnable("2"); |
3206 | 3206 | } |
3207 | 3207 | Patients patients = null; |
3208 | - List<Patients> list = patientsService.queryPatient1(patientsQuery, "modified"); | |
3208 | + List<Patients> list = patientsService.queryPatient1(patientsQuery, "created"); | |
3209 | + System.out.println("分娩查询"+patientsQuery.convertToQuery().convertToMongoQuery().toString()); | |
3209 | 3210 | if (CollectionUtils.isNotEmpty(list)) { |
3210 | 3211 | return list.get(0); |
3211 | 3212 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
4997989
... | ... | @@ -229,8 +229,36 @@ |
229 | 229 | //表示区域的 |
230 | 230 | if (StringUtils.isNotEmpty(organizationGroupsFacade.findByCurrentUserId(hospitalId))) { |
231 | 231 | String parentId = antenatalExaminationFacade.handHideBuild(deliverAddRequest.getPid(), deliverAddRequest.getParentId(), userId, -1); |
232 | - if (StringUtils.isEmpty(parentId)) { | |
233 | - logger.warn("get handHideBuild parentId is null."); | |
232 | + if (StringUtils.isNotEmpty(parentId)) { | |
233 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
234 | + patientsQuery.setHospitalId(hospitalId); | |
235 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
236 | + patientsQuery.setId(parentId); | |
237 | + patientsQuery.setSort(" created "); | |
238 | + List<Patients> patients = patientsService.queryPatient(patientsQuery); | |
239 | + if (CollectionUtils.isEmpty(patients)) | |
240 | + { | |
241 | + patientsQuery.setHospitalId(hospitalId); | |
242 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
243 | + patientsQuery.setId(null); | |
244 | + patientsQuery.setPid(deliverAddRequest.getPid()); | |
245 | + patientsQuery.setSort(" created "); | |
246 | + List<Patients> patientsss = patientsService.queryPatient(patientsQuery); | |
247 | + if (CollectionUtils.isNotEmpty(patientsss)) | |
248 | + { | |
249 | + Patients pat = patientsss.get(0); | |
250 | + String source = pat.getId(); | |
251 | + pat.setId(null); | |
252 | + pat.setEnable("2"); | |
253 | + pat.setHospitalId(maternalDeliverModel.getFmHospital()); | |
254 | + pat.setSource(source); | |
255 | + | |
256 | + patientsService.addPatient(pat); | |
257 | + maternalDeliverModel.setParentId(pat.getId()); | |
258 | + deliverAddRequest.setParentId(pat.getId()); | |
259 | + } | |
260 | + } | |
261 | + | |
234 | 262 | } |
235 | 263 | maternalDeliverModel.setParentId(parentId); |
236 | 264 | deliverAddRequest.setParentId(parentId); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
4997989
... | ... | @@ -6435,9 +6435,25 @@ |
6435 | 6435 | week = (dueMap.get("week") == null || "".equals(dueMap.get("week"))) ? 0 : Integer.parseInt(String.valueOf(dueMap.get("week"))); |
6436 | 6436 | day = (dueMap.get("day") == null || "".equals(dueMap.get("day"))) ? 0 : Integer.parseInt(String.valueOf(dueMap.get("day"))); |
6437 | 6437 | } else { |
6438 | - Integer betweenDay = DateUtil.getDays(pat.getLastMenses(), data.getDueDate1()); | |
6439 | - week = betweenDay / 7; | |
6440 | - day = betweenDay % 7; | |
6438 | + | |
6439 | + try { | |
6440 | + String dueWeek = data.getDueWeek(); | |
6441 | + if (StringUtils.isNotEmpty(dueWeek) && dueWeek.contains("周")) | |
6442 | + { | |
6443 | + String[] arrs = dueWeek.replace("周","").replace("天","").split("\\+"); | |
6444 | + week = Integer.parseInt(arrs[0]); | |
6445 | + if (arrs.length == 2) | |
6446 | + { | |
6447 | + day = Integer.parseInt(arrs[1]); | |
6448 | + } | |
6449 | + } | |
6450 | + } | |
6451 | + catch (Exception e) | |
6452 | + { | |
6453 | + Integer betweenDay = DateUtil.getDays(pat.getLastMenses(), data.getDueDate1()); | |
6454 | + week = betweenDay / 7; | |
6455 | + day = betweenDay % 7; | |
6456 | + } | |
6441 | 6457 | } |
6442 | 6458 | |
6443 | 6459 | Date fmDate = DateUtil.parseYMDHM(baby.getDueTime()); |