Commit 454ce8ee85d82f7061c4edb332c895db5334b59a
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 4 changed files
- platform-dal/src/main/java/com/lyms/platform/pojo/AntenatalExaminationModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/JdbcUtil.java
platform-dal/src/main/java/com/lyms/platform/pojo/AntenatalExaminationModel.java
View file @
454ce8e
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java
View file @
454ce8e
... | ... | @@ -83,11 +83,13 @@ |
83 | 83 | */ |
84 | 84 | @RequestMapping(value = "/queryPregnantBuildRecord", method = RequestMethod.GET) |
85 | 85 | @ResponseBody |
86 | - public BaseListResponse queryPregnantBuildRecord(@RequestParam(required = false) String vcCardNo,@RequestParam(required = false) String cardNo){ | |
86 | + @TokenRequired | |
87 | + public BaseListResponse queryPregnantBuildRecord(@RequestParam(required = false) String vcCardNo,@RequestParam(required = false) String cardNo,HttpServletRequest httpServletRequest){ | |
87 | 88 | BookbuildingQueryRequest bookbuildingQueryRequest = new BookbuildingQueryRequest(); |
88 | 89 | bookbuildingQueryRequest.setVcCardNo(vcCardNo); |
89 | 90 | bookbuildingQueryRequest.setCardNo(cardNo); |
90 | - BaseListResponse listResponse = bookbuildingFacade.queryPregnantBuildRecord(bookbuildingQueryRequest); | |
91 | + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); | |
92 | + BaseListResponse listResponse = bookbuildingFacade.queryPregnantBuildRecord(bookbuildingQueryRequest,loginState.getId()); | |
91 | 93 | return listResponse; |
92 | 94 | } |
93 | 95 | |
... | ... | @@ -151,8 +153,55 @@ |
151 | 153 | @RequestParam(required = false) String keyWord, |
152 | 154 | @RequestParam(required = false) Integer page, |
153 | 155 | @RequestParam(required = false) Integer limit){ |
154 | -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
155 | - BaseObjectResponse objectResponse = bookbuildingFacade.queryHospitals(keyWord, page,limit); | |
156 | + BaseObjectResponse objectResponse = bookbuildingFacade.queryHospitals(keyWord, page, limit); | |
157 | + return objectResponse; | |
158 | + } | |
159 | + | |
160 | + /** | |
161 | + * 产检报告 | |
162 | + * @param request | |
163 | + * @return | |
164 | + */ | |
165 | + | |
166 | + @RequestMapping(value = "/queryChanJianReport", method = RequestMethod.GET) | |
167 | + @ResponseBody | |
168 | + @TokenRequired | |
169 | + public BaseObjectResponse queryChanJianReport(HttpServletRequest request, | |
170 | + @RequestParam(required = false) String exDateStart, | |
171 | + @RequestParam(required = false) String exDateEnd, | |
172 | + @RequestParam(required = false) String name, | |
173 | + @RequestParam(required = false) Integer weekStarts, | |
174 | + @RequestParam(required = false) Integer weekEnds, | |
175 | + @RequestParam(required = false) String hbsab, | |
176 | + @RequestParam(required = false) String hbeag, | |
177 | + @RequestParam(required = false) String hbeab, | |
178 | + @RequestParam(required = false) String hbcab, | |
179 | + @RequestParam(required = false) String syphilis, | |
180 | + @RequestParam(required = false) String hiv, | |
181 | + @RequestParam(required = false) String hcv, | |
182 | + @RequestParam(required = false) String doctorNo, | |
183 | + @RequestParam(required = false) Integer page, | |
184 | + @RequestParam(required = false) Integer limit | |
185 | + ){ | |
186 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
187 | + BaseObjectResponse objectResponse = bookbuildingFacade.queryChanJianReport(loginState.getId(), | |
188 | + exDateStart, | |
189 | + exDateEnd, | |
190 | + name, | |
191 | + weekStarts, | |
192 | + weekEnds, | |
193 | + hbsab, | |
194 | + hbeag, | |
195 | + hbeab, | |
196 | + hbcab, | |
197 | + syphilis, | |
198 | + hiv, | |
199 | + hcv, | |
200 | + doctorNo, | |
201 | + page, | |
202 | + limit | |
203 | + | |
204 | + ); | |
156 | 205 | return objectResponse; |
157 | 206 | } |
158 | 207 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
454ce8e
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | import com.lyms.platform.operate.web.result.BookbuildingRecordResult; |
16 | 16 | import com.lyms.platform.operate.web.result.HighScoreResult; |
17 | 17 | import com.lyms.platform.operate.web.result.PregnantInfoResult; |
18 | +import com.lyms.platform.operate.web.utils.JdbcUtil; | |
18 | 19 | import com.lyms.platform.operate.web.utils.MessageCenterService; |
19 | 20 | import com.lyms.platform.permission.model.Organization; |
20 | 21 | import com.lyms.platform.permission.model.OrganizationQuery; |
... | ... | @@ -508,7 +509,7 @@ |
508 | 509 | * @param bookbuildingQueryRequest |
509 | 510 | * @return |
510 | 511 | */ |
511 | - public BaseListResponse queryPregnantBuildRecord(BookbuildingQueryRequest bookbuildingQueryRequest) { | |
512 | + public BaseListResponse queryPregnantBuildRecord(BookbuildingQueryRequest bookbuildingQueryRequest,Integer userId) { | |
512 | 513 | List<Patients> patients = new ArrayList<>(); |
513 | 514 | Map<String,List> typeMap = new HashMap<>(); |
514 | 515 | PatientsQuery patientsQuery = new PatientsQuery(); |
515 | 516 | |
516 | 517 | |
517 | 518 | |
... | ... | @@ -521,17 +522,26 @@ |
521 | 522 | patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery,"bookbuildingDate", Sort.Direction.DESC); |
522 | 523 | } |
523 | 524 | //否则用就诊卡号 查询到这个孕妇的身份证号码 再用身份证号码查询该孕妇的所有建档 包括产妇记录 |
524 | - else if (!StringUtils.isEmpty(bookbuildingQueryRequest.getVcCardNo()) && !StringUtils.isEmpty(String.valueOf(bookbuildingQueryRequest.getHospitalId()))) | |
525 | + else if (!StringUtils.isEmpty(bookbuildingQueryRequest.getVcCardNo())) | |
525 | 526 | { |
527 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
526 | 528 | patientsQuery.setVcCardNo(bookbuildingQueryRequest.getVcCardNo()); |
527 | - patientsQuery.setHospitalId(bookbuildingQueryRequest.getHospitalId()); | |
529 | + patientsQuery.setHospitalId(hospitalId); | |
528 | 530 | List<Patients> patientsVc = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
529 | 531 | if (CollectionUtils.isNotEmpty(patientsVc)) |
530 | 532 | { |
531 | - patientsQuery.setHospitalId(null); | |
532 | - patientsQuery.setVcCardNo(null); | |
533 | - patientsQuery.setCardNo(patientsVc.get(0).getCardNo()); | |
534 | - patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery,"bookbuildingDate", Sort.Direction.DESC); | |
533 | + if (patientsVc.get(0) == null || StringUtils.isEmpty(patientsVc.get(0).getCardNo())) | |
534 | + { | |
535 | + patients = patientsVc; | |
536 | + } | |
537 | + else | |
538 | + { | |
539 | + patientsQuery.setHospitalId(null); | |
540 | + patientsQuery.setVcCardNo(null); | |
541 | + patientsQuery.setCardNo(patientsVc.get(0).getCardNo()); | |
542 | + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery,"bookbuildingDate", Sort.Direction.DESC); | |
543 | + } | |
544 | + | |
535 | 545 | } |
536 | 546 | // 如果为空,初次建档,根据就诊卡号从HIS库取患者信息 |
537 | 547 | else { |
... | ... | @@ -933,7 +943,6 @@ |
933 | 943 | String hospital = autoMatchFacade.getHospitalId(userId); |
934 | 944 | Patients patients = yunBookbuildingService.findOneById(id); |
935 | 945 | |
936 | - ; | |
937 | 946 | // if (CollectionUtils.isNotEmpty(antExChulist)) |
938 | 947 | if(!deleteProcessHandler.deleteBookBuild(patients.getPid(),patients.getBookbuildingDate(),hospital)) |
939 | 948 | { |
... | ... | @@ -1034,6 +1043,140 @@ |
1034 | 1043 | |
1035 | 1044 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
1036 | 1045 | objectResponse.setData(mapList); |
1046 | + | |
1047 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
1048 | + objectResponse.setErrormsg("成功"); | |
1049 | + return objectResponse; | |
1050 | + } | |
1051 | + | |
1052 | + public BaseObjectResponse queryChanJianReport(Integer userId, String exDateStart, | |
1053 | + String exDateEnd, | |
1054 | + String name, | |
1055 | + Integer weekStarts, | |
1056 | + Integer weekEnds, | |
1057 | + String hbsag, | |
1058 | + String hbeag, | |
1059 | + String hbeab, | |
1060 | + String hbcab, | |
1061 | + String syphilis, | |
1062 | + String hiv, | |
1063 | + String hcv, | |
1064 | + String doctorNo, | |
1065 | + Integer page, | |
1066 | + Integer limit) { | |
1067 | + | |
1068 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
1069 | + | |
1070 | + int start = 0; | |
1071 | + int end = 1000; | |
1072 | + if (page != null && limit != null) | |
1073 | + { | |
1074 | + start = (page -1) * limit+1; | |
1075 | + end = page*limit; | |
1076 | + } | |
1077 | + | |
1078 | + String sql = "SELECT * FROM ( SELECT A.*, ROWNUM RN FROM ( SELECT A.EXAMINE_DATE,\n" + | |
1079 | + " A.NAME,\n" + | |
1080 | + " A.AGE,\n" + | |
1081 | + " A.NOW_WEEKS,\n" + | |
1082 | + " A.NOW_WEEKS_DAY, \n" + | |
1083 | + " B.EDD_DATE,\n" + | |
1084 | + " A.HBSAG,\n" + | |
1085 | + " A.HBSAB,\n" + | |
1086 | + " A.HBEAG,\n" + | |
1087 | + " A.HBEAB,\n" + | |
1088 | + " A.HBCAB,\n" + | |
1089 | + " A.SYPHILIS,\n" + | |
1090 | + " A.HIV,\n" + | |
1091 | + " A.HCV,\n" + | |
1092 | + " (CASE WHEN A.HIGH_RISK_GRADE IS NULL THEN '绿色预警' ELSE A.HIGH_RISK_GRADE END) AS HIGH_RISK_GRADE,\n" + | |
1093 | + " (CASE WHEN A.HIGH_RISK_FACTOR IS NULL THEN '健康' ELSE A.HIGH_RISK_FACTOR END) AS HIGH_RISK_FACTOR,\n" + | |
1094 | + " A.NEXT_EXAMINE_DATE,\n" + | |
1095 | + " A.EXAMINE_HISTORY_NUM,\n" + | |
1096 | + " A.DOCTOR_NAME,\n" + | |
1097 | + " A.DOCTOR_NAME AS BOOKER,\n" + | |
1098 | + " DECODE(B.IS_VIP_ID,1,'增值服务','标准服务') AS SERVICE_STATUS,\n" + | |
1099 | + " A.SUGGESTION,\n" + | |
1100 | + " B.TEL_NO,\n" + | |
1101 | + " B.HOME_ADDR,\n" + | |
1102 | + " B.STREET_VALLAGE_ID,\n" + | |
1103 | + " B.STREET_VALLAGE,\n" + | |
1104 | + " B.AREA_COUNTY_ID,\n" + | |
1105 | + " B.AREA_COUNTY,\n" + | |
1106 | + " B.CITY_ID,\n" + | |
1107 | + " B.CITY,\n" + | |
1108 | + " B.PROVINCE_ID,\n" + | |
1109 | + " B.PROVINCE\n" + | |
1110 | + "FROM ODS_F_AUXILIARY_EXAMI A\n" + | |
1111 | + "INNER JOIN ODS_F_GRAVIDA_RECORD B ON A.RECORD_ID=B.RECORD_ID\n" + | |
1112 | + "INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO AND C.VER_NO=2\n" + | |
1113 | + "WHERE C.YCY_STSTEM_ID= '"+hospitalId +"'"; | |
1114 | + if (StringUtils.isNotEmpty(exDateStart)) | |
1115 | + { | |
1116 | + sql += " AND A.EXAMINE_DATE>= to_date('"+exDateStart+"','yyyy-MM-dd')"; | |
1117 | + } | |
1118 | + if (StringUtils.isNotEmpty(exDateEnd)) | |
1119 | + { | |
1120 | + sql += " AND A.EXAMINE_DATE <= to_date('"+exDateEnd+"','yyyy-MM-dd')"; | |
1121 | + } | |
1122 | + | |
1123 | + if (StringUtils.isNotEmpty(name)) | |
1124 | + { | |
1125 | + sql += " AND A.NAME LIKE '%"+name+"%'"; | |
1126 | + } | |
1127 | + | |
1128 | + if (weekStarts != null) | |
1129 | + { | |
1130 | + sql += " AND A.NOW_WEEKS>= "+weekStarts; | |
1131 | + } | |
1132 | + | |
1133 | + if (weekEnds != null) | |
1134 | + { | |
1135 | + sql += " AND A.NOW_WEEKS>= "+weekEnds; | |
1136 | + } | |
1137 | + | |
1138 | + if (StringUtils.isNotEmpty(hbsag)) | |
1139 | + { | |
1140 | + sql += " AND A.HBSAG = "+hbsag; | |
1141 | + } | |
1142 | + | |
1143 | + if (StringUtils.isNotEmpty(hbeag)) | |
1144 | + { | |
1145 | + sql += " AND A.HBEAG = "+hbeag; | |
1146 | + } | |
1147 | + | |
1148 | + if (StringUtils.isNotEmpty(hbeab)) | |
1149 | + { | |
1150 | + sql += " AND A.HBEAB = "+hbeab; | |
1151 | + } | |
1152 | + | |
1153 | + if (StringUtils.isNotEmpty(hbcab)) | |
1154 | + { | |
1155 | + sql += " AND A.HBCAB = "+hbcab; | |
1156 | + } | |
1157 | + if (StringUtils.isNotEmpty(syphilis)) | |
1158 | + { | |
1159 | + sql += " AND A.SYPHILIS = "+syphilis; | |
1160 | + } | |
1161 | + | |
1162 | + if (StringUtils.isNotEmpty(hiv)) | |
1163 | + { | |
1164 | + sql += " AND A.HIV = "+hiv; | |
1165 | + } | |
1166 | + | |
1167 | + if (StringUtils.isNotEmpty(hcv)) | |
1168 | + { | |
1169 | + sql += " AND A.HCV = "+hcv; | |
1170 | + } | |
1171 | + if (StringUtils.isNotEmpty(doctorNo)) | |
1172 | + { | |
1173 | + sql += " AND A.DOCTOR_NO = "+doctorNo; | |
1174 | + } | |
1175 | + sql+=" ) A WHERE ROWNUM <= "+end+" ) WHERE RN >= "+start; | |
1176 | + | |
1177 | + List<Map<String,Object>> list = JdbcUtil.getListDataBySql(sql); | |
1178 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
1179 | + objectResponse.setData(list); | |
1037 | 1180 | |
1038 | 1181 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
1039 | 1182 | objectResponse.setErrormsg("成功"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/JdbcUtil.java
View file @
454ce8e
1 | +package com.lyms.platform.operate.web.utils; | |
2 | + | |
3 | +import java.sql.*; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.HashMap; | |
6 | +import java.util.List; | |
7 | +import java.util.Map; | |
8 | + | |
9 | +/** | |
10 | + * Created by Administrator on 2016/9/29. | |
11 | + */ | |
12 | +public class JdbcUtil { | |
13 | + public static Connection getOracleConnection() { | |
14 | + Connection con = null; | |
15 | + try { | |
16 | + Class.forName("oracle.jdbc.driver.OracleDriver"); | |
17 | + String url = "jdbc:oracle:thin:@192.168.1.32:1521:orcl"; | |
18 | + String userName = "LYMS_ODS"; | |
19 | + String pwd = "Welcome1"; | |
20 | + con = DriverManager.getConnection(url, userName, pwd); | |
21 | + } catch (Exception e) { | |
22 | + e.printStackTrace(); | |
23 | + } | |
24 | + return con; | |
25 | + } | |
26 | + | |
27 | + | |
28 | + public static Connection getMysqlConnection() { | |
29 | + Connection con = null; | |
30 | + try { | |
31 | + Class.forName("com.mysql.jdbc.Driver"); | |
32 | + String url = "jdbc:mysql://119.90.57.26:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
33 | + String userName = "platform"; | |
34 | + String pwd = "platform123"; | |
35 | + con = DriverManager.getConnection(url, userName, pwd); | |
36 | + } catch (Exception e) { | |
37 | + e.printStackTrace(); | |
38 | + } | |
39 | + return con; | |
40 | + } | |
41 | + | |
42 | + public static void freeConnection(Connection connection,PreparedStatement ps,ResultSet rs){ | |
43 | + try { | |
44 | + if(rs != null){ | |
45 | + rs.close(); | |
46 | + } | |
47 | + if(ps != null){ | |
48 | + ps.close(); | |
49 | + } | |
50 | + if( null != connection) | |
51 | + { | |
52 | + connection.close(); | |
53 | + } | |
54 | + } catch (SQLException e) { | |
55 | + } | |
56 | + } | |
57 | + | |
58 | + /** | |
59 | + * | |
60 | + * @param sql | |
61 | + * @return | |
62 | + */ | |
63 | + public static List<Map<String,Object>> getListDataBySql(String sql) | |
64 | + { | |
65 | + Connection conn = getOracleConnection(); | |
66 | + PreparedStatement pst = null; | |
67 | + ResultSet rs = null; | |
68 | + List<Map<String,Object>> list = new ArrayList<>(); | |
69 | + try { | |
70 | + pst = conn.prepareStatement(sql); | |
71 | + rs = pst.executeQuery(); | |
72 | + int count = rs.getMetaData().getColumnCount(); | |
73 | + while (rs.next()) { | |
74 | + Map<String,Object> maps = new HashMap<>(); | |
75 | + for (int i = 1; i <= count; i++) { | |
76 | + String columnName = rs.getMetaData().getColumnName(i); | |
77 | + Object obj = rs.getObject(columnName); | |
78 | + if (obj != null) { | |
79 | + maps.put(columnName, obj); | |
80 | + } | |
81 | + else | |
82 | + { | |
83 | + maps.put(columnName,null); | |
84 | + } | |
85 | + } | |
86 | + list.add(maps); | |
87 | + } | |
88 | + }catch (Exception e) | |
89 | + { | |
90 | + e.printStackTrace(); | |
91 | + } finally { | |
92 | + freeConnection(conn,pst,rs); | |
93 | + } | |
94 | + return list; | |
95 | + } | |
96 | + | |
97 | + public static Object getOralceSingleObjBySql(String sql) | |
98 | + { | |
99 | + Connection conn = getOracleConnection(); | |
100 | + PreparedStatement pst = null; | |
101 | + ResultSet rs = null; | |
102 | + try { | |
103 | + pst = conn.prepareStatement(sql); | |
104 | + rs = pst.executeQuery(); | |
105 | + int count = rs.getMetaData().getColumnCount(); | |
106 | + for (int i = 1 ; i <= count ;i++) | |
107 | + { | |
108 | + String columnName = rs.getMetaData().getColumnName(i); | |
109 | + while (rs.next()){ | |
110 | + return rs.getObject(columnName); | |
111 | + } | |
112 | + | |
113 | + } | |
114 | + }catch (Exception e) | |
115 | + { | |
116 | + e.printStackTrace(); | |
117 | + } finally { | |
118 | + freeConnection(conn,pst,rs); | |
119 | + } | |
120 | + return null; | |
121 | + } | |
122 | + | |
123 | + | |
124 | + public static Object getMysqlSingleObjBySql(String sql) | |
125 | + { | |
126 | + Connection conn = getMysqlConnection(); | |
127 | + PreparedStatement pst = null; | |
128 | + ResultSet rs = null; | |
129 | + try { | |
130 | + pst = conn.prepareStatement(sql); | |
131 | + rs = pst.executeQuery(); | |
132 | + int count = rs.getMetaData().getColumnCount(); | |
133 | + for (int i = 1 ; i <= count ;i++) | |
134 | + { | |
135 | + String columnName = rs.getMetaData().getColumnName(i); | |
136 | + while (rs.next()){ | |
137 | + return rs.getObject(columnName); | |
138 | + } | |
139 | + | |
140 | + } | |
141 | + }catch (Exception e) | |
142 | + { | |
143 | + e.printStackTrace(); | |
144 | + } finally { | |
145 | + freeConnection(conn,pst,rs); | |
146 | + } | |
147 | + return null; | |
148 | + } | |
149 | + | |
150 | +} |