|
@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.JSONPObject;
|
|
|
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.entity.IntegerIdentityEntity;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.im.ConsultDo;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
@ -24,6 +26,7 @@ import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
|
|
|
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
|
|
|
import com.yihu.jw.hospital.ykyy.service.YkyyService;
|
|
|
import com.yihu.jw.order.dao.BusinessOrderDao;
|
|
@ -99,6 +102,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
private YlzPayService ylzPayService;
|
|
|
@Autowired
|
|
|
private PrescriptionLogService prescriptionLogService;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
private EntranceService entranceService;
|
|
|
|
|
|
|
|
|
|
|
@ -512,6 +519,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
orderRefundDO.setStatus(2);
|
|
|
orderRefundDO.setRefundTime(new Date());
|
|
|
orderRefundDao.save(orderRefundDO);
|
|
|
updatePayStatusByRefund(orderNo);
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
@ -872,6 +880,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
orderRefundDO.setStatus(2);
|
|
|
orderRefundDO.setRefundTime(new Date());
|
|
|
orderRefundDao.save(orderRefundDO);
|
|
|
updatePayStatusByRefund(orderNo);
|
|
|
}
|
|
|
return object;
|
|
|
|
|
@ -895,6 +904,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 退款修改状态
|
|
|
* @param orderNo
|
|
|
* @return
|
|
|
*/
|
|
|
public BusinessOrderDO updatePayStatusByRefund(String orderNo) throws Exception {
|
|
|
logger.info("入参:"+orderNo);
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
|
|
|
if (businessOrderDO==null){
|
|
|
throw new Exception("查不到订单!");
|
|
|
}
|
|
|
if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
|
|
|
ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
|
|
|
consultDo.setPayStatus(2);
|
|
|
consultOrderDao.save(consultDo);
|
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
|
|
|
wlyyOutpatientDO.setPayStatus(2);
|
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
}
|
|
|
businessOrderDO.setUpdateTime(new Date());
|
|
|
businessOrderDO.setStatus(9);
|
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
return businessOrderDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param orderNo
|
|
@ -930,6 +965,41 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*无需支付
|
|
|
* @param relationCode
|
|
|
* @return
|
|
|
*/
|
|
|
public BusinessOrderDO updatePayStatusByRelation(String relationCode) throws Exception {
|
|
|
logger.info("入参:"+relationCode);
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
|
|
|
if (businessOrderDO==null){
|
|
|
throw new Exception("查不到订单!");
|
|
|
}
|
|
|
if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
|
|
|
ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
|
|
|
consultDo.setPayStatus(1);
|
|
|
consultOrderDao.save(consultDo);
|
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
|
|
|
wlyyOutpatientDO.setPayStatus(1);
|
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
} else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
wlyyPrescriptionDO.setPayStatus(1);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
prescriptionLogService.addPrescriptionLog(businessOrderDO.getRelationCode(),30,1,businessOrderDO.getPatient(),businessOrderDO.getPatientName(),businessOrderDO.getDescription(),new Date());
|
|
|
}
|
|
|
}
|
|
|
businessOrderDO.setUpdateTime(new Date());
|
|
|
businessOrderDO.setStatus(1);
|
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
return businessOrderDO;
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject selectOrderTime(String relationCode){
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("PAY_TIME");
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
|
|
@ -958,7 +1028,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String ylzRechargeJson(String code,String depositType,String wechatId,String cardType,String cardNo) throws Exception {
|
|
|
public String ylzRechargeJson(String code,String depositType,String wechatId,String cardType,String cardNo,boolean demoFlag) throws Exception {
|
|
|
String response = null;
|
|
|
WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
|
|
|
if(wxWechatDO==null){
|
|
@ -974,6 +1044,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
idcard = patientDO.getIdcard();
|
|
|
}
|
|
|
String openId = "";
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor());
|
|
|
String fee = doctorDO.getFee();
|
|
|
if (!StringUtils.isNoneBlank(fee)){
|
|
|
throw new Exception("医生费用为空");
|
|
|
}
|
|
|
net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
|
|
|
Double cardFee = object1.getDouble("ZHYE");
|
|
|
Double doctorFee = Double.parseDouble(fee);
|
|
|
Double balance = doctorFee-cardFee;
|
|
|
businessOrderDO.setPayPrice(balance);
|
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
|
|
|
if (patientWechatDos!=null&&patientWechatDos.size()!=0){
|
|
|
BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
|
|
@ -1005,4 +1086,26 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 咨询退费
|
|
|
* @param consult
|
|
|
* @return
|
|
|
*/
|
|
|
public BusinessOrderDO consultRefund(String consult,String wxId) throws Exception {
|
|
|
String base = hospitalSysDictDao.findByDictName("imData").get(0).getDictCode();
|
|
|
String sql ="select id as \"id\",reply as \"reply\" from "+base+".topics where id='"+consult+"' AND reply=0";
|
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
if (mapList!=null&&mapList.size()!=0){
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(consult);
|
|
|
if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
this.orderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
|
|
|
}else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
this.ylzOrderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
|
|
|
}
|
|
|
return businessOrderDO;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}
|