diff --git a/platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/ConnTools.java b/platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/ConnTools.java new file mode 100644 index 0000000..bfa9a0a --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/ConnTools.java @@ -0,0 +1,33 @@ +package com.lyms.hospitalapi.rcfy; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +/** + * Created by Administrator on 2016/9/9 0009. + */ +public class ConnTools { + + private static String dirverClassName = "com.mysql.jdbc.Driver"; + private static String url = "jdbc:mysql://119.90.57.26:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; + private static String user = "platform"; + private static String password = "platform123"; + + public static Connection makeConnection() { + Connection conn = null; + try { + Class.forName(dirverClassName); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + try { + conn = DriverManager.getConnection(url, user, password); + } catch (SQLException e) { + e.printStackTrace(); + } + return conn; + } + + +} diff --git a/platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/RcGlxtService.java b/platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/RcGlxtService.java new file mode 100644 index 0000000..20f9030 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/hospitalapi/rcfy/RcGlxtService.java @@ -0,0 +1,152 @@ +package com.lyms.hospitalapi.rcfy; + + +import com.lyms.platform.biz.service.*; + +import com.lyms.platform.common.utils.DateUtil; +import com.lyms.platform.common.utils.ExceptionUtils; +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; + +import com.lyms.platform.operate.web.utils.CommonsHelper; +import com.lyms.platform.permission.service.OrganizationService; +import com.lyms.platform.permission.service.UsersService; +import com.lyms.platform.pojo.Patients; +import org.apache.commons.dbutils.QueryRunner; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + + +/** + * Created by Administrator on 2016/10/19 0019. + */ +@Service("rcGlxtService") +public class RcGlxtService { + + @Autowired + private PatientsService patientsService; + + @Autowired + private BasicConfigService basicConfigService; + + @Autowired + private OrganizationService organizationService; + + @Autowired + private UsersService usersService; + + @Autowired + private AntenatalExaminationFacade antenatalExaminationFacade; + + public void saveRcPatientInfo(Patients patients) + { + Connection conn = null; + PreparedStatement ps = null; + try { + conn = ConnTools.makeConnection(); + + ps = conn.prepareStatement("delete from PREGNANT_BASE_INFO WHERE ID='"+patients.getId()+"'"); + ps.executeQuery(); + + //孕妇基本信息 + String baseInfoSql = "insert into PREGNANT_BASE_INFO(ID,NAME,ID_CARD,CERTIFICATE_TYPE,CERTIFICATE_NO,COMPANY,COUNTRY,TELPHONE,RESIDENCE_ADDRESS,RESIDENCE_PROVINCE," + + "RESIDENCE_CITY,RESIDENCE_COUNTRY,RESIDENCE_TOWN,RESIDENCE_VILIAGE,REGISTER_ADDRESS,REGISTER_PROVINCE,REGISTER_CITY,REGISTER_COUNTRY,REGISTER_TOWN,REGISTER_VILIAGE," + + "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," + + "STATUS,DATA_FROM_HOSPITAL,CREATE_TIME,UPDATE_TIME,OPERATOR,OPERAT_TIME,HEALTH_RECORD) " + + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + ps = conn.prepareStatement(baseInfoSql); + ps.setString(1,patients.getId()); + ps.setString(2,patients.getUsername()); + ps.setString(3,patients.getCardNo()); + ps.setString(4, CommonsHelper.getName1(patients.getPcerteTypeId(), basicConfigService)); + ps.setString(5,patients.getCardNo()); + ps.setString(6,patients.getPworkUnit()); + ps.setString(7, CommonsHelper.getName1(patients.getPcountryId(), basicConfigService)); + //居住地 + String liveAddress = CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), + patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService); + + ps.setString(8,liveAddress); + ps.setString(9,CommonsHelper.getName1(patients.getProvinceId(), basicConfigService)); + ps.setString(10,CommonsHelper.getName1(patients.getCityId(), basicConfigService)); + ps.setString(11,CommonsHelper.getName1(patients.getAreaId(), basicConfigService)); + ps.setString(12,CommonsHelper.getName1(patients.getStreetId(), basicConfigService)); + ps.setString(13,patients.getAddress()); + + //户籍地址 + String addressRegister = CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), + patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService); + + ps.setString(14,addressRegister); + ps.setString(15,CommonsHelper.getName1(patients.getProvinceRegisterId(), basicConfigService)); + ps.setString(16,CommonsHelper.getName1(patients.getCityRegisterId(), basicConfigService)); + ps.setString(17,CommonsHelper.getName1(patients.getAreaRegisterId(), basicConfigService)); + ps.setString(18, CommonsHelper.getName1(patients.getStreetRegisterId(), basicConfigService)); + ps.setString(19, patients.getAddressRegister()); + + ps.setDate(20, new Date(patients.getBirth().getTime())); + ps.setString(21, patients.getUsername()); + ps.setString(22, patients.getPhone()); + ps.setString(23, patients.getHusbandName()); + ps.setString(24, patients.getHcertificateNum()); + ps.setString(25,patients.getHusbandPhone()); + ps.setString(26,CommonsHelper.getName1(patients.getHcertificateTypeId(), basicConfigService)); + ps.setString(27, patients.getHcertificateNum()); + //户籍地址 + String haddressRegister = CommonsHelper.getResidence(patients.getHprovinceRegisterId(), patients.getHcityRegisterId(), + patients.getHareaRegisterId(), patients.getHstreetRegisterId(), patients.getHaddressRegister(), basicConfigService); + ps.setString(28, haddressRegister); + int week = DateUtil.getWeek(patients.getLastMenses(),patients.getBookbuildingDate()); + String status = ""; + //怀孕1~12周为早孕。 怀孕13周~27周为孕中,28周到40周围孕晚期,分娩后是产后,产后42天后不再属于孕期妇女 + if (week >=0 && 12 >= week) + { + status= "1"; + } + else if (week >=13 && 27 >= week) + { + status= "2"; + } + else if (week >=28 && 40 >= week) + { + status= "3"; + } + else + { + status= "4"; + } + ps.setString(29, status); + ps.setString(30, CommonsHelper.getHospitalName(patients.getHospitalId(), organizationService)); + + ps.setDate(31, new Date(patients.getCreated().getTime())); + ps.setDate(32, new Date(patients.getModified().getTime())); + ps.setString(33, CommonsHelper.getUserName(patients.getBookbuildingDoctor(), usersService)); + ps.setDate(34, new Date(patients.getCreated().getTime())); + ps.setString(35, patients.getFileCode()); + System.out.print(baseInfoSql); + int saveCount = ps.executeUpdate(); + System.out.println("saveCount="+saveCount); + } + catch (Exception e) + { + ExceptionUtils.catchException(e,"saveRcPatientInfo error."); + }finally { + try { + if (ps != null) + { + ps.close(); + } + if (conn != null) + { + conn.close(); + } + } catch (SQLException e) { + } + } + } + +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java index cd087f1..ba99882 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java @@ -7,6 +7,7 @@ import com.lyms.hospitalapi.dzfy.DzfyFmService; import com.lyms.hospitalapi.lcdcf.LcdcfFmService; import com.lyms.hospitalapi.qhdfy.QhdfyFmService; import com.lyms.hospitalapi.qhdfy.QhdfyHisService; +import com.lyms.hospitalapi.rcfy.RcGlxtService; import com.lyms.hospitalapi.zcfy.ZcPrenatalService; import com.lyms.platform.biz.JdbcUtil; import com.lyms.platform.biz.service.*; @@ -157,6 +158,9 @@ public class TestController extends BaseController { private CdGwInterface cdGwInterface; @Autowired + private RcGlxtService rcGlxtService; + + @Autowired private MatDeliverFacade matDeliverFacade; @@ -2382,4 +2386,38 @@ public class TestController extends BaseController { @Autowired private PatientServiceService patientServiceService; + + @RequestMapping(value = "/rcPatientInfo", method = RequestMethod.GET) + @ResponseBody + public void rcPatientInfo(@RequestParam(required = false) String hospitalId) { + + OrganizationQuery organizationQuery = new OrganizationQuery(); + organizationQuery.setYn(YnEnums.YES.getId()); + if (StringUtils.isNotEmpty(hospitalId)) { + organizationQuery.setId(Integer.parseInt(hospitalId)); + } + List organizationList = organizationService.queryOrganization(organizationQuery); + + PatientsQuery patientsQuery1 = new PatientsQuery(); + patientsQuery1.setYn(YnEnums.YES.getId()); + if (CollectionUtils.isNotEmpty(organizationList)) { + List hids = new ArrayList<>(); + for (Organization org :organizationList) + { + hids.add(org.getId()+""); + } + patientsQuery1.setHospitalList(hids); + } + + List patientses = patientsService.queryPatient(patientsQuery1); + if (CollectionUtils.isNotEmpty(patientses)) + { + for (Patients pat : patientses) + { + rcGlxtService.saveRcPatientInfo(pat); + } + } + } + + } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java index 1031241..99f1e18 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java @@ -429,7 +429,7 @@ public class CourseFacade { } String courseName = CollectionUtils.isNotEmpty(courseModels1) ? courseModels1.get(0).getCourseName() : ""; - saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPhone(), + saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPatientId(), courseName,speaker,patientCourseModel.getId(),patientCourseModel.getCourseId()); } }