//package com.ynxbd.common.dao; // //import com.ynxbd.api.result.his.HisTool; //import com.ynxbd.api.result.his.HisEnum; //import com.ynxbd.api.result.his.HisResult; //import com.ynxbd.common.bean.*; //import com.ynxbd.api.config.WeChatConfig; //import com.ynxbd.api.utils.DateGenerate; //import com.ynxbd.api.utils.XMLUtil; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; // //import java.text.DateFormat; //import java.text.ParseException; //import java.text.SimpleDateFormat; //import java.util.*; // ///** // * @author 张剑峰 // * @version v1.0.0 // * @Project: 微信公众号 // * @date 2017年5月10日下午3:29:28 // * @Copyright: 2017 云南新八达科技有限公司 All rights reserved. // */ //public class WSDao { // public static final String CALL_NO = "843242395"; // // private final static Logger log = LoggerFactory.getLogger(WSDao.class); // //// /** //// * 获取医院列表 //// * //// * @return 医院列表 //// */ //// public List getHosList() { //// List list = new ArrayList<>(); //// Map input = new HashMap<>(); //// input.put("TransactionCode", 1); //// HisTool tool = new HisTool("AP_Query_Hospital", input); //// HospitalResponseBean bean = (HospitalResponseBean) XMLUtil.convertXmlStrToObject(HospitalResponseBean.class, //// tool.getRespos()); //// if (bean != null) { //// list = bean.getHos(); //// } //// return list; //// } // // /** // * 获取预约科室列表 // * // * @return 预约科室列表 // */ // public List getDeptList() { // List list = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "3001"); // input.put("DeptCode", "");// 空为所有 // input.put("ReservationDate", "");// 空为近7天 // HisTool tool = new HisTool("AP_Query_Reservation_Dept", input); // DeptResponseBean bean = (DeptResponseBean) XMLUtil.convertXmlStrToObject(DeptResponseBean.class, // tool.getRespos()); // if (bean != null) { // list = bean.getDept(); // } // return list; // } // // /** // * 获取现场挂号科室列表 // * // * @return 现场挂号科室列表 // */ // public List getRegDeptList() { // List list = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "2001"); // input.put("DeptCode", ""); // HisTool tool = new HisTool("AP_Query_Dept", input); // DeptResponseBean bean = (DeptResponseBean) XMLUtil.convertXmlStrToObject(DeptResponseBean.class, // tool.getRespos()); // if (bean != null) { // list = bean.getDept(); // } // // // 华坪早上6点到下午5点可以挂号,急诊科全天可以挂 // if (WeChatConfig.getAppId().equals("wx18b15dc67fc96f89")) { // List lstReturn = new ArrayList(); // DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // Date dEnd = null, dStart = null, now = null; // try { // dStart = dFormat.parse(DateGenerate.getStringDateShort() + " 00:00:00"); // dEnd = dFormat.parse(DateGenerate.getStringDateShort() + " 17:00:00"); // now = DateGenerate.getNow(); // if ((now.getTime() >= dStart.getTime()) && (now.getTime() <= dEnd.getTime())) { // return list; // } else { // for (DeptBean deptBean : list) { // if (deptBean.getName().equals("急诊科") || deptBean.getName().equals("急诊外科") // || deptBean.getName().equals("儿科")) { // lstReturn.add(deptBean); // } // } // return lstReturn; // } // } catch (ParseException e) { // e.printStackTrace(); // } // } else if (WeChatConfig.getAppId().equals("wx99b45c38093d17f9")) { // 武定县人民医院挂号时间段定为7:30-11:30 // // 13:30-17:00 // List lstReturn = new ArrayList<>(); // DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // Date dEnd = null, dStart = null, now = null, dEnd2 = null, dStart2 = null; // try { // dStart = dFormat.parse(DateGenerate.getStringDateShort() + " 07:30:00"); // dEnd = dFormat.parse(DateGenerate.getStringDateShort() + " 11:30:00"); // dStart2 = dFormat.parse(DateGenerate.getStringDateShort() + " 13:30:00"); // dEnd2 = dFormat.parse(DateGenerate.getStringDateShort() + " 17:00:00"); // now = DateGenerate.getNow(); // if (((now.getTime() >= dStart.getTime()) && (now.getTime() <= dEnd.getTime())) // || ((now.getTime() >= dStart2.getTime()) && (now.getTime() <= dEnd2.getTime()))) { // return list; // } else { // return lstReturn; // } // } catch (ParseException e) { // e.printStackTrace(); // } // } // return list; // } // // /** // * 获取医生列表 // * // * @param deptCode 科室代码 // * @return 医生列表 // */ // public List getDoctList(String deptCode) { // List list = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "3002"); // input.put("DeptCode", deptCode); // input.put("DoctCode", ""); // // // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // // input.put("ReservationDate", sdf.format(new Date())); // // input.put("ReservationDate", ""); // input.put("AllowReservationFlag", "1"); // HisTool tool = new HisTool("AP_Query_Reservation_Doct", input); // DoctResponseBean bean = (DoctResponseBean) XMLUtil.convertXmlStrToObject(DoctResponseBean.class, // tool.getRespos()); // if (bean.getResponseCode().equals("-1")) { // return list; // } // // // 富民晚班不能预约 // if (WeChatConfig.getAppId().equals("wx14ea983bce19d64c")) { // list = bean.getDoctor(); // List lstTmp = new ArrayList<>(); // for (DoctBean doctBean : list) { // if (!doctBean.getTID().trim().contains("晚班")) { // lstTmp.add(doctBean); // } // } // list = lstTmp; // } else { // list = bean.getDoctor(); // } // return list; // } // // /** // * 获取现场挂号医生列表 // * // * @param deptCode 科室代码 // * @return 医生列表 // */ // public List getRegDoctList(String deptCode) { // List list = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "2002"); // input.put("DeptCode", deptCode); // input.put("DoctCode", ""); // input.put("AllowRegistFlag", 1);// 只返回有号源的医生 // HisTool tool = new HisTool("AP_Query_Doct", input); // RegDoctResponseBean bean = (RegDoctResponseBean) XMLUtil.convertXmlStrToObject(RegDoctResponseBean.class, // tool.getRespos()); // // if (bean.getResponseCode().equals("-1")) { // return list; // } // // list = bean.getDoctor(); // List lstDoct1 = new ArrayList<>(); // List lstDoct2 = new ArrayList<>(); // List lstDoct3 = new ArrayList<>(); // List lstDoct4 = new ArrayList<>(); // for (RegDoctBean regDoctBean : list) { // if (regDoctBean.getTID().trim().contains("上午") || regDoctBean.getTID().trim().contains("全天") // || regDoctBean.getTID().trim().contains("上午及下午")) { // lstDoct1.add(regDoctBean); // } // if (regDoctBean.getTID().trim().contains("中午") || regDoctBean.getTID().trim().contains("全天")) { // lstDoct2.add(regDoctBean); // } // if (regDoctBean.getTID().trim().contains("下午") || regDoctBean.getTID().trim().contains("全天") // || regDoctBean.getTID().trim().contains("上午及下午")) { // lstDoct3.add(regDoctBean); // } // if (regDoctBean.getTID().trim().contains("晚班") || regDoctBean.getTID().trim().contains("全天")) { // lstDoct4.add(regDoctBean); // } // } // // DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // Date dEnd = null, dStart = null, dStart2 = null, dEnd2 = null, dStart3 = null, dEnd3 = null, dStart4 = null, // dEnd4 = null, now = null; // try { // // if (WeChatConfig.getAppId().equals("wxd5fe0b27453f5a1f")) { // 古城区人民医院 // dStart = dFormat.parse(DateGenerate.getStringDateShort() + " 08:00:00"); // dEnd = dFormat.parse(DateGenerate.getStringDateShort() + " 11:59:00"); // dStart2 = dFormat.parse(DateGenerate.getStringDateShort() + " 12:00:00"); // dEnd2 = dFormat.parse(DateGenerate.getStringDateShort() + " 13:54:00"); // dStart3 = dFormat.parse(DateGenerate.getStringDateShort() + " 13:55:00"); // dEnd3 = dFormat.parse(DateGenerate.getStringDateShort() + " 17:29:00"); // dStart4 = dFormat.parse(DateGenerate.getStringDateShort() + " 17:30:00"); // dEnd4 = dFormat.parse(DateGenerate.getStringDateShort() + " 07:59:00"); // // now = DateGenerate.getNow(); // if ((now.getTime() >= dStart.getTime()) && (now.getTime() <= dEnd.getTime())) { // list = lstDoct1; // } else if (now.getTime() >= dStart2.getTime() && now.getTime() <= dEnd2.getTime()) { // list = lstDoct2; // } else if (now.getTime() >= dStart3.getTime() && now.getTime() <= dEnd3.getTime()) { // list = lstDoct3; // } else { // list = lstDoct4; // } // } else if (WeChatConfig.getAppId().equals("wx64cc4b42bbed4090")) { // 蒙自市人民医院 // dStart = dFormat.parse(DateGenerate.getStringDateShort() + " 07:40:00"); // dEnd = dFormat.parse(DateGenerate.getStringDateShort() + " 11:30:00"); // dStart2 = dFormat.parse(DateGenerate.getStringDateShort() + " 11:31:00"); // dEnd2 = dFormat.parse(DateGenerate.getStringDateShort() + " 13:44:00"); // dStart3 = dFormat.parse(DateGenerate.getStringDateShort() + " 13:45:00"); // dEnd3 = dFormat.parse(DateGenerate.getStringDateShort() + " 17:30:00"); // dStart4 = dFormat.parse(DateGenerate.getStringDateShort() + " 17:31:00"); // dEnd4 = dFormat.parse(DateGenerate.getStringDateShort() + " 07:39:00"); // now = DateGenerate.getNow(); // if (now.getTime() >= dStart.getTime() && now.getTime() <= dEnd.getTime()) { // 上午 // list = lstDoct1; // } else if (now.getTime() >= dStart2.getTime() && now.getTime() <= dEnd2.getTime()) { // 中午 // list = lstDoct2; // } else if (now.getTime() >= dStart3.getTime() && now.getTime() <= dEnd3.getTime()) { // 下午 // list = lstDoct3; // } else { // list = lstDoct4; // } // } // // } catch (ParseException e) { // e.printStackTrace(); // } // return list; // } // // /** // * 获取病人绑定信息 // * // * @param cardNo 身份证号 // * @return 病人绑定信息 // */ // public PatientResponseBean getPatient(String cardNo, Integer cardType) { // Map input = new HashMap<>(); // input.put("TransactionCode", "1001"); // input.put("CallNo", CALL_NO); // input.put("CardNo", cardNo); // input.put("CardType", cardType);// 身份证 // HisTool tool = new HisTool("AP_Query_Patient", input); // PatientResponseBean bean = (PatientResponseBean) XMLUtil.convertXmlStrToObject(PatientResponseBean.class, // tool.getRespos()); // return bean; // } // // /** // * 绑定身份证号码 // * // * @param params // * @return // */ // public BindCardResponseBean bindCard(Map params) { // Map input = new HashMap<>(); // input.put("TransactionCode", "1002"); // input.put("CallNo", CALL_NO); // input.put("CardNo", params.get("cardno")); // input.put("CardType", params.get("cardtype")); // input.put("IdCardNo", params.get("idcardno")); // input.put("Name", params.get("name")); // input.put("Sex", params.get("sex")); // input.put("BirthDay", params.get("birthday")); // // input.put("Address", params.get("address")); // input.put("TransNo", params.get("transno")); // // if (params.get("nation") != null) { // input.put("Nation", params.get("nation")); // } // // if (params.get("tel") != null) { // input.put("Tel", params.get("tel")); // } // // if (params.get("GuardianFatherName") != null) // input.put("GuardianFatherName", params.get("GuardianFatherName")); // // if (params.get("GuardianFatherIdCard") != null) // input.put("GuardianFatherIdCard", params.get("GuardianFatherIdCard")); // // if (params.get("GuardianMotherName") != null) // input.put("GuardianMotherName", params.get("GuardianMotherName")); // // if (params.get("GuardianMotherIdCard") != null) // input.put("GuardianMotherIdCard", params.get("GuardianMotherIdCard")); // // if (params.get("GuardianFatherTel") != null) // input.put("GuardianFatherTel", params.get("GuardianFatherTel")); // // if (params.get("GuardianMotherTel") != null) // input.put("GuardianMotherTel", params.get("GuardianMotherTel")); // // HisTool tool = new HisTool("AP_Binding_Card", input); // BindCardResponseBean bean = (BindCardResponseBean) XMLUtil.convertXmlStrToObject(BindCardResponseBean.class, // tool.getRespos()); // // return bean; // } // // /** // * 解绑身份证 // * // * @param params 参数 // * @return // */ // public UnBindCardResponseBean unBindCard(Map params) { // Map input = new HashMap<>(); // input.put("TransactionCode", "1003"); // input.put("CallNo", CALL_NO); // input.put("CardNo", params.get("cardno")); // input.put("CardType", params.get("cardtype")); // input.put("TransNo", params.get("transno")); // HisTool tool = new HisTool("AP_UnBinding_Card", input); // UnBindCardResponseBean bean = (UnBindCardResponseBean) XMLUtil.convertXmlStrToObject(UnBindCardResponseBean.class, tool.getRespos()); // // return bean; // } // // /** // * 执行预约 // * // * @param params 参数 // * @return // */ // public Map reservation(Map params) { // Map result = new HashMap<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "3003"); // input.put("CallNo", CALL_NO); // input.put("PatientID", params.get("patientid")); // input.put("ReservationDate", params.get("reservationdate")); // input.put("DeptCode", params.get("deptcode")); // input.put("DoctCode", params.get("doctcode")); // input.put("ClinicCode", params.get("cliniccode")); // input.put("TID", params.get("tid")); // input.put("RegFee", params.get("regfee")); // input.put("ClinicFee", params.get("clinicfee")); // input.put("PayMoney", params.get("paymoney")); // input.put("PayDate", params.get("paydate")); // input.put("PayTime", params.get("paytime")); // input.put("TransNo", params.get("transno")); // input.put("PayDeviceID", params.get("paydeviceid")); // input.put("BankTransNo", params.get("banktransno")); // // // HisTool tool = new HisTool("AP_Reservation", input); // ReservationResponseBean bean = (ReservationResponseBean) XMLUtil // .convertXmlStrToObject(ReservationResponseBean.class, tool.getRespos()); // if (bean != null) { // if (bean.getResponseCode().equals("0")) { // result.put("histransno", bean.getHISTransNo()); // result.put("message", bean.getResponseMessage()); // } else { // result.put("histransno", ""); // result.put("message", bean.getResponseMessage()); // log.info("HIS挂号失败:patientid=" + params.get("patientid") + ",msg=" + bean.getResponseMessage()); // } // } // return result; // } // // /** // * 执行挂号 // * // * @param reserve 参数 // * @return map // */ // public HisResult reg(ReservationBean4Local reserve) { // Map params = new HashMap<>(); // params.put("PatientID", reserve.getPatientId()); // params.put("DeptCode", reserve.getDeptCode()); // params.put("DoctCode", reserve.getDoctCode()); // params.put("ClinicCode", reserve.getClinicCode()); // params.put("TID", reserve.getTID()); // params.put("RegFee", reserve.getRegFee()); // params.put("ClinicFee", reserve.getClinicFee()); // params.put("PayMoney", reserve.getPayMoney()); // params.put("PayDate", reserve.getPayDate()); // params.put("PayTime", reserve.getPayTime()); // params.put("TransNo", reserve.getTransNo()); // params.put("PayDeviceID", reserve.getPayDeviceId()); // params.put("BankTransNo", reserve.getBankTransNo()); // //// WSTool tool = new WSTool("AP_Regist", params); //// RegResponseBean bean = (RegResponseBean) XMLUtil.convertXmlStrToObject(RegResponseBean.class, tool.getRespos()); //// if (bean != null) { //// if (bean.getResponseCode().equals("0")) { //// result.put("histransno", bean.getHISTransNo()); //// result.put("message", bean.getResponseMessage()); //// result.put("mznum", bean.getMZNum()); //// } else { //// result.put("histransno", ""); //// result.put("message", bean.getResponseMessage()); //// result.put("mznum", "0"); //// logger.info("HIS挂号失败:patientId=" + reservation.getPatientId() + ",msg=" + bean.getResponseMessage()); //// } //// } // String responseXml = HisTool.getResponseXml(HisEnum.AP_Regist, params); // // return HisResult.xmlToBean(responseXml); // } // // public HisResult reg4Time(ReservationBean4Local reserve) { // Map params = new HashMap<>(); // params.put("PatientID", reserve.getPatientId()); // params.put("SourceId", reserve.getClinicCode()); // params.put("DeptCode", reserve.getDeptCode()); // params.put("DoctCode", reserve.getDoctCode()); // params.put("TimeInterval", reserve.getTID()); // params.put("BegTime", reserve.getBegTime()); // params.put("EndTime", reserve.getEndTime()); // params.put("RegistCode", reserve.getRegistCode()); // params.put("RegistDate", reserve.getReservationDate()); // params.put("PayMoney", reserve.getPayMoney()); // params.put("PayDate", reserve.getPayDate()); // params.put("PayTime", reserve.getPayTime()); // params.put("PayWay", "4"); // params.put("TransNo", reserve.getBankTransNo()); // // String responseXml = HisTool.getResponseXml(HisEnum.AP_Regist_New, params); // // return HisResult.xmlToBean(responseXml); // } // // public static void main(String[] args) { // HisResult hisResult = HisResult.xmlToBean("70040成功357325早V10 "); // System.out.println(hisResult.getResponseCode() == -1); // System.out.println(hisResult); // } // // /** // * 查询患者是否预约过 // * // * @param patientID 患者ID // * @param reservationDate 预约时间 // */ // public boolean hasReservationed(String patientID, String reservationDate) { // boolean result = false; // Map input = new HashMap<>(); // input.put("TransactionCode", "3004"); // input.put("PatientID", patientID); // input.put("ReservationDate", reservationDate); // input.put("ReservationTransNo", ""); // input.put("AfterTodayFlag", "0"); // HisTool tool = new HisTool("AP_Query_Reservation", input); // QueryReservationResponseBean bean = null; // try { // bean = (QueryReservationResponseBean) XMLUtil.convertXmlStrToObject(QueryReservationResponseBean.class, // tool.getRespos()); // } finally { // if (bean != null) { // result = bean.getResponseCode().equals("0"); // } // } // return result; // } // // /** // * 查询患者是否挂过号 // * // * @param patientId 患者ID // * @param regDate 挂号时间 // * @return // */ // public List hasReg(String patientId, String regDate) { // List lstRegBean = new ArrayList<>(); // // Map input = new HashMap<>(); // input.put("TransactionCode", "2004"); // input.put("PatientID", patientId); // input.put("MZNum", ""); // input.put("RegistDate", regDate); // HisTool tool = new HisTool("AP_Query_Regist", input); // try { // QueryRegResponseBean bean = (QueryRegResponseBean) XMLUtil.convertXmlStrToObject(QueryRegResponseBean.class, tool.getRespos()); // if (bean != null) { // List regBeans = bean.getReg(); // if (regBeans != null) lstRegBean = regBeans; // } // } catch (Exception e) { // e.printStackTrace(); // } // return lstRegBean; // } // // // /** // * 获取患者所有预约信息 // * // * @param patientID 患者ID // * @return // */ // public List getReservation(String patientID) { // List lstReservationBean = new ArrayList(); // Map input = new HashMap<>(); // input.put("TransactionCode", "3004"); // input.put("PatientID", patientID); // input.put("ReservationDate", ""); // input.put("ReservationTransNo", ""); // input.put("AfterTodayFlag", "0"); // HisTool tool = new HisTool("AP_Query_Reservation", input); // QueryReservationResponseBean bean = new QueryReservationResponseBean(); // try { // bean = (QueryReservationResponseBean) XMLUtil.convertXmlStrToObject(QueryReservationResponseBean.class, // tool.getRespos()); // } catch (Exception e) { // e.printStackTrace(); // } // // if (bean != null || bean.getResponseCode().equals("0")) { // lstReservationBean = bean.getReservation(); // } else { // log.info("his返回失败,跳过"); // } // return lstReservationBean; // } // // /** // * 获取患者所有挂号记录 // * // * @param patientId 患者ID // * @return 患者所有挂号记录 // */ // public List getReg(String patientId) { // List lstRegBean = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "2004"); // input.put("PatientID", patientId); // input.put("MZNum", ""); // input.put("RegistDate", ""); // HisTool tool = new HisTool("AP_Query_Regist", input); // QueryRegResponseBean bean = (QueryRegResponseBean) XMLUtil.convertXmlStrToObject(QueryRegResponseBean.class, // tool.getRespos()); // if (bean != null) { // lstRegBean = bean.getReg(); // } // return lstRegBean; // } // // public List getReg4Time(String patientId) { // List lstRegBean = new ArrayList<>(); // // Map input = new HashMap<>(); // input.put("TransactionCode", "2004"); // input.put("PatientID", patientId); // input.put("MZNum", ""); // input.put("RegistDate", ""); // HisTool tool = new HisTool("AP_Query_Regist", input); // Time_QueryRegResponseBean bean = (Time_QueryRegResponseBean) XMLUtil // .convertXmlStrToObject(Time_QueryRegResponseBean.class, tool.getRespos()); // if (bean != null) { // lstRegBean = bean.getReg(); // } // return lstRegBean; // } // // /** // * 取消预约 // * // * @param patientID 患者ID // * @param transNo 预约时的流水号 // * @return // */ // public CancelReservationResponseBean cancelReservation(String patientID, String transNo) { // Map input = new HashMap<>(); // input.put("TransactionCode", "3006"); // input.put("CallNo", CALL_NO); // input.put("PatientID", patientID); // input.put("ReservationTransNo", transNo); // input.put("RecallTransNo", UUID.randomUUID().toString()); // HisTool tool = new HisTool("AP_Recall_Reservation", input); // CancelReservationResponseBean cancelReservationResponseBean = (CancelReservationResponseBean) XMLUtil // .convertXmlStrToObject(CancelReservationResponseBean.class, tool.getRespos()); // return cancelReservationResponseBean; // } // // /** // * 待付费项目 // * // * @param patientID 患者ID // * @return // */ // public List getUnPayRecipe(String patientID) { // Map input = new HashMap<>(); // input.put("TransactionCode", "4001"); // input.put("PatientID", patientID); // HisTool tool = new HisTool("AP_Query_UnPay_Invoice", input); // QueryUnPayBean queryUnPayBean = (QueryUnPayBean) XMLUtil.convertXmlStrToObject(QueryUnPayBean.class, // tool.getRespos()); // List lstRecipeBean = new ArrayList(); // if (queryUnPayBean.getResponseCode().equals("0")) // lstRecipeBean = queryUnPayBean.getRecipe(); // // return lstRecipeBean; // } // // /** // * 所有已缴费项目 // * // * @param patientID 患者ID // * @return // */ // public List getPayedRecipe(String patientID, String startTime, String endTime) { // List lstRecipeBean = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "5005"); // input.put("PatientID", patientID); // input.put("RecipeID", ""); // input.put("StartTime", startTime); // input.put("EndTime", DateGenerate.getEndDateOfMonth(startTime)); // HisTool tool = new HisTool("AP_Query_OutpatientFee", input); // try { // QueryPayedBean queryPayedBean = (QueryPayedBean) XMLUtil.convertXmlStrToObject(QueryPayedBean.class, // tool.getRespos()); // if (queryPayedBean != null && queryPayedBean.getResponseCode().equals("0")) { // lstRecipeBean = queryPayedBean.getRecipe(); // } // } catch (Exception e) { // e.printStackTrace(); // } // return lstRecipeBean; // } // // /** // * 缴费:更新recipeID参数为List,支持多个处方单同时缴费 // * // * @param patientId 患者ID // * @param mzNum 门诊号 // * @param recipeIds 处方单号 // * @param payMoney 金额 // * @param payDate 支付时间 // * @param payTime 支付时间 // * @param transNo transNo // * @param payDeviceID payDeviceID // * @param bankTransNo 流水号 // * @return payInvoiceResponseBean // */ // public PayInvoiceResponseBean payInvoice(String patientId, String mzNum, List recipeIds, String payMoney, // String payDate, String payTime, String transNo, String payDeviceID, String bankTransNo) { // Map input = new HashMap<>(); // input.put("TransactionCode", "4002"); // input.put("CallNo", CALL_NO); // input.put("PatientID", patientId); // input.put("MZNum", mzNum); // input.put("PayMoney", payMoney); // input.put("PayDate", payDate); // input.put("PayTime", payTime); // input.put("TransNo", transNo); // input.put("PayDeviceID", payDeviceID); // input.put("BankTransNo", bankTransNo); // input.put("Recipe", recipeIds); // // HisTool tool = new HisTool("AP_Pay_Invoice", input); // PayInvoiceResponseBean payInvoiceResponseBean = (PayInvoiceResponseBean) XMLUtil // .convertXmlStrToObject(PayInvoiceResponseBean.class, tool.getRespos()); // try { // String drugInfo = payInvoiceResponseBean.getDrugInfo() == null ? "" : payInvoiceResponseBean.getDrugInfo(); // String invoiceTransNo = payInvoiceResponseBean.getInvoiceTransNo() == null ? "" : payInvoiceResponseBean.getInvoiceTransNo(); // log.info(String.format("发票流水号:invoiceTransNo=%s", invoiceTransNo)); // if (!drugInfo.equals("") && !invoiceTransNo.equals("")) { // log.info("调用快速发药:" + invoiceTransNo); // QuickDrugDispenseDao quickDrugDispenseDao = new QuickDrugDispenseDao(); // quickDrugDispenseDao.quickDrug(drugInfo, invoiceTransNo); // } // } catch (Exception e) { // log.info("快速发药调用失败:" + e.getMessage()); // e.printStackTrace(); // } // return payInvoiceResponseBean; // } // // // /** // * 检查申请单 // * // * @param lstPatient 患者集合 // * @return // */ // public List check(List lstPatient) { // List lstCheckResult = new ArrayList<>(); // for (PatientBaseBean patientBaseBean : lstPatient) { // Map input = new HashMap<>(); // input.put("TransactionCode", "5001"); // input.put("PatientID", patientBaseBean.getPatientID()); // HisTool tool = new HisTool("AP_Query_CheckApplication", input); // CheckResponseBean checkResponseBean = (CheckResponseBean) XMLUtil // .convertXmlStrToObject(CheckResponseBean.class, tool.getRespos()); // if (checkResponseBean.getResponseCode().equals("0")) { // Collections.sort(checkResponseBean.getReport(), new Comparator() { // public int compare(CheckReportBean arg0, CheckReportBean arg1) { // return arg1.getReportDate().compareTo(arg0.getReportDate()); // } // }); // lstCheckResult.add(checkResponseBean); // } // } // return lstCheckResult; // } // // // /** // * 检验单 // * // * @param lstPatient 患者集合 // * @return // */ // public List inspection(List lstPatient) { // List lstInspectionResult = new ArrayList<>(); // for (PatientBaseBean patientBaseBean : lstPatient) { // Map input = new HashMap<>(); // input.put("TransactionCode", "5002"); // input.put("PatientID", patientBaseBean.getPatientID()); // HisTool tool = new HisTool("AP_Query_InspectionApplication", input); // InspectionResponseBean inspectionResponseBean = (InspectionResponseBean) XMLUtil // .convertXmlStrToObject(InspectionResponseBean.class, tool.getRespos()); // if (inspectionResponseBean.getResponseCode().equals("0")) { // lstInspectionResult.add(inspectionResponseBean); // } // } // return lstInspectionResult; // } // // /** // * 分时段挂号查询科室 // * // * @param begDate 开始时间 // * @param endDate 结束时间 // * @return // */ // public List getTimeNewDeptList(String begDate, String endDate) { // List list = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "7001"); // input.put("CallNo", CALL_NO); // input.put("DeptCode", "");// 空为所有 // input.put("RegistBegDate", begDate); // input.put("RegistEndDate", endDate); // input.put("CanRegistFlag", "1"); // 1:返回有号源的科室 // HisTool tool = new HisTool("AP_Query_Dept_New", input); // Time_NewDeptResponseBean bean = (Time_NewDeptResponseBean) XMLUtil // .convertXmlStrToObject(Time_NewDeptResponseBean.class, tool.getRespos()); // if (bean != null) { // list = bean.getDept(); // } // return list; // } // // public List getTimeNewDoctList(String deptCode, String begDate, String endDate) { // List list = new ArrayList<>(); // Time_NewDept4DoctBean dept4DoctBean = null; // Map input = new HashMap<>(); // input.put("TransactionCode", "7002"); // input.put("CallNo", CALL_NO); // input.put("DeptCode", deptCode); // input.put("RegistBegDate", begDate); // input.put("RegistEndDate", endDate); // input.put("CanRegistFlag", "1"); // 1:仅返回有号源的医师 // HisTool tool = new HisTool("AP_Query_Doct_New", input); // Time_NewDoctResponseBean bean = (Time_NewDoctResponseBean) XMLUtil // .convertXmlStrToObject(Time_NewDoctResponseBean.class, tool.getRespos()); // if (bean != null) { // dept4DoctBean = bean.getDept(); // } // if (dept4DoctBean != null) { // list = dept4DoctBean.getDoct(); // } // return list; // } // // public List getTimeSource(String deptCode, String doctCode, String begDate, String endDate) { // Map input = new HashMap<>(); // input.put("TransactionCode", "7003"); // input.put("CallNo", CALL_NO); // input.put("DeptCode", deptCode); // input.put("DoctCode", doctCode); // input.put("RegistBegDate", begDate); // input.put("RegistEndDate", endDate); // input.put("CanRegistFlag", "1"); // input.put("TimeInterval", 0); // // HisTool toole = new HisTool("AP_Query_Register_Source_New", input); // Time_SourceResponseBean bean = (Time_SourceResponseBean) XMLUtil // .convertXmlStrToObject(Time_SourceResponseBean.class, toole.getRespos()); // List list = new ArrayList<>(); // list = bean.getDept(); // return list; // } // // /** // * 按时段查询号源 // * // * @return // */ // public List getTimeSource(String deptCode, String begDate, String endDate) { // Map input = new HashMap<>(); // input.put("TransactionCode", "7003"); // input.put("CallNo", CALL_NO); // input.put("DeptCode", deptCode); // // input.put("DoctCode", ""); // input.put("RegistBegDate", begDate); // input.put("RegistEndDate", endDate); // input.put("CanRegistFlag", "1"); // // DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // // Date dEnd = null, dStart = null, dStart2 = null, dEnd2 = null, // // dStart3 = null, dEnd3 = null, dStart4 = null, // // dEnd4 = null, now = null; // // try { // // dStart = dFormat.parse(DateGenerate.getStringDateShort() + " // // 07:55:00"); // // dEnd = dFormat.parse(DateGenerate.getStringDateShort() + " // // 12:00:00"); // // dStart2 = dFormat.parse(DateGenerate.getStringDateShort() + " // // 12:01:00"); // // dEnd2 = dFormat.parse(DateGenerate.getStringDateShort() + " // // 14:29:00"); // // dStart3 = dFormat.parse(DateGenerate.getStringDateShort() + " // // 14:30:00"); // // dEnd3 = dFormat.parse(DateGenerate.getStringDateShort() + " // // 18:00:00"); // // dStart4 = dFormat.parse(DateGenerate.getStringDateShort() + " // // 18:01:00"); // // dEnd4 = dFormat.parse(DateGenerate.getStringDateShort() + " // // 23:59:00"); // // // //// now = DateGenerate.getNow(); // // // 上午 08:00-11:59 // //// if ((now.getTime() >= dStart.getTime()) && (now.getTime() <= // // dEnd.getTime())) { // //// input.put("TimeInterval", 1); // //// // 中午 12:00-13:29 // //// } else if (now.getTime() >= dStart2.getTime() && now.getTime() <= // // dEnd2.getTime()) { // //// input.put("TimeInterval", 2); // //// // 下午 13:30-17:29 // //// } else if (now.getTime() >= dStart3.getTime() && now.getTime() <= // // dEnd3.getTime()) { // //// input.put("TimeInterval", 3); // //// // 晚上 17:30-07:59 // //// } else { // //// input.put("TimeInterval", 4); // //// } // // // // } catch (ParseException e) { // // // TODO Auto-generated catch block // // e.printStackTrace(); // // } // input.put("TimeInterval", 0); // // HisTool toole = new HisTool("AP_Query_Register_Source_New", input); // Time_SourceResponseBean bean = (Time_SourceResponseBean) XMLUtil // .convertXmlStrToObject(Time_SourceResponseBean.class, toole.getRespos()); // return bean.getDept(); // } // // // /** // * 查询体检报告 // * // * @param lstPatient 患者集合 // * @return // */ // public List getPEISReport(List lstPatient) { // List lstPEISReport = new ArrayList<>(); // for (PatientBaseBean patientBaseBean : lstPatient) { // Map input = new HashMap<>(); // input.put("TransactionCode", "9001"); // input.put("CallNo", CALL_NO); // input.put("IdCardNo", patientBaseBean.getIDCardNo()); // input.put("Name", patientBaseBean.getName()); // HisTool tool = new HisTool("AP_Query_PEISReport", input); // try { // QueryPEISReportBean bean = (QueryPEISReportBean) XMLUtil // .convertXmlStrToObject(QueryPEISReportBean.class, tool.getRespos()); // lstPEISReport.add(bean); // } catch (Exception ex) { // ex.printStackTrace(); // } // } // return lstPEISReport; // } // // /** // * 查询就诊记录 // * // * @return 就诊记录 // */ // public List treatRecord(String patientId, String begDate, String endDate, String patientType,String reportType) { // List mzList = new ArrayList<>(); // Map params = new HashMap<>(); // params.put("TransactionCode", "1004"); // params.put("CallNo", CALL_NO); // params.put("PatientId", patientId); // params.put("BegDate", begDate); // params.put("EndDate", endDate); // params.put("InOutState", patientType == null ? "0" : patientType); // ,1:门诊号,2:住院号,3:全部 // params.put("CheckOrInspection", reportType == null ? "0" : reportType); // 0:全部;1:检查;2:检验;3:检查+检验 // // HisTool tool = new HisTool("UniversalInterface", params); // // String xml = tool.getRespos(); // HisResult hisResult = HisResult.xmlToBean(xml); // // // WsResult{ResponseCode=0, ResponseMessage='成功', TransactionCode='1004', DataMap={Records=[{"Record":[{"InOutState":"1","ConsultDate":"2020-08-12 10:29:54","DeptCode":"1201","RegisterDate":"2020-08-12 10:29:54","DeptName":"口腔科","DoctName":"李加济","MZNum":"1252050","DoctCode":"0441"},{"InOutState":"1","ConsultDate":"2020-07-22 11:26:17","DeptCode":"1201","RegisterDate":"2020-07-22 11:26:17","DeptName":"口腔科","DoctName":"李加济","MZNum":"1234481","DoctCode":"0441"}]}]}} // if (hisResult.getResponseCode() == 0) { // 0成功 -1异常 // mzList = hisResult.getDataMapList(MZRecordBean.class, "Records", "Record"); // } // return mzList; // } // // /** // * 检验单 通过就诊记录调 // * // * @param patientId 患者ID // * @param mzNum 门诊号 // */ // public List inspection_new(String patientId, String mzNum) { // List lstInspectionResult = new ArrayList<>(); // // Map input = new HashMap<>(); // input.put("TransactionCode", "5002"); // input.put("MZNum", mzNum); // input.put("PatientID", patientId); // HisTool tool = new HisTool("AP_Query_InspectionApplication", input); // InspectionResponseBean inspectionResponseBean = (InspectionResponseBean) XMLUtil // .convertXmlStrToObject(InspectionResponseBean.class, tool.getRespos()); // if (inspectionResponseBean.getResponseCode().equals("0")) { // lstInspectionResult.add(inspectionResponseBean); // } // // return lstInspectionResult; // } // // /** // * 查询交易流水 // * // * @param startDate 开始时间 // * @param endDate 结束时间 // * @param hisTransNo hisTransNo // */ // public QueryTransactionResponseBean queryTransaction(String startDate, String endDate, String hisTransNo) { // QueryTransactionResponseBean resultBean = null; // Map input = new HashMap<>(); // input.put("TransactionCode", "5008"); // input.put("CallNo", CALL_NO); // input.put("StartDate", startDate); // input.put("EndDate", endDate); // input.put("DateType", "0"); // 0:交易日期,1:就诊日期 // input.put("IsContainsRefund", "0"); // 0:不包含负交易 eg:取消预约 // input.put("TransNo", hisTransNo); // HisTool tool = new HisTool("AP_Query_Transaction", input); // resultBean = (QueryTransactionResponseBean) XMLUtil.convertXmlStrToObject(QueryTransactionResponseBean.class, // tool.getRespos()); // return resultBean; // } // // /** // * his是否支付过 // * // * @param startDate 开始时间 // * @param endDate 结束时间 // * @param hisTransNo hisTransNo // */ // public Boolean hasOutPayed(String startDate, String endDate, String hisTransNo) { // boolean result = false; // QueryTransactionResponseBean responseBean = queryTransaction(startDate, endDate, hisTransNo); // if (responseBean != null) { // if (responseBean.getResponseCode().equals("0")) // result = true; // } // return result; // } // // /** // * 查询预交金缴费记录 // * // * @param patientId // * @return // */ // public List getPrepay(String patientId) { // List lstResult = new ArrayList<>(); // Map input = new HashMap<>(); // input.put("TransactionCode", "5003"); // input.put("CallNo", CALL_NO); // input.put("PatientID", patientId); // HisTool tool = new HisTool("AP_Query_Prepay", input); // PrepayResponseBean responseBean = (PrepayResponseBean) XMLUtil.convertXmlStrToObject(PrepayResponseBean.class, // tool.getRespos()); // if (responseBean != null) // lstResult = responseBean.getItem(); // // return lstResult; // // } // // /** // * 查询住院日费用汇总 (当天) // * // * @param patientId // * @param date // * @return // */ // public InPatientSummaryFeeResponseBean getInpatientSumFee(String patientId, String date) { // Map input = new HashMap<>(); // input.put("TransactionCode", "5006"); // input.put("PatientID", patientId); // input.put("FeeDate", date); // HisTool tool = new HisTool("AP_Query_InpatientSummaryFee", input); // InPatientSummaryFeeResponseBean result = (InPatientSummaryFeeResponseBean) XMLUtil.convertXmlStrToObject(InPatientSummaryFeeResponseBean.class, tool.getRespos()); // // return result; // } // // // /** // * 住院费用清单 // * // * @param patientId // * @return // */ // public InPatientFeeResponseBean getInpatientFee(String patientId) { // Map input = new HashMap<>(); // input.put("TransactionCode", "5004"); // input.put("PatientID", patientId); // HisTool tool = new HisTool("AP_Query_InpatientFee", input); // InPatientFeeResponseBean result = (InPatientFeeResponseBean) XMLUtil.convertXmlStrToObject(InPatientFeeResponseBean.class, tool.getRespos()); // // return result; // } // //}