|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONException;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.wlyy.service.common.SystemConfig;
|
|
|
import com.yihu.wlyy.service.common.http.HttpClientUtil;
|
|
|
import com.yihu.wlyy.service.common.model.Result;
|
|
|
import com.yihu.wlyy.service.common.util.AmoutUtils;
|
|
|
import com.yihu.wlyy.service.common.util.CommonUtil;
|
|
@ -18,6 +19,7 @@ import com.yihu.wlyy.service.entity.consult.ConsultTeam;
|
|
|
import com.yihu.wlyy.service.entity.prescription.*;
|
|
|
import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO;
|
|
|
import com.yihu.wlyy.service.service.ZysoftBaseService;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@ -74,6 +76,8 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
private String im;
|
|
|
@Value("${redisChannel.prescription}")
|
|
|
private String channelTopic;
|
|
|
@Value("${wlyy.api}")
|
|
|
private String wlyyApi;
|
|
|
@Autowired
|
|
|
private ConsultTeamDao consultTeamDao;
|
|
|
@Autowired
|
|
@ -82,6 +86,8 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
private ZyIvPhysicDictDao zyIvPhysicDictDao;
|
|
|
@Autowired
|
|
|
private FollowupDao followupDao;
|
|
|
@Autowired
|
|
|
private PrescriptionExpressageDao expressageDao;
|
|
|
|
|
|
/**
|
|
|
* 新增续方日志
|
|
@ -1238,6 +1244,7 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional
|
|
|
public Result offlinepay(String data) throws Exception{
|
|
|
String error = null;
|
|
|
String status = "1";
|
|
@ -1248,6 +1255,8 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
if(code==1){
|
|
|
String orderNo = json.getString("orderNo");//挂号编号
|
|
|
String recipeNo = json.getString("recipeNo");//处方编号
|
|
|
String idCard = json.containsKey("idNo")?json.getString("idNo"):null;
|
|
|
String outChargeTime = json.containsKey("outChargeTime")?json.getString("outChargeTime"):null;
|
|
|
|
|
|
Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
|
|
|
if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue())){
|
|
@ -1256,6 +1265,7 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
} else{
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
|
|
|
}*/
|
|
|
String prescriptionCode = prescription.getCode();
|
|
|
|
|
|
prescription.setDispensaryType(1);
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue());
|
|
@ -1269,9 +1279,9 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
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.setPrescriptionCode(prescriptionCode);//开处方的医生code 关联 wlyy_prescription
|
|
|
pay.setType(2);//1 医保支付 2基卫线下支付
|
|
|
pay.setOutChargeTime(json.containsKey("outChargeTime")?format.parse(json.getString("outChargeTime")):null);//支付日期
|
|
|
pay.setOutChargeTime(outChargeTime == null?null:format.parse(outChargeTime));//支付日期
|
|
|
pay.setChannel("offline");//支付方式
|
|
|
pay.setChargeNo(json.containsKey("chargeNo")?json.getString("chargeNo"):null);//支付平台流水号
|
|
|
pay.setChargeTime(json.containsKey("chargeTime")?format.parse(json.getString("chargeTime")):null);//支付平台交易成功时间
|
|
@ -1283,7 +1293,7 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
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.setIdNo(idCard);//证件号码
|
|
|
pay.setTradeStatus("1");//交易状态
|
|
|
pay.setMiSettleNo(json.containsKey("miSettleNo")?json.getString("miSettleNo"):null);//医保收费单据号
|
|
|
pay.setMiRegisterNo(json.containsKey("miRegisterNo")?json.getString("miRegisterNo"):null); //医保挂号
|
|
@ -1321,7 +1331,7 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
|
|
|
//新增log表
|
|
|
PrescriptionLog log = new PrescriptionLog();
|
|
|
log.setPrescriptionCode(prescription.getCode());
|
|
|
log.setPrescriptionCode(prescriptionCode);
|
|
|
log.setCode(getCode());
|
|
|
log.setCreateTime(new Date());
|
|
|
log.setType(PrescriptionLog.PrescriptionLogType.zy.getValue());
|
|
@ -1335,6 +1345,58 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
log.setRemark("待配药");
|
|
|
prescriptionLogDao.save(log);
|
|
|
|
|
|
//新增wlyy_prescription_expressage表
|
|
|
PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode);
|
|
|
if (expressage == null) {
|
|
|
expressage = new PrescriptionExpressage();
|
|
|
expressage.setCode(getCode());
|
|
|
}
|
|
|
expressage.setPrescriptionCode(prescriptionCode);
|
|
|
|
|
|
if (StringUtils.isEmpty(idCard)){
|
|
|
errMsg = "患者身份证为空!";
|
|
|
}
|
|
|
Patient pateint = patientDao.findByIdcard(idCard);
|
|
|
if(pateint != null){
|
|
|
expressage.setMobile(pateint.getMobile());//收货人手机号码
|
|
|
expressage.setName(pateint.getName());//居民姓名
|
|
|
expressage.setProvinceCode(pateint.getProvince());//省代码
|
|
|
expressage.setProvinceName(pateint.getProvinceName());//省名称
|
|
|
expressage.setCityCode(pateint.getCity());//市代码
|
|
|
expressage.setCityName(pateint.getCityName());//市名称
|
|
|
expressage.setTownCode(pateint.getTown());//区code
|
|
|
expressage.setTownName(pateint.getTownName());//区名称
|
|
|
expressage.setStreetCode(pateint.getStreet());//街道code
|
|
|
expressage.setStreetName(pateint.getStreetName());//街道名称
|
|
|
expressage.setAddress(pateint.getAddress());//居民详细地址
|
|
|
|
|
|
// 配药机构信息(签约机构)
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(pateint.getCode());
|
|
|
if (signFamily != null && signFamily.getHospital()!=null){
|
|
|
String hospitalCode = signFamily.getHospital();
|
|
|
Hospital hospital = hospitalDao.findByCode(hospitalCode);
|
|
|
expressage.setHospitalCode(hospitalCode);
|
|
|
expressage.setHospitalName(hospital.getName());
|
|
|
expressage.setHospitalAddress(hospital.getAddress());
|
|
|
}
|
|
|
|
|
|
expressage.setCreateTime(new Date());//创建时间
|
|
|
expressage.setOneselfPickupFlg(1);//是否自取 1是 0否
|
|
|
expressage.setDel(1);//有效
|
|
|
if (StringUtils.isNotBlank(outChargeTime)) {
|
|
|
Date dt = DateUtil.stringToDate(outChargeTime, "yyyy-MM-dd");
|
|
|
expressage.setDeliveryTime(dt);//送达时间
|
|
|
}
|
|
|
//保存物流信息
|
|
|
expressageDao.save(expressage);
|
|
|
}
|
|
|
|
|
|
//调用生成取药二维码接口
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("prescriptionCode",prescriptionCode);
|
|
|
HttpClientUtil.request("POST",wlyyApi+"/third/pay/dispensaryCode/saveQRCode",params,null,null,null,null);
|
|
|
|
|
|
|
|
|
/* if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
|
|
|
log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
|
|
|
log.setRemark("快递配送:配药成功,配送中");
|