Commit e621f7c38acda4feb597c9f8fb4b8673633998d0

Authored by gengxiaokai
1 parent 361c1687ea

秦皇岛冠新公卫接口

Showing 3 changed files with 146 additions and 0 deletions

platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ e621f7c
... ... @@ -127,9 +127,28 @@
127 127 this.createdTimeStart = createdTimeStart;
128 128 }
129 129  
  130 + public Date getModifiedEnd() {
  131 + return modifiedEnd;
  132 + }
  133 +
  134 + public void setModifiedEnd(Date modifiedEnd) {
  135 + this.modifiedEnd = modifiedEnd;
  136 + }
  137 +
  138 + public Date getModifiedStart() {
  139 + return modifiedStart;
  140 + }
  141 +
  142 + public void setModifiedStart(Date modifiedStart) {
  143 + this.modifiedStart = modifiedStart;
  144 + }
  145 +
130 146 private Date createdTimeStart;
131 147 private Date createdTimeEnd;
132 148  
  149 + private Date modifiedStart;
  150 + private Date modifiedEnd;
  151 +
133 152 private Date bookbuildingDateStart;
134 153 private Date bookbuildingDateEnd;
135 154  
... ... @@ -1767,6 +1786,13 @@
1767 1786 c1 = c1.where("created").gte(createdTimeStart).lte(createdTimeEnd);
1768 1787 } else {
1769 1788 c1 = Criteria.where("created").gte(createdTimeStart).lte(createdTimeEnd);
  1789 + }
  1790 + }
  1791 + if (null != modifiedStart && modifiedEnd != null) {
  1792 + if (null != c1) {
  1793 + c1 = c1.where("modified").gte(modifiedStart).lte(modifiedEnd);
  1794 + } else {
  1795 + c1 = Criteria.where("modified").gte(modifiedStart).lte(modifiedEnd);
1770 1796 }
1771 1797 }
1772 1798  
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/ConnTools.java View file @ e621f7c
... ... @@ -54,6 +54,12 @@
54 54 private static String cslPassword = "platform123";
55 55  
56 56  
  57 + private static String jbgwDirverClassName = "oracle.jdbc.driver.OracleDriver";
  58 + private static String jbgwUrl = "jdbc:oracle:thin:@121.17.120.149:1521:orcl";
  59 + private static String jbgwUser = "LYMS_QHD_JBGW";
  60 + private static String jbgwPassword = "LYMS_QHD_JBGW";
  61 +
  62 +
57 63 public static Connection makeHisConnection() {
58 64 Connection conn = null;
59 65 try {
... ... @@ -108,6 +114,22 @@
108 114 }
109 115 try {
110 116 conn = DriverManager.getConnection(fmUrl, fmUser, fmPassword);
  117 + } catch (SQLException e) {
  118 + e.printStackTrace();
  119 + }
  120 + return conn;
  121 + }
  122 +
  123 +
  124 + public static Connection makeJbgwConnection() {
  125 + Connection conn = null;
  126 + try {
  127 + Class.forName(jbgwDirverClassName);
  128 + } catch (ClassNotFoundException e) {
  129 + e.printStackTrace();
  130 + }
  131 + try {
  132 + conn = DriverManager.getConnection(jbgwUrl, jbgwUser, jbgwPassword);
111 133 } catch (SQLException e) {
112 134 e.printStackTrace();
113 135 }
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdJbgwInterface.java View file @ e621f7c
  1 +package com.lyms.hospitalapi.qhdfy;
  2 +
  3 +import com.lyms.platform.biz.service.BasicConfigService;
  4 +import com.lyms.platform.biz.service.PatientsService;
  5 +import com.lyms.platform.common.enums.YnEnums;
  6 +import com.lyms.platform.common.utils.DateUtil;
  7 +import com.lyms.platform.operate.web.utils.CommonsHelper;
  8 +import com.lyms.platform.operate.web.utils.ResolveUtils;
  9 +import com.lyms.platform.permission.model.Organization;
  10 +import com.lyms.platform.permission.service.OrganizationService;
  11 +import com.lyms.platform.pojo.Patients;
  12 +import com.lyms.platform.query.PatientsQuery;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Service;
  15 +
  16 +import java.util.ArrayList;
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +/**
  22 + * Created by Administrator on 2018/8/17.
  23 + * 耿晓凯
  24 + */
  25 +
  26 +@Service("qhdJbgwInterface")
  27 +public class QhdJbgwInterface {
  28 +
  29 + @Autowired
  30 + private PatientsService patientsService;
  31 + @Autowired
  32 + private BasicConfigService basicConfigService;
  33 + @Autowired
  34 + private OrganizationService organizationService;
  35 +
  36 + /**
  37 + *
  38 + * @param startDate
  39 + * @param endDate
  40 + * @return
  41 + *
  42 + */
  43 + public List<Map<String,String>> getPatient(String startDate,String endDate){
  44 +
  45 + List<Map<String,String>> mList = new ArrayList<Map<String,String>>();
  46 + PatientsQuery patientsQuery = new PatientsQuery();
  47 + patientsQuery.setModifiedStart(DateUtil.parseYMDHMS(startDate));
  48 + patientsQuery.setModifiedEnd(DateUtil.parseYMDHMS(endDate));
  49 + List<Patients> list = patientsService.queryPatient(patientsQuery);
  50 + if(list != null && list.size() > 0){
  51 + for(Patients patients : list){
  52 + try{
  53 + Map<String,String> map = new HashMap<String,String>();
  54 + map.put("MATERNALINFOID",patients.getId());
  55 + map.put("NAME",patients.getUsername());
  56 + if("70ae1d93-2964-46bc-83fa-bec9ff605b1c".equals(patients.getHcertificateTypeId())){
  57 + map.put("IDCARD",patients.getCardNo());
  58 + }
  59 + map.put("TELNO",patients.getPhone());
  60 + map.put("BIRTHDAY",DateUtil.getyyyy_MM_dd(patients.getBirth()));
  61 + map.put("AGE",DateUtil.getAge(patients.getBirth()).toString());
  62 + map.put("UNIT",patients.getPworkUnit());
  63 + map.put("HUSBANDNAME",patients.getHusbandName());
  64 + if(patients.getHusbandBirth() != null){
  65 + map.put("HUSBANDAGE",DateUtil.getAge(patients.getHusbandBirth()).toString());
  66 + }
  67 + map.put("HUSBANDUNIT",patients.getHworkUnit());
  68 + map.put("ADDRESS",null);
  69 + map.put("HOUSEHOLDADDRESS", CommonsHelper.getResidence(patients.getHprovinceRegisterId(), patients.getHcityRegisterId(),
  70 + patients.getHareaRegisterId(), patients.getHstreetRegisterId(), patients.getHaddressRegister(),
  71 + basicConfigService));
  72 + map.put("HUSBANDTELNO",patients.getHusbandPhone());
  73 + map.put("MENSESLASTDATE",DateUtil.getyyyy_MM_dd(patients.getLastMenses()));
  74 + map.put("EXPECTEDCHILDBIRTHDAY",DateUtil.getyyyy_MM_dd(patients.getDueDate()));
  75 + String hospital = "";
  76 + if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getHospitalId())) {
  77 + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getHospitalId()));
  78 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  79 + hospital = organization.getName();
  80 + }
  81 + }
  82 + map.put("ORGNAME",hospital);
  83 + map.put("ORGCODE",patients.getHospitalId());
  84 + map.put("BUILDINGMANUALDATE",DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate()));
  85 + map.put("BUILDWEEKS", ResolveUtils.getPregnancyWeek(patients, patients.getBookbuildingDate()));
  86 + mList.add(map);
  87 +
  88 + }catch (Exception e){
  89 + e.printStackTrace();
  90 + continue;
  91 + }
  92 + }
  93 + }
  94 + return mList;
  95 + }
  96 +
  97 +
  98 +}