微信后端代码
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.

71 lines
2.3 KiB

package com.ynxbd.common.dao.peis;
import com.ynxbd.common.bean.pay.PayCasebook;
import com.ynxbd.common.bean.pay.Recipe;
import com.ynxbd.common.bean.record.Record;
import com.ynxbd.common.config.db.DataBase;
import java.util.List;
/**
* @author 李进才
* @ClassName PeisDao
* @Description TODO
* @date 2023/11/16 15:43:00
*/
public class PeisDao {
/**
* 处方支付,数据预存(单个)
*
* @param recipe 支付信息
* @return 是否存储成功
*/
public boolean insert(Recipe recipe) {
String sql = "insert into peis_reserve(updateTime, peisStatus, payStatus, openId, patientId, payMoney, totalFee, outTradeNo, recipeId, treatNum) values (now(),?,?,?,?,?,?,?,?,?)";
return DataBase.insert(sql, ps -> {
ps.setInt(1, recipe.getPeisStatus());
ps.setInt(2, recipe.getPayStatus());
ps.setString(3, recipe.getOpenid());
ps.setString(4, recipe.getPatientId());
ps.setBigDecimal(5, recipe.getTotalFee());
ps.setBigDecimal(6,recipe.getPayMoney());
//
ps.setString(7, recipe.getOutTradeNo());
ps.setString(8, recipe.getRecipeId());
ps.setString(9, recipe.getTreatNum());
}) > 0;
}
/**
* 判断该处方是否重复计费
* @param recipeId 处方号
* @return
*/
public boolean isRepeat(String recipeId){
String sql = "select * from peis_reserve where recipeId = ? and peisStatus = 0";
return !DataBase.select(sql,Recipe.class,ps->{
ps.setString(1,recipeId);
}).isEmpty();
}
public Recipe selectByOutTradeNo(String outTradeNo) {
String sql = "select * from peis_reserve where outTradeNo=? order by updateTime desc";
List<Recipe> list = DataBase.select(sql, Recipe.class, ps -> {
ps.setString(1, outTradeNo);
});
if (list.size() > 0) {
return list.get(0);
}
return null;
}
public boolean updatePayStateOk(String outTradeNo, String bankTransNo) {
String sql = "update peis_reserve set payStatus=0, bankTransNo=? where outTradeNo=? and bankTransNo is null";
return DataBase.update(sql, ps -> {
ps.setString(1, bankTransNo);
ps.setString(2, outTradeNo);
}) > 0;
}
}