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.
		
		
		
		
			
				
					
					
						
							1591 lines
						
					
					
						
							68 KiB
						
					
					
				
			
		
		
	
	
							1591 lines
						
					
					
						
							68 KiB
						
					
					
				| //package com.ynxbd.common.dao;
 | |
| //
 | |
| //import com.ynxbd.common.bean.*;
 | |
| //import com.ynxbd.api.config.datasource.DataBase;
 | |
| //import com.ynxbd.api.config.WeChatConfig;
 | |
| //import org.apache.commons.lang.math.NumberUtils;
 | |
| //import org.slf4j.Logger;
 | |
| //import org.slf4j.LoggerFactory;
 | |
| //import weixin.popular.api.PayMchAPI;
 | |
| //import weixin.popular.bean.paymch.SecapiPayRefund;
 | |
| //import weixin.popular.bean.paymch.SecapiPayRefundResult;
 | |
| //import weixin.popular.client.LocalHttpClient;
 | |
| //
 | |
| //import java.sql.Connection;
 | |
| //import java.sql.PreparedStatement;
 | |
| //import java.sql.ResultSet;
 | |
| //import java.sql.SQLException;
 | |
| //import java.util.ArrayList;
 | |
| //import java.util.List;
 | |
| //import java.util.Objects;
 | |
| //import java.util.UUID;
 | |
| //
 | |
| ///**
 | |
| // * @author 张剑峰
 | |
| // * @version v1.0.0
 | |
| // * @Project:微信公众号
 | |
| // * @date 2017年7月13日下午1:05:56
 | |
| // * @Copyright: 2017云南新八达科技有限公司 All rights reserved.
 | |
| // */
 | |
| //public class DBDao {
 | |
| //    private final static Logger log = LoggerFactory.getLogger(DBDao.class);
 | |
| //
 | |
| //
 | |
| //
 | |
| //
 | |
| //
 | |
| //    /**
 | |
| //     * 保存诊间支付信息
 | |
| //     *
 | |
| //     * @param payBean payBean
 | |
| //     */
 | |
| //    public void savePayInfo(PayBean payBean) {
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql;
 | |
| //        sql = "insert into pay(OpenID, TradeNo, PayStatus, PatientID, MZNum, RecipeID, PayMoney, UpdateTime, PayWay, Fee, HisStatus, RecipeJson, HisPayTransNo) values (?,?,?,?,?,?,?,now(),?,?,?,?,?)";
 | |
| //        PreparedStatement stmt;
 | |
| //        try {
 | |
| //            stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setString(1, payBean.getOpendID());
 | |
| //            stmt.setString(2, payBean.getTradeNo());
 | |
| //            stmt.setInt(3, -1);
 | |
| //            stmt.setString(4, payBean.getPatientID());
 | |
| //            stmt.setString(5, payBean.getMZNum());
 | |
| //            stmt.setString(6, payBean.getRecipeID());
 | |
| //            stmt.setString(7, payBean.getPayMoney());
 | |
| //            stmt.setInt(8, payBean.getPayWay());
 | |
| //            stmt.setString(9, payBean.getFee());
 | |
| //            stmt.setInt(10, -1);
 | |
| //            stmt.setString(11, payBean.getRecipeIdJson());
 | |
| //            stmt.setString(12, payBean.getHISPayTransNo());
 | |
| //            stmt.execute();
 | |
| //            stmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            log.info("savePayInfo异常" + e.getMessage());
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //    }
 | |
| //
 | |
| //    /***
 | |
| //     * 支付成功后,记录交易流水号
 | |
| //     * @param tradeNo tradeNo
 | |
| //     * @param bankTransNo bankTransNo
 | |
| //     */
 | |
| //    public void updatePayAfterNotify(String tradeNo, String bankTransNo) {
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update pay set BankTransNo = ?, PayStatus= 0 where TradeNo = ?";
 | |
| //        PreparedStatement stmt;
 | |
| //        try {
 | |
| //            stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setString(1, bankTransNo);
 | |
| //            stmt.setString(2, tradeNo);
 | |
| //            stmt.execute();
 | |
| //            stmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 更新单张处方支付信息
 | |
| //     *
 | |
| //     * @param tradeNo
 | |
| //     * @param hisTransNo
 | |
| //     * @param invoiceTransNo
 | |
| //     * @param recipeId
 | |
| //     */
 | |
| //    public void updatePayInfoSingle(String tradeNo, String hisTransNo, String invoiceTransNo, String recipeId) {
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update pay set HISTransNo = ?, InvoiceTransNo = ?, HisStatus = 0 where TradeNo = ? and recipeId = ?";
 | |
| //        PreparedStatement stmt;
 | |
| //        try {
 | |
| //            stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setString(1, hisTransNo);
 | |
| //            stmt.setString(2, invoiceTransNo);
 | |
| //            stmt.setString(3, tradeNo);
 | |
| //            stmt.setString(4, recipeId);
 | |
| //            stmt.execute();
 | |
| //            stmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //    }
 | |
| //
 | |
| //
 | |
| //    /**
 | |
| //     * 记录his缴费失败的错误信息(单张处方)
 | |
| //     *
 | |
| //     * @param tradeNo
 | |
| //     * @param message
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean updatePayAfterFailSingle(String tradeNo, String message, String recipeId) {
 | |
| //        Boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update pay set hisresult =? where tradeNo =? and recipeId =?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, message);
 | |
| //            pstmt.setString(2, tradeNo);
 | |
| //            pstmt.setString(3, recipeId);
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //
 | |
| //    public DoctHeadBean getDoctHead(String doctName) {
 | |
| //        DoctHeadBean doctHeadBean = null;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select * from Doct where DoctName =?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, doctName);
 | |
| //            ResultSet rs = pstmt.executeQuery();
 | |
| //            if (rs.next()) {
 | |
| //                doctHeadBean = new DoctHeadBean();
 | |
| //                doctHeadBean.setID(rs.getInt("ID"));
 | |
| //                doctHeadBean.setDoctCode(rs.getString("DoctCode"));
 | |
| //                doctHeadBean.setDoctName(rs.getString("DoctName"));
 | |
| //                doctHeadBean.setTitle(rs.getString("Title"));
 | |
| //                doctHeadBean.setSpec(rs.getString("Spec"));
 | |
| //                doctHeadBean.setHeadImage(rs.getString("HeadImage"));
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return doctHeadBean;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 根据openID查询name
 | |
| //     *
 | |
| //     * @param openID openID
 | |
| //     * @return name
 | |
| //     */
 | |
| //    public String getPatientName(String openID) {
 | |
| //        String name = "";
 | |
| //        Connection connection = DataBase.getConnection();
 | |
| //        String sql = "select name from patientbase where openid=?";
 | |
| //        PreparedStatement pStatement = null;
 | |
| //        try {
 | |
| //            pStatement = connection.prepareStatement(sql);
 | |
| //            pStatement.setString(1, openID);
 | |
| //            ResultSet rSet = pStatement.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                name = rSet.getString("name");
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(connection);
 | |
| //        }
 | |
| //
 | |
| //        return name;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 通过监护人身份证查询绑定信息
 | |
| //     *
 | |
| //     * @param fatherCardNo 父亲身份证号
 | |
| //     * @param motherCardNo 母亲身份证号
 | |
| //     * @return UUID
 | |
| //     */
 | |
| //    public String getPatientNoIdCardNo(String fatherCardNo, String motherCardNo, String name, String sex) {
 | |
| //        String uuid = "";
 | |
| //        Connection connection = DataBase.getConnection();
 | |
| //        String sql = "";
 | |
| //        if (!fatherCardNo.equals("") && !motherCardNo.equals(""))
 | |
| //            sql = "select UUID from patientbase where fatherIdCardNo=? and motheridCardNo=? and name=? and sex=?";
 | |
| //        else if (!fatherCardNo.equals("") && motherCardNo.equals(""))
 | |
| //            sql = "select UUID from patientbase where fatherIdCardNo=? and 1 <> ? and name=? and sex=?";
 | |
| //        else if (fatherCardNo.equals("") && !motherCardNo.equals(""))
 | |
| //            sql = "select UUID from patientbase where 1=? and motheridCardNo = ? and name=? and sex=?";
 | |
| //        PreparedStatement pStatement = null;
 | |
| //        try {
 | |
| //            pStatement = connection.prepareStatement(sql);
 | |
| //            pStatement.setString(1, fatherCardNo);
 | |
| //            pStatement.setString(2, motherCardNo);
 | |
| //            pStatement.setString(3, name);
 | |
| //            pStatement.setString(4, sex);
 | |
| //            ResultSet rSet = pStatement.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                uuid = rSet.getString("UUID");
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(connection);
 | |
| //        }
 | |
| //        return uuid;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 查询患者基本信息
 | |
| //     *
 | |
| //     * @param openid
 | |
| //     * @return
 | |
| //     */
 | |
| //    public List<PatientBaseBean> getPatientBase(String openid) {
 | |
| //        List<PatientBaseBean> lstResult = new ArrayList<>();
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select * from PatientBase where OpenID =?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, openid);
 | |
| //            ResultSet rs = pstmt.executeQuery();
 | |
| //            while (rs.next()) {
 | |
| //                PatientBaseBean patientBaseBean = new PatientBaseBean();
 | |
| //                patientBaseBean.setAddress(rs.getString("Address"));
 | |
| //                patientBaseBean.setAge(rs.getString("Age"));
 | |
| //                patientBaseBean.setBindDate(rs.getString("BindDate"));
 | |
| //                patientBaseBean.setBirthday(rs.getString("Birthday"));
 | |
| //                patientBaseBean.setHisTransNo(rs.getInt("HISTransNo"));
 | |
| //                patientBaseBean.setIDCardNo(rs.getString("IDCardNo"));
 | |
| //                patientBaseBean.setName(rs.getString("Name"));
 | |
| //                patientBaseBean.setOpenID(rs.getString("OpenID"));
 | |
| //                patientBaseBean.setPatientID(rs.getString("PatientID"));
 | |
| //                patientBaseBean.setSex(rs.getString("Sex"));
 | |
| //                patientBaseBean.setTel(rs.getString("Tel"));
 | |
| //                lstResult.add(patientBaseBean);
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return lstResult;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 查询微信是否绑定患者
 | |
| //     *
 | |
| //     * @param openID openid
 | |
| //     * @return 集合
 | |
| //     */
 | |
| //    public List<PatientBaseBean> hasBind(String openID) {
 | |
| //        List<PatientBaseBean> lstPatientBase = new ArrayList<PatientBaseBean>();
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select * from PatientBase where OpenID =?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, openID);
 | |
| //            ResultSet rs = pstmt.executeQuery();
 | |
| //            while (rs.next()) {
 | |
| //                PatientBaseBean patientBaseBean = new PatientBaseBean();
 | |
| //                patientBaseBean.setAddress(rs.getString("address"));
 | |
| //                patientBaseBean.setAge(rs.getString("age"));
 | |
| //                patientBaseBean.setBindDate(rs.getString("binddate"));
 | |
| //                patientBaseBean.setBirthday(rs.getString("birthday"));
 | |
| //                patientBaseBean.setHisTransNo(rs.getInt("histransno"));
 | |
| //                patientBaseBean.setIDCardNo(rs.getString("idcardno"));
 | |
| //                patientBaseBean.setName(rs.getString("name"));
 | |
| //                patientBaseBean.setOpenID(rs.getString("openid"));
 | |
| //                patientBaseBean.setPatientID(rs.getString("patientid"));
 | |
| //                patientBaseBean.setSex(rs.getString("sex"));
 | |
| //                patientBaseBean.setTel(rs.getString("tel"));
 | |
| //                patientBaseBean.setID(rs.getInt("ID"));
 | |
| //                patientBaseBean.setNation(rs.getString("Nation"));
 | |
| //                patientBaseBean.setFatherIDCardNo(rs.getString("FatherIDCardNo"));
 | |
| //                patientBaseBean.setFatherName(rs.getString("FatherName"));
 | |
| //                patientBaseBean.setFatherTel(rs.getString("FatherTel"));
 | |
| //                patientBaseBean.setMotherIDCardNo(rs.getString("MotherIDCardNo"));
 | |
| //                patientBaseBean.setMotherName(rs.getString("MotherName"));
 | |
| //                patientBaseBean.setMotherTel(rs.getString("MotherTel"));
 | |
| //                patientBaseBean.setUuid(rs.getString("UUID"));
 | |
| //                lstPatientBase.add(patientBaseBean);
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return lstPatientBase;
 | |
| //
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 当前微信是否绑定请求的患者ID
 | |
| //     *
 | |
| //     * @param openId
 | |
| //     * @param patientId
 | |
| //     * @return
 | |
| //     */
 | |
| //    public Boolean hasBind(String openId, String patientId) {
 | |
| //        Boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select * from PatientBase where OpenID =? and PatientID =?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, openId);
 | |
| //            pstmt.setString(2, patientId);
 | |
| //            ResultSet rs = pstmt.executeQuery();
 | |
| //            if (rs.next()) {
 | |
| //                result = true;
 | |
| //            }
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException throwables) {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 保存患者基本信息(已经在HIS中登记过基本资料)
 | |
| //     *
 | |
| //     * @param patient
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean savePatientInfo(PatientBaseBean patient) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "delete from patientbase where openid=? and idcardno=? and patientid=?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, patient.getOpenID());
 | |
| //            pstmt.setString(2, patient.getIDCardNo());
 | |
| //            pstmt.setString(3, patient.getPatientID());
 | |
| //            pstmt.execute();
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e1) {
 | |
| //            e1.printStackTrace();
 | |
| //        }
 | |
| //
 | |
| //        String sql2 = "insert into PatientBase( OpenID, PatientID, Name, Sex, Age, IDCardNo, Birthday, Tel, Address,Nation,"
 | |
| //                + "BindDate, HisTransNo, FatherName, FatherIDCardNo, FatherTel, MotherName, MotherIDCardNo, MotherTel, uuid) "
 | |
| //                + "values (?,?,?,?,?,?,?,?,?,?,now(),?,?,?,?,?,?,?,?)";
 | |
| //
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql2);
 | |
| //            pstmt.setString(1, patient.getOpenID());
 | |
| //            pstmt.setString(2, patient.getPatientID());
 | |
| //            pstmt.setString(3, patient.getName());
 | |
| //            pstmt.setString(4, patient.getSex());
 | |
| //            pstmt.setString(5, patient.getAge());
 | |
| //            pstmt.setString(6, patient.getIDCardNo());
 | |
| //            pstmt.setString(7, patient.getBirthday());
 | |
| //            pstmt.setString(8, patient.getTel());
 | |
| //            pstmt.setString(9, patient.getAddress());
 | |
| //            pstmt.setString(10, patient.getNation());
 | |
| //            pstmt.setInt(11, patient.getHisTransNo());
 | |
| //            pstmt.setString(12, patient.getFatherName());
 | |
| //            pstmt.setString(13, patient.getFatherIDCardNo());
 | |
| //            pstmt.setString(14, patient.getFatherTel());
 | |
| //            pstmt.setString(15, patient.getMotherName());
 | |
| //            pstmt.setString(16, patient.getMotherIDCardNo());
 | |
| //            pstmt.setString(17, patient.getMotherTel());
 | |
| //            pstmt.setString(18, patient.getUuid());
 | |
| //            System.out.println("准备执行sql");
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return result;
 | |
| //
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 保存微信基本信息
 | |
| //     *
 | |
| //     * @param wxinfo
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean saveWXInfo(WXInfoBean wxinfo) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "delete from wxinfo where openid = ?";
 | |
| //        PreparedStatement pstmt;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, wxinfo.getOpenID());
 | |
| //            pstmt.execute();
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e1) {
 | |
| //            e1.printStackTrace();
 | |
| //        }
 | |
| //
 | |
| //        String sql2 = "insert into WXInfo( OpenID, NickName, Sex, `Language`, City, Province, Country, Avatar, "
 | |
| //                + "UpdateDate) values(?,?,?,?,?,?,?,?,now())";
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql2);
 | |
| //            pstmt.setString(1, wxinfo.getOpenID());
 | |
| //            pstmt.setString(2, wxinfo.getNickName());
 | |
| //            pstmt.setInt(3, wxinfo.getSex());
 | |
| //            pstmt.setString(4, wxinfo.getLanguage());
 | |
| //            pstmt.setString(5, wxinfo.getCity());
 | |
| //            pstmt.setString(6, wxinfo.getProvince());
 | |
| //            pstmt.setString(7, wxinfo.getCountry());
 | |
| //            pstmt.setString(8, wxinfo.getHeadImgUrl());
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 保存支付结果信息
 | |
| //     *
 | |
| //     * @param payInfoBean
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean savePayResult(PayInfoBean payInfoBean) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "insert into payresult(OpenId, Info, TradeNo, UpdateDate) values (?, ?, ?, now())";
 | |
| //        PreparedStatement pstmt;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, payInfoBean.getOpenID());
 | |
| //            pstmt.setString(2, payInfoBean.getInfo());
 | |
| //            pstmt.setString(3, payInfoBean.getTradeNo());
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 查询是否存在支付记录(排重)
 | |
| //     *
 | |
| //     * @param payInfoBean
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean hasPayResult(PayInfoBean payInfoBean) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select count(*) as f_count from payresult where openid=? and tradeno =?";
 | |
| //        PreparedStatement pstmt;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, payInfoBean.getOpenID());
 | |
| //            pstmt.setString(2, payInfoBean.getTradeNo());
 | |
| //            ResultSet rs = pstmt.executeQuery();
 | |
| //            rs.next();
 | |
| //            int count = rs.getInt("f_count");
 | |
| //            if (count > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| ////    /***
 | |
| ////     * 查询是否已支付成功(his调用已成功)
 | |
| ////     * @param patientId
 | |
| ////     * @param mzNum
 | |
| ////     * @param recipeId
 | |
| ////     * @return
 | |
| ////     */
 | |
| ////    public boolean hasPaid(String patientId, String mzNum, String recipeId) {
 | |
| ////        boolean result = false;
 | |
| ////        Connection conn = DataBase.getConnection();
 | |
| ////        String sql = "select * from pay where patientid =? and mznum =? and recipeid =? and hisstatus=0";
 | |
| ////        PreparedStatement pstmt;
 | |
| ////        try {
 | |
| ////            pstmt = conn.prepareStatement(sql);
 | |
| ////            pstmt.setString(1, patientId);
 | |
| ////            pstmt.setString(2, mzNum);
 | |
| ////            pstmt.setString(3, recipeId);
 | |
| ////            ResultSet rs = pstmt.executeQuery();
 | |
| ////            if (rs.next()) {
 | |
| ////                result = true;
 | |
| ////            }
 | |
| ////            pstmt.close();
 | |
| ////        } catch (SQLException e) {
 | |
| ////            e.printStackTrace();
 | |
| ////        } finally {
 | |
| ////            DataBase.close(conn);
 | |
| ////        }
 | |
| ////        return result;
 | |
| ////    }
 | |
| //
 | |
| //    /**
 | |
| //     * 是否预约成功(按商户订单号)
 | |
| //     *
 | |
| //     * @param tradeNo tradeNo
 | |
| //     * @return 是否预约成功
 | |
| //     */
 | |
| //    public boolean hasReserved(String tradeNo) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select hisstatus from reservation where tradeno = ?";
 | |
| //        try {
 | |
| //            PreparedStatement ps = conn.prepareStatement(sql);
 | |
| //            ps.setString(1, tradeNo);
 | |
| //            ResultSet rSet = ps.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                if (rSet.getInt("HISStatus") == 0)
 | |
| //                    result = true;
 | |
| //            }
 | |
| //            ps.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| ////    /**
 | |
| ////     * 是否预约过(按预约日期:同一天同一个患者只能预约一次)
 | |
| ////     *
 | |
| ////     * @param reservationDate
 | |
| ////     * @return
 | |
| ////     */
 | |
| ////    public boolean hasReserved(String patientID, String reservationDate) {
 | |
| ////        boolean result = false;
 | |
| ////        Connection conn = DataBase.getConnection();
 | |
| ////        String sql = "select hisstatus from reservation where patientid = ? and reservationdate = ? order by hisstatus desc";
 | |
| ////        try {
 | |
| ////            PreparedStatement pstmt = conn.prepareStatement(sql);
 | |
| ////            pstmt.setString(1, patientID);
 | |
| ////            pstmt.setString(2, reservationDate);
 | |
| ////            ResultSet rSet = pstmt.executeQuery();
 | |
| ////            if (rSet.next()) {
 | |
| ////                if (rSet.getInt("HISStatus") == 0)
 | |
| ////                    result = true;
 | |
| ////                else {
 | |
| ////                    // 从HIS查
 | |
| ////                    WSDao wsDao = new WSDao();
 | |
| ////                    result = wsDao.hasReservationed(patientID, reservationDate);
 | |
| ////                }
 | |
| ////            } else {
 | |
| ////                // 从HIS查
 | |
| ////                WSDao wsDao = new WSDao();
 | |
| ////                result = wsDao.hasReservationed(patientID, reservationDate);
 | |
| ////            }
 | |
| ////            pstmt.close();
 | |
| ////        } catch (SQLException e) {
 | |
| ////            e.printStackTrace();
 | |
| ////        } finally {
 | |
| ////            DataBase.close(conn);
 | |
| ////        }
 | |
| ////
 | |
| ////        return result;
 | |
| ////    }
 | |
| //
 | |
| //    /**
 | |
| //     * 是否挂号成功(按商户订单号)
 | |
| //     *
 | |
| //     * @param tradeNo
 | |
| //     * @return
 | |
| //     */
 | |
| //    public String hasReg(String tradeNo) {
 | |
| //        String result = "-1";
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select hisstatus, hisresult from reservation where tradeno = ?";
 | |
| //        try {
 | |
| //            PreparedStatement pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, tradeNo);
 | |
| //            ResultSet rSet = pstmt.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                if (rSet.getInt("HISStatus") == 0) {
 | |
| //                    result = "0";
 | |
| //                } else {
 | |
| //                    result = rSet.getString("HISResult");
 | |
| //                }
 | |
| //            }
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| ////    /**
 | |
| ////     * 查询某一天,某个科室,某个类型的号,是否挂号
 | |
| ////     *
 | |
| ////     * @param patientID
 | |
| ////     * @param regDate
 | |
| ////     * @param deptCode
 | |
| ////     * @param clinicCode
 | |
| ////     * @return
 | |
| ////     */
 | |
| ////    public boolean hasReg(String patientID, String regDate, String deptCode, String clinicCode) {
 | |
| ////        boolean result = false;
 | |
| ////        Connection conn = DataBase.getConnection();
 | |
| ////
 | |
| ////        String sql = "select hisstatus from reservation where patientid = ? and reservationdate = ? and deptCode=? and ClinicCode=?";
 | |
| ////        try {
 | |
| ////            PreparedStatement pstmt = conn.prepareStatement(sql);
 | |
| ////            pstmt.setString(1, patientID);
 | |
| ////            pstmt.setString(2, regDate);
 | |
| ////            pstmt.setString(3, deptCode);
 | |
| ////            pstmt.setString(4, clinicCode);
 | |
| ////            ResultSet rSet = pstmt.executeQuery();
 | |
| ////            if (rSet.next()) {
 | |
| ////                if (rSet.getInt("HISStatus") == 0)
 | |
| ////                    result = true;
 | |
| ////                else {
 | |
| ////                    // 从HIS查
 | |
| ////                    WSDao wsDao = new WSDao();
 | |
| ////                    List<RegBean> list = wsDao.hasReg(patientID, regDate);
 | |
| ////                    if (list.size() == 0) {
 | |
| ////                        result = false;
 | |
| ////                    } else {
 | |
| ////                        for (RegBean regBean : list) {
 | |
| ////                            if (regBean.getRegistDate().equals(regDate) && regBean.getClinicCode().equals(clinicCode) && regBean.getDeptCode().equals(deptCode)) {
 | |
| ////                                result = true;
 | |
| ////                                break;
 | |
| ////                            }
 | |
| ////                        }
 | |
| ////                    }
 | |
| ////                }
 | |
| ////            } else {
 | |
| ////                // 从HIS查
 | |
| ////                WSDao wsDao = new WSDao();
 | |
| ////                List<RegBean> list = wsDao.hasReg(patientID, regDate);
 | |
| ////                if (list.size() == 0) {
 | |
| ////                    result = false;
 | |
| ////                } else {
 | |
| ////                    for (RegBean regBean : list) {
 | |
| ////                        if (regBean.getRegistDate().equals(regDate) && regBean.getClinicCode().equals(clinicCode) && regBean.getDeptCode().equals(deptCode)) {
 | |
| ////                            result = true;
 | |
| ////                            break;
 | |
| ////                        }
 | |
| ////                    }
 | |
| ////                }
 | |
| ////            }
 | |
| ////            pstmt.close();
 | |
| ////        } catch (SQLException e) {
 | |
| ////            e.printStackTrace();
 | |
| ////        } finally {
 | |
| ////            DataBase.close(conn);
 | |
| ////        }
 | |
| ////        return result;
 | |
| ////    }
 | |
| //
 | |
| //    /**
 | |
| //     * 保存预约信息(初始信息)
 | |
| //     *
 | |
| //     * @param reserve
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean saveReservation(ReservationBean4Local reserve) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "insert into reservation(openid, patientid, reservationdate, deptcode, doctcode, "
 | |
| //                + "cliniccode, tid, regfee, clinicfee, paymoney, paydeviceid, "
 | |
| //                + "hisstatus, paystatus, idcardno, updatedate, regstatus, deptName, doctName) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,now(),?,?,?)";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, reserve.getOpenId());
 | |
| //            pstmt.setString(2, reserve.getPatientId());
 | |
| //            pstmt.setString(3, reserve.getReservationDate());
 | |
| //            pstmt.setString(4, reserve.getDeptCode());
 | |
| //            pstmt.setString(5, reserve.getDoctCode());
 | |
| //            pstmt.setString(6, reserve.getClinicCode());
 | |
| //            pstmt.setString(7, reserve.getTID());
 | |
| //            pstmt.setString(8, reserve.getRegFee());
 | |
| //            pstmt.setString(9, reserve.getClinicFee());
 | |
| //            pstmt.setString(10, reserve.getPayMoney());
 | |
| //            pstmt.setString(11, reserve.getPayDeviceId());
 | |
| //            pstmt.setInt(12, reserve.getHisStatus());
 | |
| //            pstmt.setInt(13, reserve.getPayStatus());
 | |
| //            pstmt.setString(14, reserve.getIdCardNo());
 | |
| //            pstmt.setInt(15, reserve.getRegStatus());
 | |
| //            pstmt.setString(16, reserve.getDeptName());
 | |
| //            pstmt.setString(17, reserve.getDoctName());
 | |
| //
 | |
| //            result = pstmt.executeUpdate() > 0;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 是否存在流水号
 | |
| //     *
 | |
| //     * @param tradeNo
 | |
| //     * @return
 | |
| //     */
 | |
| //    public Boolean hasReservationRecord(String tradeNo) {
 | |
| //        boolean result = false;
 | |
| //        Connection connection = DataBase.getConnection();
 | |
| //        String sql = "select count(*) as f_count from reservation where tradeno = ?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = connection.prepareStatement(sql);
 | |
| //            pstmt.setString(1, tradeNo);
 | |
| //            ResultSet rSet = pstmt.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                if (rSet.getInt("f_count") == 0)
 | |
| //                    result = true;
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(connection);
 | |
| //        }
 | |
| //
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    public boolean saveReservation4Time(ReservationBean4Local reservationBean4Local) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "insert into reservation(openid, patientid, reservationdate, deptcode, doctcode, "
 | |
| //                + "cliniccode, tid, regfee, clinicfee, paymoney, paydeviceid, "
 | |
| //                + "hisstatus, paystatus, idcardno, updatedate, regstatus, callno,begtime,endtime,registcode,deptname,doctname,address,tradeno) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,now(),?,?,?,?,?,?,?,?,?)";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, reservationBean4Local.getOpenId());
 | |
| //            pstmt.setString(2, reservationBean4Local.getPatientId());
 | |
| //            pstmt.setString(3, reservationBean4Local.getReservationDate());
 | |
| //            pstmt.setString(4, reservationBean4Local.getDeptCode());
 | |
| //            pstmt.setString(5, reservationBean4Local.getDoctCode());
 | |
| //            pstmt.setString(6, reservationBean4Local.getClinicCode());
 | |
| //            pstmt.setString(7, reservationBean4Local.getTID());
 | |
| //            String regFee = reservationBean4Local.getRegFee();
 | |
| //            if (regFee != null && !regFee.trim().equals("")) {
 | |
| //                pstmt.setBigDecimal(8, NumberUtils.createBigDecimal(regFee));
 | |
| //            } else {
 | |
| //                pstmt.setBigDecimal(8, null);
 | |
| //            }
 | |
| //            String clinicFee = reservationBean4Local.getClinicFee();
 | |
| //            if (clinicFee != null && !clinicFee.trim().equals("")) {
 | |
| //                pstmt.setBigDecimal(9, NumberUtils.createBigDecimal(clinicFee));
 | |
| //            } else {
 | |
| //                pstmt.setBigDecimal(9, null);
 | |
| //            }
 | |
| //            pstmt.setString(10, reservationBean4Local.getPayMoney());
 | |
| //            pstmt.setString(11, reservationBean4Local.getPayDeviceId());
 | |
| //            pstmt.setInt(12, reservationBean4Local.getHisStatus());
 | |
| //            pstmt.setInt(13, reservationBean4Local.getPayStatus());
 | |
| //            pstmt.setString(14, reservationBean4Local.getIdCardNo());
 | |
| //            pstmt.setInt(15, reservationBean4Local.getRegStatus());
 | |
| //            pstmt.setInt(16, reservationBean4Local.getCallNo());
 | |
| //            pstmt.setString(17, reservationBean4Local.getBegTime());
 | |
| //            pstmt.setString(18, reservationBean4Local.getEndTime());
 | |
| //            pstmt.setString(19, reservationBean4Local.getRegistCode());
 | |
| //            pstmt.setString(20, reservationBean4Local.getDeptName());
 | |
| //            pstmt.setString(21, reservationBean4Local.getDoctName());
 | |
| //            pstmt.setString(22, reservationBean4Local.getAddress());
 | |
| //            pstmt.setString(23, reservationBean4Local.getTradeNo() == null ? "" : reservationBean4Local.getTradeNo());
 | |
| //            result = pstmt.executeUpdate() > 0;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 统一下单成功以后,更新预约信息(保存out_trade_no)
 | |
| //     *
 | |
| //     * @param reservationBean4Local reservationBean4Local
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean updateReservationAfterUnified(ReservationBean4Local reservationBean4Local) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update reservation set tradeno=? where openid=? and patientid=? and idcardno=? and tradeno is null";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, reservationBean4Local.getTradeNo());
 | |
| //            pstmt.setString(2, reservationBean4Local.getOpenId());
 | |
| //            pstmt.setString(3, reservationBean4Local.getPatientId());
 | |
| //            pstmt.setString(4, reservationBean4Local.getIdCardNo());
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //
 | |
| //    }
 | |
| //
 | |
| //
 | |
| ////    /**
 | |
| ////     * 支付成功以后,更新预约信息
 | |
| ////     *
 | |
| ////     * @param tradeNo     tradeNo
 | |
| ////     * @param payDate     payDate
 | |
| ////     * @param payTime     payTime
 | |
| ////     * @param bankTransNo bankTransNo
 | |
| ////     * @return
 | |
| ////     */
 | |
| ////    public ReservationBean4Local updateReservationAfterPay(String tradeNo, String payDate, String payTime,
 | |
| ////                                                           String bankTransNo) {
 | |
| ////        ReservationBean4Local reservationBean4Local = new ReservationBean4Local();
 | |
| ////        Connection conn = DataBase.getConnection();
 | |
| ////        String sql = "update reservation set paydate=?, paytime=?, banktransno=?, paystatus=? where tradeno=? and paydate is null and paytime is null and banktransno is null";
 | |
| ////        PreparedStatement pstmt = null;
 | |
| ////        try {
 | |
| ////            pstmt = conn.prepareStatement(sql);
 | |
| ////            pstmt.setString(1, payDate);
 | |
| ////            pstmt.setString(2, payTime);
 | |
| ////            pstmt.setString(3, bankTransNo);
 | |
| ////            pstmt.setInt(4, 0);
 | |
| ////            pstmt.setString(5, tradeNo);
 | |
| ////            if (pstmt.executeUpdate() > 0) {
 | |
| ////                sql = "select * from reservation where tradeno=?";
 | |
| ////                PreparedStatement pstmtGet = conn.prepareStatement(sql);
 | |
| ////                pstmtGet.setString(1, tradeNo);
 | |
| ////                ResultSet rSet = pstmtGet.executeQuery();
 | |
| ////                if (rSet.next()) {
 | |
| ////                    reservationBean4Local.setOpenId(rSet.getString("OpenID"));
 | |
| ////                    reservationBean4Local.setIdCardNo(rSet.getString("IDCardNo"));
 | |
| ////                    reservationBean4Local.setPatientId(rSet.getString("PatientID"));
 | |
| ////                    reservationBean4Local.setTradeNo(rSet.getString("TradeNo"));
 | |
| ////                    reservationBean4Local.setReservationDate(rSet.getString("ReservationDate"));
 | |
| //////                    log.info("数据库查询预约日期:" + rSet.getString("ReservationDate"));
 | |
| ////                    reservationBean4Local.setDeptCode(rSet.getString("DeptCode"));
 | |
| ////                    reservationBean4Local.setDoctCode(rSet.getString("DoctCode"));
 | |
| ////                    reservationBean4Local.setClinicCode(rSet.getString("ClinicCode"));
 | |
| ////                    reservationBean4Local.setTID(rSet.getString("TID"));
 | |
| ////                    reservationBean4Local.setRegFee(rSet.getString("RegFee"));
 | |
| ////                    reservationBean4Local.setClinicFee(rSet.getString("ClinicFee"));
 | |
| ////                    reservationBean4Local.setPayMoney(rSet.getString("PayMoney"));
 | |
| ////                    reservationBean4Local.setPayDate(rSet.getString("PayDate"));
 | |
| ////                    reservationBean4Local.setPayTime(rSet.getString("PayTime"));
 | |
| ////                    reservationBean4Local.setBankTransNo(rSet.getString("BankTransNo"));
 | |
| ////                    reservationBean4Local.setHisTransNo(rSet.getString("HISStatus"));
 | |
| ////                    reservationBean4Local.setPayStatus(rSet.getInt("PayStatus"));
 | |
| ////                    reservationBean4Local.setPayDeviceId(rSet.getString("PayDeviceID"));
 | |
| ////                }
 | |
| ////                pstmtGet.close();
 | |
| ////            }
 | |
| ////            pstmt.close();
 | |
| ////        } catch (SQLException e) {
 | |
| ////            e.printStackTrace();
 | |
| ////        } finally {
 | |
| ////            DataBase.close(conn);
 | |
| ////        }
 | |
| ////        return reservationBean4Local;
 | |
| ////    }
 | |
| //
 | |
| //    public ReservationBean4Local updateReserve(String tradeNo, String payDate, String payTime, String bankTransNo) {
 | |
| //        ReservationBean4Local reserve = null;
 | |
| //
 | |
| //        String sql = "update reservation set payDate=?, payTime=?, bankTransNo=?, payStatus=? where tradeNo=? and payDate is null and payTime is null and bankTransNo is null";
 | |
| //
 | |
| //        Integer row = DataBase.update(sql, ps -> {
 | |
| //            ps.setString(1, payDate);
 | |
| //            ps.setString(2, payTime);
 | |
| //            ps.setString(3, bankTransNo);
 | |
| //            ps.setInt(4, 0);
 | |
| //            ps.setString(5, tradeNo);
 | |
| //        });
 | |
| //
 | |
| //        if (row > 0) {
 | |
| //            String selectSql = "select * from reservation where tradeNo=?";
 | |
| //            List<ReservationBean4Local> query = DataBase.select(selectSql, ReservationBean4Local.class, ps -> {
 | |
| //                ps.setString(1, tradeNo);
 | |
| //            });
 | |
| //            if (query.size() == 1) {
 | |
| //                reserve = query.get(0);
 | |
| //            }
 | |
| //        }
 | |
| //        return reserve;
 | |
| //    }
 | |
| //
 | |
| ////      ReservationBean4Local reservationBean4Local = new ReservationBean4Local();
 | |
| ////        Connection conn = DataBase.getConnection();
 | |
| ////        String sql = "update reservation set paydate=?, paytime=?, banktransno=?, paystatus=? where tradeno=? and paydate is null and paytime is null and banktransno is null";
 | |
| ////        PreparedStatement pstmt = null;
 | |
| ////        try {
 | |
| ////            pstmt = conn.prepareStatement(sql);
 | |
| ////            pstmt.setString(1, payDate);
 | |
| ////            pstmt.setString(2, payTime);
 | |
| ////            pstmt.setString(3, bankTransNo);
 | |
| ////            pstmt.setInt(4, 0);
 | |
| ////            pstmt.setString(5, tradeNo);
 | |
| ////            if (pstmt.executeUpdate() > 0) {
 | |
| ////                sql = "select * from reservation where tradeno=?";
 | |
| ////                PreparedStatement pstmtGet = conn.prepareStatement(sql);
 | |
| ////                pstmtGet.setString(1, tradeNo);
 | |
| ////                ResultSet rSet = pstmtGet.executeQuery();
 | |
| ////                if (rSet.next()) {
 | |
| ////                    reservationBean4Local.setOpenId(rSet.getString("OpenID"));
 | |
| ////                    reservationBean4Local.setIdCardNo(rSet.getString("IDCardNo"));
 | |
| ////                    reservationBean4Local.setPatientId(rSet.getString("PatientID"));
 | |
| ////                    reservationBean4Local.setTradeNo(rSet.getString("TradeNo"));
 | |
| ////                    reservationBean4Local.setReservationDate(rSet.getString("ReservationDate"));
 | |
| ////                    reservationBean4Local.setDeptCode(rSet.getString("DeptCode"));
 | |
| ////                    reservationBean4Local.setDoctCode(rSet.getString("DoctCode"));
 | |
| ////                    reservationBean4Local.setClinicCode(rSet.getString("ClinicCode"));
 | |
| ////                    reservationBean4Local.setTID(rSet.getString("TID"));
 | |
| ////                    reservationBean4Local.setRegFee(rSet.getString("RegFee"));
 | |
| ////                    reservationBean4Local.setClinicFee(rSet.getString("ClinicFee"));
 | |
| ////                    reservationBean4Local.setPayMoney(rSet.getString("PayMoney"));
 | |
| ////                    reservationBean4Local.setPayDate(rSet.getString("PayDate"));
 | |
| ////                    reservationBean4Local.setPayTime(rSet.getString("PayTime"));
 | |
| ////                    reservationBean4Local.setBankTransNo(rSet.getString("BankTransNo"));
 | |
| ////                    reservationBean4Local.setHisTransNo(rSet.getString("HISStatus"));
 | |
| ////                    reservationBean4Local.setPayStatus(rSet.getInt("PayStatus"));
 | |
| ////                    reservationBean4Local.setPayDeviceId(rSet.getString("PayDeviceID"));
 | |
| ////                    reservationBean4Local.setBegTime(rSet.getString("BegTime"));
 | |
| ////                    reservationBean4Local.setEndTime(rSet.getString("EndTime"));
 | |
| ////                    reservationBean4Local.setRegistCode(rSet.getString("RegistCode"));
 | |
| ////                    reservationBean4Local.setDoctName(rSet.getString("DoctName"));
 | |
| ////                    reservationBean4Local.setDeptName(rSet.getString("DeptName"));
 | |
| ////                    reservationBean4Local.setAddress(rSet.getString("Address"));
 | |
| ////                }
 | |
| ////                pstmtGet.close();
 | |
| ////            }
 | |
| ////            pstmt.close();
 | |
| ////        } catch (SQLException e) {
 | |
| ////            e.printStackTrace();
 | |
| ////        } finally {
 | |
| ////            DataBase.close(conn);
 | |
| ////        }
 | |
| ////        return reservationBean4Local;
 | |
| //
 | |
| //
 | |
| //    // 预约成功后查询预约信息,用于发送短信
 | |
| //    public ReservationBean4Local getReservationInfo4Time(String transNo) {
 | |
| //        ReservationBean4Local reservationBean4Local = new ReservationBean4Local();
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select a.*, b.Tel from reservation a left join patientbase b on a.openid = b.openid and a.patientid = b.patientid where a.banktransno = ?";
 | |
| //        PreparedStatement pstmtGet = null;
 | |
| //        try {
 | |
| //            pstmtGet = conn.prepareStatement(sql);
 | |
| //            pstmtGet.setString(1, transNo);
 | |
| //            ResultSet rSet = pstmtGet.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                reservationBean4Local.setOpenId(rSet.getString("OpenID"));
 | |
| //                reservationBean4Local.setIdCardNo(rSet.getString("IDCardNo"));
 | |
| //                reservationBean4Local.setPatientId(rSet.getString("PatientID"));
 | |
| //                reservationBean4Local.setTradeNo(rSet.getString("TradeNo"));
 | |
| //                reservationBean4Local.setReservationDate(rSet.getString("ReservationDate"));
 | |
| //                reservationBean4Local.setDeptCode(rSet.getString("DeptCode"));
 | |
| //                reservationBean4Local.setDoctCode(rSet.getString("DoctCode"));
 | |
| //                reservationBean4Local.setClinicCode(rSet.getString("ClinicCode"));
 | |
| //                reservationBean4Local.setTID(rSet.getString("TID"));
 | |
| //                reservationBean4Local.setRegFee(rSet.getString("RegFee"));
 | |
| //                reservationBean4Local.setClinicFee(rSet.getString("ClinicFee"));
 | |
| //                reservationBean4Local.setPayMoney(rSet.getString("PayMoney"));
 | |
| //                reservationBean4Local.setPayDate(rSet.getString("PayDate"));
 | |
| //                reservationBean4Local.setPayTime(rSet.getString("PayTime"));
 | |
| //                reservationBean4Local.setBankTransNo(rSet.getString("BankTransNo"));
 | |
| //                reservationBean4Local.setHisTransNo(rSet.getString("HISStatus"));
 | |
| //                reservationBean4Local.setPayStatus(rSet.getInt("PayStatus"));
 | |
| //                reservationBean4Local.setPayDeviceId(rSet.getString("PayDeviceID"));
 | |
| //                reservationBean4Local.setBegTime(rSet.getString("BegTime"));
 | |
| //                reservationBean4Local.setEndTime(rSet.getString("EndTime"));
 | |
| //                reservationBean4Local.setRegistCode(rSet.getString("RegistCode"));
 | |
| //                reservationBean4Local.setDoctName(rSet.getString("DoctName"));
 | |
| //                reservationBean4Local.setDeptName(rSet.getString("DeptName"));
 | |
| //                reservationBean4Local.setAddress(rSet.getString("Address"));
 | |
| //                reservationBean4Local.setTel(rSet.getString("Tel"));
 | |
| //                reservationBean4Local.setCallNo(rSet.getInt("CallNo"));
 | |
| //            }
 | |
| //            pstmtGet.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return reservationBean4Local;
 | |
| //    }
 | |
| //
 | |
| //    /***
 | |
| //     * 预约成功后,更新预约信息
 | |
| //     * @param tradeNo
 | |
| //     * @param transNo
 | |
| //     * @param hisTransNo
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean updateReservationAfterReservation(String tradeNo, String transNo, String hisTransNo) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update reservation set transno=?, histransno=?, hisstatus=? where tradeNo=? and hisstatus = -1";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, transNo);
 | |
| //            pstmt.setString(2, hisTransNo);
 | |
| //            pstmt.setInt(3, 0);
 | |
| //            pstmt.setString(4, tradeNo);
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //
 | |
| //    }
 | |
| //
 | |
| //    public boolean updateRegAfter(String tradeNo, String transNo, String hisTransNo, String mzNum) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update reservation set transno=?, histransno=?, hisstatus=?, mznum=? where tradeNo=? and hisstatus = -1";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, transNo);
 | |
| //            pstmt.setString(2, hisTransNo);
 | |
| //            pstmt.setInt(3, 0);
 | |
| //            pstmt.setString(4, mzNum == null ? "" : mzNum);
 | |
| //            pstmt.setString(5, tradeNo);
 | |
| //            // log.info("挂号成功后,更新挂号信息:update reservation set transno='" +
 | |
| //            // transNo + "', histransno='" + hisTransNo
 | |
| //            // + "', hisstatus=0, mznum=" + mzNum + " where tradeNo='" + tradeNo
 | |
| //            // + "' and hisstatus = -1");
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 预约失败后,记录HIS返回的错误信息
 | |
| //     *
 | |
| //     * @param tradeNo tradeNo
 | |
| //     * @param message 错误信息
 | |
| //     * @return 是否记录成功
 | |
| //     */
 | |
| //    public boolean updateReserveAfterFail(String tradeNo, String message) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update reservation set hisresult=? where tradeNo=?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, message);
 | |
| //            pstmt.setString(2, tradeNo);
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 解除绑定
 | |
| //     *
 | |
| //     * @param openID   openID
 | |
| //     * @param idCardNo 身份证号码
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean deleteBind(String openID, String idCardNo, String cardType) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "";
 | |
| //        if (cardType.equals("8888"))
 | |
| //            sql = "delete from patientbase where openid=? and uuid = ?";
 | |
| //        else
 | |
| //            sql = "delete from patientbase where openid=? and idcardno = ?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, openID);
 | |
| //            pstmt.setString(2, idCardNo);
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            log.error("解绑失败:" + sql);
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //
 | |
| //    /**
 | |
| //     * 退款
 | |
| //     *
 | |
| //     * @param type    1:预约;2:诊间支付
 | |
| //     * @param id      ID
 | |
| //     * @param tradeNo tradeNo
 | |
| //     * @param fee     金额
 | |
| //     * @return 是否退款成功
 | |
| //     */
 | |
| //    public boolean refund(int type, String id, String tradeNo, String recipeId, int totalFee, int fee, String desc) {
 | |
| //        boolean result = false;
 | |
| //
 | |
| //        String clazzPath = Objects.requireNonNull(DBDao.class.getClassLoader().getResource("")).getPath();
 | |
| //        if (clazzPath == null) {
 | |
| //            log.error("证书路径为空");
 | |
| //        }
 | |
| //        String filePath = clazzPath + "apiclient_cert.p12";
 | |
| //        LocalHttpClient.initMchKeyStore(WeChatConfig.getMchId(), filePath);
 | |
| //        SecapiPayRefund refund = new SecapiPayRefund();
 | |
| //        refund.setAppid(WeChatConfig.getAppId());
 | |
| //        refund.setMch_id(WeChatConfig.getMchId());
 | |
| //        refund.setNonce_str(UUID.randomUUID().toString().replace("-", ""));
 | |
| //        refund.setSign_type("MD5");
 | |
| //        refund.setOut_trade_no(tradeNo);
 | |
| //        refund.setOut_refund_no(id);
 | |
| //        refund.setTotal_fee(totalFee);
 | |
| //        refund.setRefund_fee(fee);
 | |
| //        refund.setRefund_fee_type("CNY");
 | |
| //        refund.setRefund_account("REFUND_SOURCE_UNSETTLED_FUNDS");
 | |
| //        if (desc.length() > 80)
 | |
| //            desc = desc.substring(0, 80);
 | |
| //        refund.setRefund_desc(desc);
 | |
| //        SecapiPayRefundResult refundResult = PayMchAPI.secapiPayRefund(refund, WeChatConfig.getMchKey());
 | |
| //        if (refundResult.getReturn_code().equals("SUCCESS"))
 | |
| //            result = true;
 | |
| //        // log.info("退款申请结果:" + result);
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //
 | |
| //        String sql = "";
 | |
| //        if (type == 1) {
 | |
| //            sql = "update reservation set refundresult=? where tradeno = ?";
 | |
| //        } else if (type == 2) {
 | |
| //            sql = "update pay set RefundResult = ? where tradeno = ? and recipeId = '" + recipeId + "'";
 | |
| //        }
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, refundResult.getReturn_msg());
 | |
| //            pstmt.setString(2, tradeNo);
 | |
| //            pstmt.execute();
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            log.info("退款数据更新失败!");
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 获取预约信息
 | |
| //     *
 | |
| //     * @param tradeNo tradeNo
 | |
| //     * @return
 | |
| //     */
 | |
| //    public ReservationBean4Local getReservationInfo(String tradeNo) {
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select a.*, b.Tel from reservation a left join patientbase b on a.openid = b.openid and a.patientid = b.patientid where a.tradeNo = ?";
 | |
| //        // log.info("查询预约信息:" + sql);
 | |
| //        ReservationBean4Local reservationBean4Local = new ReservationBean4Local();
 | |
| //        try {
 | |
| //            PreparedStatement stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setString(1, tradeNo);
 | |
| //            ResultSet rSet = stmt.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                reservationBean4Local.setOpenId(rSet.getString("OpenID"));
 | |
| //                reservationBean4Local.setIdCardNo(rSet.getString("IDCardNo"));
 | |
| //                reservationBean4Local.setPatientId(rSet.getString("PatientID"));
 | |
| //                reservationBean4Local.setTradeNo(rSet.getString("TradeNo"));
 | |
| //                reservationBean4Local.setReservationDate(rSet.getString("ReservationDate"));
 | |
| //                reservationBean4Local.setDeptCode(rSet.getString("DeptCode"));
 | |
| //                reservationBean4Local.setDoctCode(rSet.getString("DoctCode"));
 | |
| //                reservationBean4Local.setClinicCode(rSet.getString("ClinicCode"));
 | |
| //                reservationBean4Local.setTID(rSet.getString("TID"));
 | |
| //                reservationBean4Local.setRegFee(rSet.getString("RegFee"));
 | |
| //                reservationBean4Local.setClinicFee(rSet.getString("ClinicFee"));
 | |
| //                reservationBean4Local.setPayMoney(rSet.getString("PayMoney"));
 | |
| //                reservationBean4Local.setPayDate(rSet.getString("PayDate"));
 | |
| //                reservationBean4Local.setPayTime(rSet.getString("PayTime"));
 | |
| //                reservationBean4Local.setBankTransNo(rSet.getString("BankTransNo"));
 | |
| //                reservationBean4Local.setHisTransNo(rSet.getString("HISStatus"));
 | |
| //                reservationBean4Local.setPayStatus(rSet.getInt("PayStatus"));
 | |
| //                reservationBean4Local.setPayDeviceId(rSet.getString("PayDeviceID"));
 | |
| //                reservationBean4Local.setBegTime(rSet.getString("BegTime"));
 | |
| //                reservationBean4Local.setEndTime(rSet.getString("EndTime"));
 | |
| //                reservationBean4Local.setRegistCode(rSet.getString("RegistCode"));
 | |
| //                reservationBean4Local.setDoctName(rSet.getString("DoctName"));
 | |
| //                reservationBean4Local.setDeptName(rSet.getString("DeptName"));
 | |
| //                reservationBean4Local.setAddress(rSet.getString("Address"));
 | |
| //                reservationBean4Local.setTel(rSet.getString("Tel"));
 | |
| //                reservationBean4Local.setTransNo(rSet.getString("TransNo"));
 | |
| //                reservationBean4Local.setCallNo(rSet.getInt("CallNo"));
 | |
| //            } else {
 | |
| //                log.info("未查询到挂号记录");
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            log.info("查询挂号记录异常:" + e.getMessage());
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return reservationBean4Local;
 | |
| //    }
 | |
| //
 | |
| //    public ReservationBean4Local getReservationInfoByHisTransNo(String hisTransNo) {
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select a.*, b.Tel from reservation a left join patientbase b on a.openid = b.openid and a.patientid = b.patientid where a.histransno = '"
 | |
| //                + hisTransNo + "'";
 | |
| //        // log.info("通过HisTransNo查询预约信息:" + sql);
 | |
| //        ReservationBean4Local reservationBean4Local = new ReservationBean4Local();
 | |
| //        try {
 | |
| //            PreparedStatement stmt = conn.prepareStatement(sql);
 | |
| //            ResultSet rSet = stmt.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                reservationBean4Local.setOpenId(rSet.getString("OpenID"));
 | |
| //                reservationBean4Local.setIdCardNo(rSet.getString("IDCardNo"));
 | |
| //                reservationBean4Local.setPatientId(rSet.getString("PatientID"));
 | |
| //                reservationBean4Local.setTradeNo(rSet.getString("TradeNo"));
 | |
| //                reservationBean4Local.setReservationDate(rSet.getString("ReservationDate"));
 | |
| //                reservationBean4Local.setDeptCode(rSet.getString("DeptCode"));
 | |
| //                reservationBean4Local.setDoctCode(rSet.getString("DoctCode"));
 | |
| //                reservationBean4Local.setClinicCode(rSet.getString("ClinicCode"));
 | |
| //                reservationBean4Local.setTID(rSet.getString("TID"));
 | |
| //                reservationBean4Local.setRegFee(rSet.getString("RegFee"));
 | |
| //                reservationBean4Local.setClinicFee(rSet.getString("ClinicFee"));
 | |
| //                reservationBean4Local.setPayMoney(rSet.getString("PayMoney"));
 | |
| //                reservationBean4Local.setPayDate(rSet.getString("PayDate"));
 | |
| //                reservationBean4Local.setPayTime(rSet.getString("PayTime"));
 | |
| //                reservationBean4Local.setBankTransNo(rSet.getString("BankTransNo"));
 | |
| //                reservationBean4Local.setHisTransNo(rSet.getString("HISStatus"));
 | |
| //                reservationBean4Local.setPayStatus(rSet.getInt("PayStatus"));
 | |
| //                reservationBean4Local.setPayDeviceId(rSet.getString("PayDeviceID"));
 | |
| //                reservationBean4Local.setBegTime(rSet.getString("BegTime"));
 | |
| //                reservationBean4Local.setEndTime(rSet.getString("EndTime"));
 | |
| //                reservationBean4Local.setRegistCode(rSet.getString("RegistCode"));
 | |
| //                reservationBean4Local.setDoctName(rSet.getString("DoctName"));
 | |
| //                reservationBean4Local.setDeptName(rSet.getString("DeptName"));
 | |
| //                reservationBean4Local.setAddress(rSet.getString("Address"));
 | |
| //                reservationBean4Local.setTel(rSet.getString("Tel"));
 | |
| //                reservationBean4Local.setTransNo(rSet.getString("TransNo"));
 | |
| //                reservationBean4Local.setCallNo(rSet.getInt("CallNo"));
 | |
| //                reservationBean4Local.setHisTransNo(rSet.getString("HISTransNo"));
 | |
| //            } else {
 | |
| //                log.info("未查询到挂号记录");
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            log.info("查询挂号记录异常:" + e.getMessage());
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return reservationBean4Local;
 | |
| //    }
 | |
| //
 | |
| //
 | |
| //    /**
 | |
| //     * 更新诊间支付信息(收到HIS支付接口返回后)
 | |
| //     *
 | |
| //     * @param tradeNo        tradeNo
 | |
| //     * @param hisTransNo     hisTransNo
 | |
| //     * @param invoiceTransNo invoiceTransNo
 | |
| //     */
 | |
| //    public void updatePayInfo(String tradeNo, String hisTransNo, String invoiceTransNo) {
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update pay set HISTransNo = ?, InvoiceTransNo = ?, HisStatus = 0 where TradeNo = ?";
 | |
| //        PreparedStatement stmt;
 | |
| //        try {
 | |
| //            stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setString(1, hisTransNo);
 | |
| //            stmt.setString(2, invoiceTransNo);
 | |
| //            stmt.setString(3, tradeNo);
 | |
| //            stmt.execute();
 | |
| //            stmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //    }
 | |
| //
 | |
| //
 | |
| //    /**
 | |
| //     * 获取诊间支付信息
 | |
| //     */
 | |
| //    public PayBean queryPayByTradeNo(String tradeNo) {
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select * from pay where TradeNo=?";
 | |
| //        PreparedStatement stmt;
 | |
| //        PayBean payBean = new PayBean();
 | |
| //        try {
 | |
| //            stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setString(1, tradeNo);
 | |
| //            ResultSet rSet = stmt.executeQuery();
 | |
| //            if (rSet.next()) {
 | |
| //                payBean.setTradeNo(tradeNo);
 | |
| //                payBean.setOpendID(rSet.getString("OpenID"));
 | |
| //                payBean.setPatientID(rSet.getString("PatientID"));
 | |
| //                payBean.setMZNum(rSet.getString("MZNum"));
 | |
| //                payBean.setRecipeID(rSet.getString("RecipeID"));
 | |
| //                payBean.setPayMoney(rSet.getString("PayMoney"));
 | |
| //                payBean.setPayWay(rSet.getInt("PayWay"));
 | |
| //            }
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return payBean;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 是否已经发起支付
 | |
| //     *
 | |
| //     * @param tradeNo tradeNo
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean hasPayed(String tradeNo) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select count(*) as f_count from pay where tradeno = ? and hisstatus = 0";
 | |
| //        try {
 | |
| //            PreparedStatement pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, tradeNo);
 | |
| //            ResultSet rSet = pstmt.executeQuery();
 | |
| //            rSet.next();
 | |
| //            if (rSet.getInt("f_count") > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 单张处方是否已经支付成功
 | |
| //     *
 | |
| //     * @param tradeNo
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean hasPayedSingle(String tradeNo, String recipeId) {
 | |
| //        boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select count(*) as f_count from pay where tradeno = ? and recipeId = ? and hisstatus = 0";
 | |
| //        try {
 | |
| //            PreparedStatement pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, tradeNo);
 | |
| //            pstmt.setString(2, recipeId);
 | |
| //            ResultSet rSet = pstmt.executeQuery();
 | |
| //            rSet.next();
 | |
| //            if (rSet.getInt("f_count") > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 记录his缴费失败的错误信息
 | |
| //     *
 | |
| //     * @param tradeNo tradeNo
 | |
| //     * @param message message
 | |
| //     * @return
 | |
| //     */
 | |
| //    public boolean updatePayAfterFail(String tradeNo, String message) {
 | |
| //        Boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update pay set hisresult=? where tradeNo=?";
 | |
| //        PreparedStatement pstmt = null;
 | |
| //        try {
 | |
| //            pstmt = conn.prepareStatement(sql);
 | |
| //            pstmt.setString(1, message);
 | |
| //            pstmt.setString(2, tradeNo);
 | |
| //            if (pstmt.executeUpdate() > 0)
 | |
| //                result = true;
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //
 | |
| //
 | |
| //
 | |
| //    /**
 | |
| //     * 获取his缴费失败,待退款的记录
 | |
| //     *
 | |
| //     * @return
 | |
| //     */
 | |
| //    public List<RefundBean> getRefundList() {
 | |
| //        List<RefundBean> lstRefund = new ArrayList<>();
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "select * from refund where hasstoped = false and hasrefund = false and hashispayed = false";
 | |
| //        try {
 | |
| //            PreparedStatement pstmt = conn.prepareStatement(sql);
 | |
| //            ResultSet rSet = pstmt.executeQuery();
 | |
| //            while (rSet.next()) {
 | |
| //                RefundBean bean = new RefundBean();
 | |
| //                bean.setID(rSet.getInt("ID"));
 | |
| //                bean.setTradeNo(rSet.getString("TradeNo"));
 | |
| //                bean.setBankTransNo(rSet.getString("BankTransNo"));
 | |
| //                bean.setCreateTime(rSet.getString("CreateTime"));
 | |
| //                bean.setCreater(rSet.getString("Creater"));
 | |
| //                bean.setHasRefunded(rSet.getBoolean("HasRefunded"));
 | |
| //                bean.setHasHisPayed(rSet.getBoolean("HasHisPayed"));
 | |
| //                bean.setHasStoped(rSet.getBoolean("HasStoped"));
 | |
| //                bean.setHisQueryResult(rSet.getString("HasQueryResult"));
 | |
| //                bean.setQueryCount(rSet.getInt("QueryCount"));
 | |
| //                bean.setUpdateTime(rSet.getString("UpdateTime"));
 | |
| //                lstRefund.add(bean);
 | |
| //            }
 | |
| //            pstmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return lstRefund;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 更新待退款记录
 | |
| //     *
 | |
| //     * @param refundBean refundBean
 | |
| //     * @return
 | |
| //     */
 | |
| //    public Boolean updateRefund(RefundBean refundBean) {
 | |
| //        Boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "update refund set HasRefunded=?, HasHisPayed=?, HasStoped=?, HisQueryResult=?, QueryCount=?, UpdateTime=now() where id=?";
 | |
| //        PreparedStatement stmt;
 | |
| //        try {
 | |
| //            stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setBoolean(1, refundBean.getHasRefunded());
 | |
| //            stmt.setBoolean(2, refundBean.getHasHisPayed());
 | |
| //            stmt.setBoolean(3, refundBean.getHasStoped());
 | |
| //            stmt.setString(4, refundBean.getHisQueryResult());
 | |
| //            stmt.setInt(5, refundBean.getQueryCount());
 | |
| //            stmt.setInt(6, refundBean.getID());
 | |
| //            stmt.execute();
 | |
| //            stmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            log.info("updateRefund异常");
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 添加待退费记录
 | |
| //     *
 | |
| //     * @param tradeNo     tradeNo
 | |
| //     * @param bankTransNo bankTransNo
 | |
| //     * @param creater     creater
 | |
| //     * @return
 | |
| //     */
 | |
| //    public Boolean saveRefund(String tradeNo, String bankTransNo, String creater) {
 | |
| //        Boolean result = false;
 | |
| //        Connection conn = DataBase.getConnection();
 | |
| //        String sql = "insert into refund (tradeno, banktransno, createtime, creater, hasstoped, hashispayed, hasrefunded) values (?,?,now(),?,0,0,0)";
 | |
| //        PreparedStatement stmt;
 | |
| //        try {
 | |
| //            stmt = conn.prepareStatement(sql);
 | |
| //            stmt.setString(1, tradeNo);
 | |
| //            stmt.setString(2, bankTransNo);
 | |
| //            stmt.setString(3, creater);
 | |
| //            stmt.execute();
 | |
| //            stmt.close();
 | |
| //        } catch (SQLException e) {
 | |
| //            log.info("saveRefund异常");
 | |
| //            e.printStackTrace();
 | |
| //        } finally {
 | |
| //            DataBase.close(conn);
 | |
| //        }
 | |
| //        return result;
 | |
| //    }
 | |
| //
 | |
| //    /**
 | |
| //     * 获取pacs已审核的报告列表,供消息推送使用
 | |
| //     */
 | |
| //    public void getCheckNotifyList() {
 | |
| //        Connection connection = DataBase.getPacsConnection();
 | |
| //        String sql = "SELECT b.PatientID_His, a.AccessionNumber, a.patientname, a.InPatientNum, a.OutPatientNum, " +
 | |
| //                "a.ClinicName, a.PatientStudyDate, a.ReportDate, a.ReviewDate from PatientSchedule a (nolock) " +
 | |
| //                "LEFT JOIN dbo.PatientBase b (NOLOCK) ON a.PatientID = b.PatientID where " +
 | |
| //                "a.ReportDate>=dateadd(minute,-60,GETDATE()) and a.DelDate is NULL AND PatientID_His IS NOT NULL";
 | |
| //        PreparedStatement stmt;
 | |
| //        {
 | |
| //            try {
 | |
| //                stmt = connection.prepareStatement(sql);
 | |
| //                ResultSet rs = stmt.executeQuery();
 | |
| //                while (rs.next()) {
 | |
| //                    log.info(rs.getString(1) + "," + rs.getString(2) + ","
 | |
| //                            + rs.getString(3) + "," + rs.getString(4) + ","
 | |
| //                            + rs.getString(5) + "," + rs.getString(6) + ","
 | |
| //                            + rs.getString(7) + "," + rs.getString(8));
 | |
| //                }
 | |
| //
 | |
| //            } catch (SQLException e) {
 | |
| //                log.info("查询已完成的检查报告异常");
 | |
| //            } finally {
 | |
| //                DataBase.close(connection);
 | |
| //            }
 | |
| //        }
 | |
| //    }
 | |
| //
 | |
| //}
 | |
| 
 |