微信后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1069 lines
46 KiB

//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<HospitalBean> getHosList() {
//// List<HospitalBean> list = new ArrayList<>();
//// Map<Object, Object> 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<DeptBean> getDeptList() {
// List<DeptBean> list = new ArrayList<>();
// Map<Object, Object> 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<DeptBean> getRegDeptList() {
// List<DeptBean> 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<DeptBean> lstReturn = new ArrayList<DeptBean>();
// 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<DeptBean> 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<DoctBean> getDoctList(String deptCode) {
// List<DoctBean> list = new ArrayList<>();
// Map<Object, Object> 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<DoctBean> 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<RegDoctBean> getRegDoctList(String deptCode) {
// List<RegDoctBean> list = new ArrayList<>();
// Map<Object, Object> 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<RegDoctBean> lstDoct1 = new ArrayList<>();
// List<RegDoctBean> lstDoct2 = new ArrayList<>();
// List<RegDoctBean> lstDoct3 = new ArrayList<>();
// List<RegDoctBean> 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<Object, Object> 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<Object, Object> 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<Object, Object> 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<Object, Object> reservation(Map<Object, Object> params) {
// Map<Object, Object> result = new HashMap<>();
// Map<Object, Object> 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<String, Object> 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<String, Object> 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("<?xml version=\"1.0\" encoding=\"GB2312\"?><Response><TransactionCode>7004</TransactionCode><ResponseCode>0</ResponseCode><ResponseMessage>成功</ResponseMessage><HISTransNo>357325</HISTransNo><QueueNo>早V10</QueueNo></Response> ");
// 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<Object, Object> 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<RegBean> hasReg(String patientId, String regDate) {
// List<RegBean> lstRegBean = new ArrayList<>();
//
// Map<Object, Object> 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<RegBean> regBeans = bean.getReg();
// if (regBeans != null) lstRegBean = regBeans;
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return lstRegBean;
// }
//
//
// /**
// * 获取患者所有预约信息
// *
// * @param patientID 患者ID
// * @return
// */
// public List<ReservationBean> getReservation(String patientID) {
// List<ReservationBean> lstReservationBean = new ArrayList<ReservationBean>();
// Map<Object, Object> 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<RegBean> getReg(String patientId) {
// List<RegBean> lstRegBean = new ArrayList<>();
// Map<Object, Object> 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<Time_RegBean> getReg4Time(String patientId) {
// List<Time_RegBean> lstRegBean = new ArrayList<>();
//
// Map<Object, Object> 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<Object, Object> 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<RecipeBean> getUnPayRecipe(String patientID) {
// Map<Object, Object> 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<RecipeBean> lstRecipeBean = new ArrayList<RecipeBean>();
// if (queryUnPayBean.getResponseCode().equals("0"))
// lstRecipeBean = queryUnPayBean.getRecipe();
//
// return lstRecipeBean;
// }
//
// /**
// * 所有已缴费项目
// *
// * @param patientID 患者ID
// * @return
// */
// public List<RecipePayedBean> getPayedRecipe(String patientID, String startTime, String endTime) {
// List<RecipePayedBean> lstRecipeBean = new ArrayList<>();
// Map<Object, Object> 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<String> recipeIds, String payMoney,
// String payDate, String payTime, String transNo, String payDeviceID, String bankTransNo) {
// Map<Object, Object> 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<CheckResponseBean> check(List<PatientBaseBean> lstPatient) {
// List<CheckResponseBean> lstCheckResult = new ArrayList<>();
// for (PatientBaseBean patientBaseBean : lstPatient) {
// Map<Object, Object> 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<CheckReportBean>() {
// public int compare(CheckReportBean arg0, CheckReportBean arg1) {
// return arg1.getReportDate().compareTo(arg0.getReportDate());
// }
// });
// lstCheckResult.add(checkResponseBean);
// }
// }
// return lstCheckResult;
// }
//
//
// /**
// * 检验单
// *
// * @param lstPatient 患者集合
// * @return
// */
// public List<InspectionResponseBean> inspection(List<PatientBaseBean> lstPatient) {
// List<InspectionResponseBean> lstInspectionResult = new ArrayList<>();
// for (PatientBaseBean patientBaseBean : lstPatient) {
// Map<Object, Object> 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<Time_NewDeptBean> getTimeNewDeptList(String begDate, String endDate) {
// List<Time_NewDeptBean> list = new ArrayList<>();
// Map<Object, Object> 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<Time_NewDoctBean> getTimeNewDoctList(String deptCode, String begDate, String endDate) {
// List<Time_NewDoctBean> list = new ArrayList<>();
// Time_NewDept4DoctBean dept4DoctBean = null;
// Map<Object, Object> 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<Time_DeptBean> getTimeSource(String deptCode, String doctCode, String begDate, String endDate) {
// Map<Object, Object> 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<Time_DeptBean> list = new ArrayList<>();
// list = bean.getDept();
// return list;
// }
//
// /**
// * 按时段查询号源
// *
// * @return
// */
// public List<Time_DeptBean> getTimeSource(String deptCode, String begDate, String endDate) {
// Map<Object, Object> 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<QueryPEISReportBean> getPEISReport(List<PatientBaseBean> lstPatient) {
// List<QueryPEISReportBean> lstPEISReport = new ArrayList<>();
// for (PatientBaseBean patientBaseBean : lstPatient) {
// Map<Object, Object> 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<MZRecordBean> treatRecord(String patientId, String begDate, String endDate, String patientType,String reportType) {
// List<MZRecordBean> mzList = new ArrayList<>();
// Map<Object, Object> 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<InspectionResponseBean> inspection_new(String patientId, String mzNum) {
// List<InspectionResponseBean> lstInspectionResult = new ArrayList<>();
//
// Map<Object, Object> 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<Object, Object> 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<PrepayItemBean> getPrepay(String patientId) {
// List<PrepayItemBean> lstResult = new ArrayList<>();
// Map<Object, Object> 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<Object, Object> 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<Object, Object> 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;
// }
//
//}