Commit 0d0b3e0d47d06b3b917d7f085b3772dba9896a10
1 parent
15b1f3fc95
Exists in
master
and in
1 other branch
分娩记录导出
Showing 4 changed files with 224 additions and 1 deletions
- platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/ConnTools.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/RcGlxtService.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/CourseFacade.java
platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/ConnTools.java
View file @
0d0b3e0
1 | +package com.lyms.hospitalapi.rcfy; | |
2 | + | |
3 | +import java.sql.Connection; | |
4 | +import java.sql.DriverManager; | |
5 | +import java.sql.SQLException; | |
6 | + | |
7 | +/** | |
8 | + * Created by Administrator on 2016/9/9 0009. | |
9 | + */ | |
10 | +public class ConnTools { | |
11 | + | |
12 | + private static String dirverClassName = "com.mysql.jdbc.Driver"; | |
13 | + private static String url = "jdbc:mysql://119.90.57.26:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
14 | + private static String user = "platform"; | |
15 | + private static String password = "platform123"; | |
16 | + | |
17 | + public static Connection makeConnection() { | |
18 | + Connection conn = null; | |
19 | + try { | |
20 | + Class.forName(dirverClassName); | |
21 | + } catch (ClassNotFoundException e) { | |
22 | + e.printStackTrace(); | |
23 | + } | |
24 | + try { | |
25 | + conn = DriverManager.getConnection(url, user, password); | |
26 | + } catch (SQLException e) { | |
27 | + e.printStackTrace(); | |
28 | + } | |
29 | + return conn; | |
30 | + } | |
31 | + | |
32 | + | |
33 | +} |
platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/RcGlxtService.java
View file @
0d0b3e0
1 | +package com.lyms.hospitalapi.rcfy; | |
2 | + | |
3 | + | |
4 | +import com.lyms.platform.biz.service.*; | |
5 | + | |
6 | +import com.lyms.platform.common.utils.DateUtil; | |
7 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
8 | +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; | |
9 | + | |
10 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
11 | +import com.lyms.platform.permission.service.OrganizationService; | |
12 | +import com.lyms.platform.permission.service.UsersService; | |
13 | +import com.lyms.platform.pojo.Patients; | |
14 | +import org.apache.commons.dbutils.QueryRunner; | |
15 | +import org.springframework.beans.factory.annotation.Autowired; | |
16 | +import org.springframework.stereotype.Service; | |
17 | + | |
18 | +import java.sql.Connection; | |
19 | +import java.sql.Date; | |
20 | +import java.sql.PreparedStatement; | |
21 | +import java.sql.SQLException; | |
22 | + | |
23 | + | |
24 | +/** | |
25 | + * Created by Administrator on 2016/10/19 0019. | |
26 | + */ | |
27 | +@Service("rcGlxtService") | |
28 | +public class RcGlxtService { | |
29 | + | |
30 | + @Autowired | |
31 | + private PatientsService patientsService; | |
32 | + | |
33 | + @Autowired | |
34 | + private BasicConfigService basicConfigService; | |
35 | + | |
36 | + @Autowired | |
37 | + private OrganizationService organizationService; | |
38 | + | |
39 | + @Autowired | |
40 | + private UsersService usersService; | |
41 | + | |
42 | + @Autowired | |
43 | + private AntenatalExaminationFacade antenatalExaminationFacade; | |
44 | + | |
45 | + public void saveRcPatientInfo(Patients patients) | |
46 | + { | |
47 | + Connection conn = null; | |
48 | + PreparedStatement ps = null; | |
49 | + try { | |
50 | + conn = ConnTools.makeConnection(); | |
51 | + | |
52 | + ps = conn.prepareStatement("delete from PREGNANT_BASE_INFO WHERE ID='"+patients.getId()+"'"); | |
53 | + ps.executeQuery(); | |
54 | + | |
55 | + //孕妇基本信息 | |
56 | + String baseInfoSql = "insert into PREGNANT_BASE_INFO(ID,NAME,ID_CARD,CERTIFICATE_TYPE,CERTIFICATE_NO,COMPANY,COUNTRY,TELPHONE,RESIDENCE_ADDRESS,RESIDENCE_PROVINCE," + | |
57 | + "RESIDENCE_CITY,RESIDENCE_COUNTRY,RESIDENCE_TOWN,RESIDENCE_VILIAGE,REGISTER_ADDRESS,REGISTER_PROVINCE,REGISTER_CITY,REGISTER_COUNTRY,REGISTER_TOWN,REGISTER_VILIAGE," + | |
58 | + "BIRTH_DATE,CONTACT_NAME,CONTACT_TEL_NO,HUSBAND_NAME,HUSBAND_ID_CARD,HUSBAND_TEL,HUSBAND_CERTIFICATE_TYPE,HUSBAND_CERTIFICATE_NO,HUSBAND_RESIDENCE_ADDRESS,HUSBAND_COMPANY," + | |
59 | + "STATUS,DATA_FROM_HOSPITAL,CREATE_TIME,UPDATE_TIME,OPERATOR,OPERAT_TIME,HEALTH_RECORD) " + | |
60 | + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
61 | + ps = conn.prepareStatement(baseInfoSql); | |
62 | + ps.setString(1,patients.getId()); | |
63 | + ps.setString(2,patients.getUsername()); | |
64 | + ps.setString(3,patients.getCardNo()); | |
65 | + ps.setString(4, CommonsHelper.getName1(patients.getPcerteTypeId(), basicConfigService)); | |
66 | + ps.setString(5,patients.getCardNo()); | |
67 | + ps.setString(6,patients.getPworkUnit()); | |
68 | + ps.setString(7, CommonsHelper.getName1(patients.getPcountryId(), basicConfigService)); | |
69 | + //居住地 | |
70 | + String liveAddress = CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), | |
71 | + patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService); | |
72 | + | |
73 | + ps.setString(8,liveAddress); | |
74 | + ps.setString(9,CommonsHelper.getName1(patients.getProvinceId(), basicConfigService)); | |
75 | + ps.setString(10,CommonsHelper.getName1(patients.getCityId(), basicConfigService)); | |
76 | + ps.setString(11,CommonsHelper.getName1(patients.getAreaId(), basicConfigService)); | |
77 | + ps.setString(12,CommonsHelper.getName1(patients.getStreetId(), basicConfigService)); | |
78 | + ps.setString(13,patients.getAddress()); | |
79 | + | |
80 | + //户籍地址 | |
81 | + String addressRegister = CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), | |
82 | + patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService); | |
83 | + | |
84 | + ps.setString(14,addressRegister); | |
85 | + ps.setString(15,CommonsHelper.getName1(patients.getProvinceRegisterId(), basicConfigService)); | |
86 | + ps.setString(16,CommonsHelper.getName1(patients.getCityRegisterId(), basicConfigService)); | |
87 | + ps.setString(17,CommonsHelper.getName1(patients.getAreaRegisterId(), basicConfigService)); | |
88 | + ps.setString(18, CommonsHelper.getName1(patients.getStreetRegisterId(), basicConfigService)); | |
89 | + ps.setString(19, patients.getAddressRegister()); | |
90 | + | |
91 | + ps.setDate(20, new Date(patients.getBirth().getTime())); | |
92 | + ps.setString(21, patients.getUsername()); | |
93 | + ps.setString(22, patients.getPhone()); | |
94 | + ps.setString(23, patients.getHusbandName()); | |
95 | + ps.setString(24, patients.getHcertificateNum()); | |
96 | + ps.setString(25,patients.getHusbandPhone()); | |
97 | + ps.setString(26,CommonsHelper.getName1(patients.getHcertificateTypeId(), basicConfigService)); | |
98 | + ps.setString(27, patients.getHcertificateNum()); | |
99 | + //户籍地址 | |
100 | + String haddressRegister = CommonsHelper.getResidence(patients.getHprovinceRegisterId(), patients.getHcityRegisterId(), | |
101 | + patients.getHareaRegisterId(), patients.getHstreetRegisterId(), patients.getHaddressRegister(), basicConfigService); | |
102 | + ps.setString(28, haddressRegister); | |
103 | + int week = DateUtil.getWeek(patients.getLastMenses(),patients.getBookbuildingDate()); | |
104 | + String status = ""; | |
105 | + //怀孕1~12周为早孕。 怀孕13周~27周为孕中,28周到40周围孕晚期,分娩后是产后,产后42天后不再属于孕期妇女 | |
106 | + if (week >=0 && 12 >= week) | |
107 | + { | |
108 | + status= "1"; | |
109 | + } | |
110 | + else if (week >=13 && 27 >= week) | |
111 | + { | |
112 | + status= "2"; | |
113 | + } | |
114 | + else if (week >=28 && 40 >= week) | |
115 | + { | |
116 | + status= "3"; | |
117 | + } | |
118 | + else | |
119 | + { | |
120 | + status= "4"; | |
121 | + } | |
122 | + ps.setString(29, status); | |
123 | + ps.setString(30, CommonsHelper.getHospitalName(patients.getHospitalId(), organizationService)); | |
124 | + | |
125 | + ps.setDate(31, new Date(patients.getCreated().getTime())); | |
126 | + ps.setDate(32, new Date(patients.getModified().getTime())); | |
127 | + ps.setString(33, CommonsHelper.getUserName(patients.getBookbuildingDoctor(), usersService)); | |
128 | + ps.setDate(34, new Date(patients.getCreated().getTime())); | |
129 | + ps.setString(35, patients.getFileCode()); | |
130 | + System.out.print(baseInfoSql); | |
131 | + int saveCount = ps.executeUpdate(); | |
132 | + System.out.println("saveCount="+saveCount); | |
133 | + } | |
134 | + catch (Exception e) | |
135 | + { | |
136 | + ExceptionUtils.catchException(e,"saveRcPatientInfo error."); | |
137 | + }finally { | |
138 | + try { | |
139 | + if (ps != null) | |
140 | + { | |
141 | + ps.close(); | |
142 | + } | |
143 | + if (conn != null) | |
144 | + { | |
145 | + conn.close(); | |
146 | + } | |
147 | + } catch (SQLException e) { | |
148 | + } | |
149 | + } | |
150 | + } | |
151 | + | |
152 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
0d0b3e0
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | import com.lyms.hospitalapi.lcdcf.LcdcfFmService; |
8 | 8 | import com.lyms.hospitalapi.qhdfy.QhdfyFmService; |
9 | 9 | import com.lyms.hospitalapi.qhdfy.QhdfyHisService; |
10 | +import com.lyms.hospitalapi.rcfy.RcGlxtService; | |
10 | 11 | import com.lyms.hospitalapi.zcfy.ZcPrenatalService; |
11 | 12 | import com.lyms.platform.biz.JdbcUtil; |
12 | 13 | import com.lyms.platform.biz.service.*; |
... | ... | @@ -157,6 +158,9 @@ |
157 | 158 | private CdGwInterface cdGwInterface; |
158 | 159 | |
159 | 160 | @Autowired |
161 | + private RcGlxtService rcGlxtService; | |
162 | + | |
163 | + @Autowired | |
160 | 164 | private MatDeliverFacade matDeliverFacade; |
161 | 165 | |
162 | 166 | |
... | ... | @@ -2382,5 +2386,39 @@ |
2382 | 2386 | |
2383 | 2387 | @Autowired |
2384 | 2388 | private PatientServiceService patientServiceService; |
2389 | + | |
2390 | + @RequestMapping(value = "/rcPatientInfo", method = RequestMethod.GET) | |
2391 | + @ResponseBody | |
2392 | + public void rcPatientInfo(@RequestParam(required = false) String hospitalId) { | |
2393 | + | |
2394 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
2395 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
2396 | + if (StringUtils.isNotEmpty(hospitalId)) { | |
2397 | + organizationQuery.setId(Integer.parseInt(hospitalId)); | |
2398 | + } | |
2399 | + List<Organization> organizationList = organizationService.queryOrganization(organizationQuery); | |
2400 | + | |
2401 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
2402 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
2403 | + if (CollectionUtils.isNotEmpty(organizationList)) { | |
2404 | + List<String> hids = new ArrayList<>(); | |
2405 | + for (Organization org :organizationList) | |
2406 | + { | |
2407 | + hids.add(org.getId()+""); | |
2408 | + } | |
2409 | + patientsQuery1.setHospitalList(hids); | |
2410 | + } | |
2411 | + | |
2412 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery1); | |
2413 | + if (CollectionUtils.isNotEmpty(patientses)) | |
2414 | + { | |
2415 | + for (Patients pat : patientses) | |
2416 | + { | |
2417 | + rcGlxtService.saveRcPatientInfo(pat); | |
2418 | + } | |
2419 | + } | |
2420 | + } | |
2421 | + | |
2422 | + | |
2385 | 2423 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
0d0b3e0
... | ... | @@ -429,7 +429,7 @@ |
429 | 429 | } |
430 | 430 | |
431 | 431 | String courseName = CollectionUtils.isNotEmpty(courseModels1) ? courseModels1.get(0).getCourseName() : ""; |
432 | - saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPhone(), | |
432 | + saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPatientId(), | |
433 | 433 | courseName,speaker,patientCourseModel.getId(),patientCourseModel.getCourseId()); |
434 | 434 | } |
435 | 435 | } |