|
@ -28,6 +28,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -1243,23 +1244,79 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
String errMsg = null;
|
|
|
try{
|
|
|
JSONObject json = JSONObject.parseObject(data);
|
|
|
Integer code = json.getInteger("CODE");
|
|
|
Integer code = json.getInteger("code");
|
|
|
if(code==1){
|
|
|
String orderNo = json.getString("ORDER_NO");//挂号编号
|
|
|
String recipeNo = json.getString("RECIPE_NO");//处方编号
|
|
|
String orderNo = json.getString("orderNo");//挂号编号
|
|
|
String recipeNo = json.getString("recipeNo");//处方编号
|
|
|
|
|
|
Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
|
|
|
if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
|
|
|
|
|
|
if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
|
|
|
} else{
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
|
|
|
}
|
|
|
|
|
|
prescription.setJwPayStatus(1);//0为未结算,1为结算成功,默认为0
|
|
|
prescription.setDrugDeliveryTime(new Date());
|
|
|
prescriptionDao.save(prescription);
|
|
|
|
|
|
|
|
|
//新增基卫线下支付记录
|
|
|
PrescriptionPay pay = new PrescriptionPay();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String uuid = sdf.format(new Date()) + UUID.randomUUID().toString().replaceAll("-", "").substring(0, 4);
|
|
|
pay.setCode(uuid); //接入应用业务流水号outChargeNo
|
|
|
pay.setPrescriptionCode(prescription.getCode());//开处方的医生code 关联 wlyy_prescription
|
|
|
pay.setType(2);//1 医保支付 2基卫线下支付
|
|
|
pay.setOutChargeTime(json.containsKey("outChargeTime")?format.parse(json.getString("outChargeTime")):null);//支付日期
|
|
|
pay.setChannel("offline");//支付方式
|
|
|
pay.setChargeNo(json.containsKey("chargeNo")?json.getString("chargeNo"):null);//支付平台流水号
|
|
|
pay.setChargeTime(json.containsKey("chargeTime")?format.parse(json.getString("chargeTime")):null);//支付平台交易成功时间
|
|
|
pay.setBillNo(json.containsKey("billNo")?json.getString("billNo"):null);//待结算费用单据号
|
|
|
pay.setCardNo(json.containsKey("cardNo")?json.getString("cardNo"):null);//医保卡号
|
|
|
pay.setTotalAmount(json.containsKey("totalAmount")?json.getInteger("totalAmount"):null);//交易总金额
|
|
|
pay.setInsuranceAmount(json.containsKey("insuranceAmount")?json.getInteger("insuranceAmount"):null);//医保支付金额
|
|
|
pay.setSelfPayAmount(json.containsKey("selfPayAmount")?json.getInteger("selfPayAmount"):null);//自付金额
|
|
|
pay.setOpenid(null);//用户openID
|
|
|
pay.setUserName(json.containsKey("userName")?json.getString("userName"):null);//用户名字
|
|
|
pay.setIdType("01"); //证件类型
|
|
|
pay.setIdNo(json.containsKey("idNo")?json.getString("idNo"):null);//证件号码
|
|
|
pay.setTradeStatus("1");//交易状态
|
|
|
pay.setMiSettleNo(json.containsKey("miSettleNo")?json.getString("miSettleNo"):null);//医保收费单据号
|
|
|
pay.setMiRegisterNo(json.containsKey("miRegisterNo")?json.getString("miRegisterNo"):null); //医保挂号
|
|
|
pay.setMiCollectDate(json.containsKey("miCollectDate")?format.parse(json.getString("miCollectDate")):null);//收费日期
|
|
|
pay.setMiCollectTime(json.containsKey("miCollectTime")?format.parse(json.getString("miCollectTime")):null);//收费时间
|
|
|
pay.setMiCollectorName(json.containsKey("miCollectorName")?json.getString("miCollectorName"):null);//收费人姓名
|
|
|
pay.setMiTotalFee(json.containsKey("miTotalFee")?json.getInteger("miTotalFee"):null);//本次报销总额
|
|
|
pay.setSelfPay(json.containsKey("selfPay")?json.getInteger("selfPay"):null);//个人现金支付
|
|
|
pay.setAccountPay(json.containsKey("accountPay")?json.getInteger("accountPay"):null);//个人账户支付
|
|
|
pay.setHeathPay(json.containsKey("heathPay")?json.getInteger("heathPay"):null);//健康账户支付
|
|
|
pay.setCadresPay(json.containsKey("cadresPay")?json.getInteger("cadresPay"):null);//公务员补助
|
|
|
pay.setFundPay(json.containsKey("fundPay")?json.getInteger("fundPay"):null);//基金支付
|
|
|
pay.setHealthCarePay(json.containsKey("healthCarePay")?json.getInteger("healthCarePay"):null);//保健基金支付
|
|
|
pay.setCommercePay(json.containsKey("commercePay")?json.getInteger("commercePay"):null);//商业保险支付
|
|
|
pay.setFamilyPay(json.containsKey("familyPay")?json.getInteger("familyPay"):null);//共济账户支付
|
|
|
pay.setCivilPay(json.containsKey("civilPay")?json.getInteger("civilPay"):null);//民政补助金额
|
|
|
pay.setCivilZone(json.containsKey("civilZone")?json.getString("civilZone"):null);//民政行政区号
|
|
|
pay.setBdrugPay(json.containsKey("bdrugPay")?json.getInteger("bdrugPay"):null);//乙类支付金额
|
|
|
pay.setUnlessAmount(json.containsKey("unlessAmount")?json.getInteger("unlessAmount"):null);//非医保费用
|
|
|
pay.setExceedAmount(json.containsKey("exceedAmount")?json.getInteger("exceedAmount"):null);//超封顶线金额
|
|
|
pay.setAccountBalance(json.containsKey("accountBalance")?json.getInteger("accountBalance"):null);//个人账户余额
|
|
|
pay.setHealthBalance(json.containsKey("healthBalance")?json.getInteger("healthBalance"):null);//健康账户余额
|
|
|
pay.setRecipeContent(json.containsKey("recipeContent")?json.getString("recipeContent"):null);//处方主信息
|
|
|
pay.setZdlist(json.containsKey("zdlist")?json.getString("zdlist"):null);//诊断明细
|
|
|
pay.setMxlist(json.containsKey("mxlist")?json.getString("mxlist"):null);//处方明细
|
|
|
pay.setCreateTime(new Date());//续方确认支付时间
|
|
|
pay.setCzrq(new Date());//续方记录最后操作时间
|
|
|
// 易联众新增查询返回字段v1.3.7
|
|
|
pay.setMedOrgNo(json.containsKey("medOrgNo")?json.getString("medOrgNo"):null);//医疗机构编号
|
|
|
pay.setMedOrgName(json.containsKey("medOrgName")?json.getString("medOrgName"):null);//医疗机构名称
|
|
|
pay.setTraceTime(json.containsKey("traceTime")?format.parse(json.getString("traceTime")):null);//交易成功时间
|
|
|
pay.setTraceNo(json.containsKey("traceNo")?json.getString("traceNo"):null);//支付平台跟踪号
|
|
|
pay.setPrincipalCardNo(json.containsKey("cardNo")?json.getString("cardNo"):null);//实际签约卡号
|
|
|
prescriptionPayDao.save(pay);
|
|
|
|
|
|
//新增log表
|
|
|
PrescriptionLog log = new PrescriptionLog();
|
|
|
log.setPrescriptionCode(prescription.getCode());
|
|
@ -1278,42 +1335,44 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
prescriptionLogDao.save(log);
|
|
|
} else{
|
|
|
log.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
|
|
|
log.setRemark("配药成功");
|
|
|
log.setRemark("等待领药");
|
|
|
prescriptionLogDao.save(log);
|
|
|
|
|
|
//健管师配送
|
|
|
PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
|
|
|
if(StringUtils.isNotBlank(expressage.getExpressageCode())){
|
|
|
Message message = new Message();
|
|
|
message.setCzrq(new Date());
|
|
|
message.setCreateTime(new Date());
|
|
|
message.setRead(1);//设置未读
|
|
|
message.setOver("1");
|
|
|
message.setReceiver(expressage.getExpressageCode());
|
|
|
message.setSender("system");
|
|
|
message.setCode(getCode());
|
|
|
message.setSenderName("系统");
|
|
|
message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
|
|
|
message.setContent("您有一条新的续方订单待取药!");
|
|
|
message.setType(7);//续方订单待取药
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
message.setDel("1");
|
|
|
message.setRelationCode(prescription.getCode());
|
|
|
message.setPrescriptionStatus("0");//待取药
|
|
|
message.setData(prescription.getAdminTeamId()+"");
|
|
|
messageDao.save(message);
|
|
|
}
|
|
|
|
|
|
//判断提示健管师有续方代配送,居民待取药
|
|
|
JSONObject message = new JSONObject();
|
|
|
message.put("title","dispensingComplete");
|
|
|
message.put("state",1);
|
|
|
message.put("prescription",prescription.getCode());
|
|
|
message.put("mes","success");
|
|
|
|
|
|
|
|
|
if(3 == prescription.getDispensaryType()){//健管师配送
|
|
|
PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
|
|
|
if(StringUtils.isNotBlank(expressage.getExpressageCode())){
|
|
|
Message message = new Message();
|
|
|
message.setCzrq(new Date());
|
|
|
message.setCreateTime(new Date());
|
|
|
message.setRead(1);//设置未读
|
|
|
message.setOver("1");
|
|
|
message.setReceiver(expressage.getExpressageCode());
|
|
|
message.setSender("system");
|
|
|
message.setCode(getCode());
|
|
|
message.setSenderName("系统");
|
|
|
message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
|
|
|
message.setContent("您有一条新的续方订单待取药!");
|
|
|
message.setType(7);//续方订单待取药
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
message.setDel("1");
|
|
|
message.setRelationCode(prescription.getCode());
|
|
|
message.setPrescriptionStatus("0");//待取药
|
|
|
message.setData(prescription.getAdminTeamId()+"");
|
|
|
messageDao.save(message);
|
|
|
}
|
|
|
|
|
|
//判断提示健管师有续方代配送,居民待取药
|
|
|
JSONObject message = new JSONObject();
|
|
|
message.put("title","dispensingComplete");
|
|
|
message.put("state",1);
|
|
|
message.put("prescription",prescription.getCode());
|
|
|
message.put("mes","success");
|
|
|
// redisTemplate.convertAndSend(channelTopic,message.toString());
|
|
|
// redisTemplate.watch(channelTopic);
|
|
|
redisTemplate.opsForList().leftPush(channelTopic,message.toString());
|
|
|
redisTemplate.opsForList().leftPush(channelTopic,message.toString());
|
|
|
// redisTemplate.unwatch();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else {
|