Commit abdac1b0e652855a390572090a8597586f7f68a7

Authored by liquanyu
1 parent b7a7e9631f

公共卫生统计

Showing 3 changed files with 289 additions and 4 deletions

platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdPuerService.java View file @ abdac1b
1 1 package com.lyms.hospitalapi.qhdfy;
2 2  
3   -import com.lyms.hospitalapi.qhdfy.ConnTools;
  3 +import com.lyms.platform.biz.service.AntenatalExaminationService;
  4 +import com.lyms.platform.biz.service.PatientsService;
  5 +import com.lyms.platform.common.enums.YnEnums;
  6 +import com.lyms.platform.common.utils.DateUtil;
4 7 import com.lyms.platform.common.utils.ExceptionUtils;
  8 +
5 9 import java.sql.Connection;
6   -import java.util.ArrayList;
7   -import java.util.List;
8   -import java.util.Map;
  10 +import java.sql.PreparedStatement;
  11 +import java.sql.ResultSet;
  12 +import java.util.*;
  13 +
  14 +import com.lyms.platform.operate.web.utils.ResponseUtil;
  15 +import com.lyms.platform.permission.model.Organization;
  16 +import com.lyms.platform.permission.service.OrganizationService;
  17 +import com.lyms.platform.pojo.AntExChuModel;
  18 +import com.lyms.platform.pojo.Patients;
  19 +import com.lyms.platform.query.AntExChuQuery;
  20 +import com.lyms.platform.query.PatientsQuery;
  21 +import org.apache.commons.collections.CollectionUtils;
9 22 import org.apache.commons.dbutils.DbUtils;
10 23 import org.apache.commons.dbutils.QueryRunner;
11 24 import org.apache.commons.dbutils.ResultSetHandler;
12 25 import org.apache.commons.dbutils.handlers.MapHandler;
13 26 import org.apache.commons.lang3.StringUtils;
  27 +import org.springframework.beans.factory.annotation.Autowired;
14 28 import org.springframework.stereotype.Service;
15 29  
  30 +import javax.servlet.http.HttpServletResponse;
  31 +
16 32 /**
17 33 * 获取秦皇岛服务 分娩相关数据
18 34 */
19 35 @Service("QhdPuerService")
20 36 public class QhdPuerService {
  37 + @Autowired
  38 + private PatientsService patientsService;
  39 + @Autowired
  40 + private AntenatalExaminationService antenatalExaminationService;
  41 + @Autowired
  42 + private OrganizationService organizationService;
21 43 /**
22 44 * 获取分娩数量
23 45 * @param startTimeP
... ... @@ -44,6 +66,97 @@
44 66 DbUtils.closeQuietly(conn);
45 67 }
46 68 return rs;
  69 + }
  70 +
  71 +
  72 + public void queryZyRecord(String startTime, String endTime, HttpServletResponse response) {
  73 + Connection conn = ConnTools.makeHisConnection();
  74 + String sql ="{call usp_bb_zymz_pacs_tjsj (?,?)}";
  75 + PreparedStatement cst = null;
  76 + ResultSet rs =null;
  77 + try {
  78 + List<Map<String,Object>> list = new LinkedList<>();
  79 + Set<String> sets = new HashSet<>();
  80 + cst = conn.prepareCall(sql);
  81 + cst.setString(1,startTime);
  82 + cst.setString(2,endTime);
  83 + rs = cst.executeQuery();
  84 + while(rs!=null && rs.next()) {
  85 + Map<String,Object> model = new HashMap<>();
  86 + String cardNo = rs.getString("CertificateID");
  87 + if (!StringUtils.isNotEmpty(cardNo) || sets.contains(cardNo))
  88 + {
  89 + continue;
  90 + }
  91 + sets.add(cardNo);
  92 +
  93 + PatientsQuery patientsQuery1 = new PatientsQuery();
  94 + patientsQuery1.setYn(YnEnums.YES.getId());
  95 + patientsQuery1.setType(1); //
  96 + patientsQuery1.setCardNo(cardNo);
  97 + List<Patients> pats = patientsService.queryPatient(patientsQuery1);
  98 + model.put("isBuild","未建档");
  99 + model.put("buildHospital","");
  100 + if (CollectionUtils.isNotEmpty(pats))
  101 + {
  102 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  103 + antExChuQuery.setYn(YnEnums.YES.getId());
  104 + antExChuQuery.setPid(pats.get(0).getPid());
  105 + antExChuQuery.setCreatedTimeStart(DateUtil.addMonth(new Date(),-3));
  106 + antExChuQuery.setCreatedTimeEnd(new Date());
  107 + List <AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery);
  108 + if (CollectionUtils.isNotEmpty(data))
  109 + {
  110 + AntExChuModel antExChuModel = data.get(0);
  111 + Organization org = organizationService.getOrganization(Integer.parseInt( antExChuModel.getHospitalId()));
  112 + model.put("buildHospital",org.getName());
  113 + }
  114 + }
  115 + model.put("PTN_NAME",rs.getString("PTN_NAME"));
  116 + model.put("MedicalCardNumber",rs.getString("MedicalCardNumber"));
  117 + model.put("Telephone",rs.getString("Telephone"));
  118 + model.put("CertificateID",cardNo);
  119 + model.put("Address",rs.getString("Address"));
  120 + model.put("ReqDepartment",rs.getString("ReqDepartment"));
  121 + model.put("ReqPhysician",rs.getString("ReqPhysician"));
  122 + model.put("ExamDate",rs.getString("ExamDate"));
  123 + model.put("JKMZQK",rs.getString("JKMZQK"));
  124 + list.add(model);
  125 + }
  126 + Map<String, String> cnames = new LinkedHashMap<>();
  127 + cnames.put("PTN_NAME","患者姓名");
  128 + cnames.put("MedicalCardNumber","就诊卡");
  129 + cnames.put("Telephone","手机号码");
  130 + cnames.put("CertificateID","身份证号");
  131 + cnames.put("Address","地址");
  132 + cnames.put("ReqDepartment","门诊类型");
  133 + cnames.put("ReqPhysician","医生");
  134 + cnames.put("ExamDate","时间");
  135 + cnames.put("JKMZQK","建卡门诊情况");
  136 + cnames.put("isBuild","是否建档");
  137 + cnames.put("buildHospital","建档机构");
  138 + ResponseUtil.responseExcel(cnames, list, response);
  139 + } catch (Exception e) {
  140 + ExceptionUtils.catchException(e, "queryZyRecord : sql="+sql);
  141 + } finally {
  142 + try {
  143 + if(rs != null)
  144 + {
  145 + rs.close();
  146 + }
  147 + if(cst != null)
  148 + {
  149 + cst.close();
  150 + }
  151 + if(conn != null)
  152 + {
  153 + conn.close();
  154 + }
  155 + }catch (Exception e)
  156 + {
  157 + ExceptionUtils.catchException(e, "close error");
  158 + }
  159 + }
47 160 }
48 161 }
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdZyModel.java View file @ abdac1b
  1 +package com.lyms.hospitalapi.qhdfy;
  2 +
  3 +/**
  4 + * 秦皇岛妇幼早孕记录
  5 + */
  6 +public class QhdZyModel {
  7 + private String patientId;
  8 + private String ptnName;
  9 + private String medicalCardNumber;
  10 + private String telephone;
  11 + private String certificateID;
  12 + private String address;
  13 + private String reqDepartment;
  14 + private String reqPhysician;
  15 + private String examBodyPart;
  16 + private String examMethod;
  17 + private String medicalHistory;
  18 + private String examDate;
  19 + private String imageFinding;
  20 + private String impression;
  21 + private String reportDateTime;
  22 + private String userName;
  23 + private String jkmzqk;
  24 +
  25 + public String getPatientId() {
  26 + return patientId;
  27 + }
  28 +
  29 + public void setPatientId(String patientId) {
  30 + this.patientId = patientId;
  31 + }
  32 +
  33 + public String getPtnName() {
  34 + return ptnName;
  35 + }
  36 +
  37 + public void setPtnName(String ptnName) {
  38 + this.ptnName = ptnName;
  39 + }
  40 +
  41 + public String getMedicalCardNumber() {
  42 + return medicalCardNumber;
  43 + }
  44 +
  45 + public void setMedicalCardNumber(String medicalCardNumber) {
  46 + this.medicalCardNumber = medicalCardNumber;
  47 + }
  48 +
  49 + public String getTelephone() {
  50 + return telephone;
  51 + }
  52 +
  53 + public void setTelephone(String telephone) {
  54 + this.telephone = telephone;
  55 + }
  56 +
  57 + public String getCertificateID() {
  58 + return certificateID;
  59 + }
  60 +
  61 + public void setCertificateID(String certificateID) {
  62 + this.certificateID = certificateID;
  63 + }
  64 +
  65 + public String getAddress() {
  66 + return address;
  67 + }
  68 +
  69 + public void setAddress(String address) {
  70 + this.address = address;
  71 + }
  72 +
  73 + public String getReqDepartment() {
  74 + return reqDepartment;
  75 + }
  76 +
  77 + public void setReqDepartment(String reqDepartment) {
  78 + this.reqDepartment = reqDepartment;
  79 + }
  80 +
  81 + public String getReqPhysician() {
  82 + return reqPhysician;
  83 + }
  84 +
  85 + public void setReqPhysician(String reqPhysician) {
  86 + this.reqPhysician = reqPhysician;
  87 + }
  88 +
  89 + public String getExamBodyPart() {
  90 + return examBodyPart;
  91 + }
  92 +
  93 + public void setExamBodyPart(String examBodyPart) {
  94 + this.examBodyPart = examBodyPart;
  95 + }
  96 +
  97 + public String getExamMethod() {
  98 + return examMethod;
  99 + }
  100 +
  101 + public void setExamMethod(String examMethod) {
  102 + this.examMethod = examMethod;
  103 + }
  104 +
  105 + public String getMedicalHistory() {
  106 + return medicalHistory;
  107 + }
  108 +
  109 + public void setMedicalHistory(String medicalHistory) {
  110 + this.medicalHistory = medicalHistory;
  111 + }
  112 +
  113 + public String getExamDate() {
  114 + return examDate;
  115 + }
  116 +
  117 + public void setExamDate(String examDate) {
  118 + this.examDate = examDate;
  119 + }
  120 +
  121 + public String getImageFinding() {
  122 + return imageFinding;
  123 + }
  124 +
  125 + public void setImageFinding(String imageFinding) {
  126 + this.imageFinding = imageFinding;
  127 + }
  128 +
  129 + public String getImpression() {
  130 + return impression;
  131 + }
  132 +
  133 + public void setImpression(String impression) {
  134 + this.impression = impression;
  135 + }
  136 +
  137 + public String getReportDateTime() {
  138 + return reportDateTime;
  139 + }
  140 +
  141 + public void setReportDateTime(String reportDateTime) {
  142 + this.reportDateTime = reportDateTime;
  143 + }
  144 +
  145 + public String getUserName() {
  146 + return userName;
  147 + }
  148 +
  149 + public void setUserName(String userName) {
  150 + this.userName = userName;
  151 + }
  152 +
  153 + public String getJkmzqk() {
  154 + return jkmzqk;
  155 + }
  156 +
  157 + public void setJkmzqk(String jkmzqk) {
  158 + this.jkmzqk = jkmzqk;
  159 + }
  160 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerContoller.java View file @ abdac1b
... ... @@ -14,7 +14,9 @@
14 14 import org.springframework.web.bind.annotation.RequestMethod;
15 15 import org.springframework.web.bind.annotation.ResponseBody;
16 16  
  17 +import javax.servlet.http.HttpServletResponse;
17 18  
  19 +
18 20 /**
19 21 * 孕产妇围产管理--分娩管理--秦皇岛
20 22 */
... ... @@ -40,6 +42,16 @@
40 42 System.out.println("startTime" + startTimeP + " " + endTimeP);
41 43 List<Map> rs = this.qhdPuerService.queryPuerCnt(startTimeP.replaceAll("-", ""), endTimeP.replaceAll("-", ""));
42 44 baseResponse.setObject(rs);
  45 + return baseResponse;
  46 + }
  47 +
  48 + @RequestMapping(method = {RequestMethod.GET}, value = {"/queryZyRecord"})
  49 + @ResponseBody
  50 + public BaseResponse queryZyRecord(String startTime, String endTime, HttpServletResponse response) {
  51 + BaseResponse baseResponse = new BaseResponse();
  52 + startTime = startTime.replace("-","");
  53 + endTime = endTime.replace("-","");
  54 + qhdPuerService.queryZyRecord(startTime, endTime,response);
43 55 return baseResponse;
44 56 }
45 57 }