|
@ -27,6 +27,7 @@ import com.yihu.jw.hospital.prescription.dao.*;
|
|
import com.yihu.jw.hospital.prescription.service.HcyyPrescriptionService;
|
|
import com.yihu.jw.hospital.prescription.service.HcyyPrescriptionService;
|
|
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
|
|
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
|
|
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
|
|
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
|
|
|
|
import com.yihu.jw.hospital.prescription.service.YkyyPrescriptionService;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
|
|
@ -90,6 +91,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
@Autowired
|
|
@Autowired
|
|
private BusinessOrderDao businessOrderDao;
|
|
private BusinessOrderDao businessOrderDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
private YkyyPrescriptionService ykyyPrescriptionService;
|
|
|
|
@Autowired
|
|
private WechatDao wechatDao;
|
|
private WechatDao wechatDao;
|
|
@Autowired
|
|
@Autowired
|
|
private WxPayLogDao wxPayLogDao;
|
|
private WxPayLogDao wxPayLogDao;
|
|
@ -978,14 +981,14 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
|
|
|
|
/*List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
wlyyPrescriptionDO.setStatus(30);
|
|
wlyyPrescriptionDO.setStatus(30);
|
|
wlyyPrescriptionDO.setPayStatus(1);
|
|
wlyyPrescriptionDO.setPayStatus(1);
|
|
wlyyPrescriptionDO.setPayTime(new Date());
|
|
wlyyPrescriptionDO.setPayTime(new Date());
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
/*List<WlyyInspectionDO> inspectionDOList = inspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
|
|
|
*//*List<WlyyInspectionDO> inspectionDOList = inspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
for (WlyyInspectionDO wlyyInspectionDO:inspectionDOList){
|
|
for (WlyyInspectionDO wlyyInspectionDO:inspectionDOList){
|
|
String updateMsYj01 = "update V_MS_YJ01 t set t.HLWJF=1 where t.yjxh='"+wlyyInspectionDO.getHisCode()+"'";
|
|
String updateMsYj01 = "update V_MS_YJ01 t set t.HLWJF=1 where t.yjxh='"+wlyyInspectionDO.getHisCode()+"'";
|
|
try {
|
|
try {
|
|
@ -993,7 +996,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}*/
|
|
|
|
|
|
}*//*
|
|
prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),30,1,wlyyPrescriptionDO.getPatientCode(),wlyyPrescriptionDO.getPatientName(),"",new Date());
|
|
prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),30,1,wlyyPrescriptionDO.getPatientCode(),wlyyPrescriptionDO.getPatientName(),"",new Date());
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
if (infoDOS!=null&&infoDOS.size()!=0){
|
|
if (infoDOS!=null&&infoDOS.size()!=0){
|
|
@ -1055,7 +1058,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}*/
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
|
try {
|
|
|
|
ykyyPrescriptionService.confirmSettlement(wlyyPrescriptionDO.getOutpatientId());
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("5")){
|
|
}else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("5")){
|
|
String price = Integer.parseInt(totalFee)/100+"";
|
|
String price = Integer.parseInt(totalFee)/100+"";
|
|
@ -1690,6 +1703,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
|
|
String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
|
|
enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);
|
|
enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);
|
|
}else if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
}else if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
|
BaseDoctorDO baseDoctorDO= doctorDao.findById(wlyyOutpatientDO.getDoctor());
|
|
|
|
if (baseDoctorDO!=null){
|
|
|
|
ykyySMSService.sendSmsByTempcode("consult_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
|
|
|
|
prescriptionService.wxTempalteJPush("outpatient_remind",wlyyOutpatientDO,null,"","","","");
|
|
|
|
}
|
|
String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
|
|
String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
|
|
enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
|
|
enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
|
|
}else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
|
|
}else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
|
|
@ -2321,6 +2339,163 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 眼科自费结算部分
|
|
|
|
*
|
|
|
|
* @param code
|
|
|
|
* @param depositType
|
|
|
|
* @param wechatId
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public Map<String,Object> ylzRechargePreYk(String code,String depositType,String wechatId,String cardType,String cardNo,boolean demoFlag,String appletCode) throws Exception {
|
|
|
|
try {
|
|
|
|
WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
|
|
|
|
if(wxWechatDO==null){
|
|
|
|
throw new Exception("can't find wechat:the wxId is "+wechatId);
|
|
|
|
}
|
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(code);
|
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(code);
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutpatientId(code);
|
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
|
|
|
|
BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getBcwkje());//总金额
|
|
|
|
BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
|
|
|
|
BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
|
|
|
|
Double fee = b1.subtract(b2).subtract(b3).doubleValue();
|
|
|
|
if (businessOrderDO==null) {
|
|
|
|
businessOrderDO = new BusinessOrderDO();
|
|
|
|
businessOrderDO.setCreateTime(new Date());
|
|
|
|
businessOrderDO.setUpdateTime(new Date());
|
|
|
|
businessOrderDO.setStatus(0);
|
|
|
|
businessOrderDO.setOrderNo("HLWYY" + System.currentTimeMillis() + (int) (Math.random() * 900) + 100);
|
|
|
|
businessOrderDO.setUploadStatus(0);
|
|
|
|
businessOrderDO.setPayType(1);
|
|
|
|
businessOrderDO.setRelationCode(ylzMedicalRelationDO.getId());
|
|
|
|
businessOrderDO.setRelationName("处方结算");
|
|
|
|
businessOrderDO.setOrderCategory("4");
|
|
|
|
businessOrderDO.setOrderType(4);
|
|
|
|
businessOrderDO.setDoctor(wlyyOutpatientDO.getDoctor());
|
|
|
|
businessOrderDO.setPatient(wlyyOutpatientDO.getConsumer());
|
|
|
|
businessOrderDO.setPatientName(wlyyOutpatientDO.getConsumerName());
|
|
|
|
String a = String.valueOf(String.format("%.2f",fee));
|
|
|
|
BigDecimal b = new BigDecimal(a);
|
|
|
|
BigDecimal c = new BigDecimal(String.valueOf(100));
|
|
|
|
BigDecimal bc = b.multiply(c);
|
|
|
|
businessOrderDO.setPayPrice(bc.doubleValue());
|
|
|
|
businessOrderDO.setDescription("处方结算");
|
|
|
|
businessOrderDO = businessOrderDao.save(businessOrderDO);
|
|
|
|
wlyyPrescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
|
|
|
|
wlyyPrescriptionDO.setOrderId(getCode());
|
|
|
|
wlyyPrescriptionDO = prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code, 1);
|
|
|
|
if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL");
|
|
|
|
for (WlyyPrescriptionInfoDO prescriptionInfoDO : wlyyPrescriptionInfoDOS) {
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
//{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}
|
|
|
|
object.put("commodityName", prescriptionInfoDO.getDrugName());
|
|
|
|
object.put("commodityPrice", prescriptionInfoDO.getPackRetprice());
|
|
|
|
object.put("DrugUnit", prescriptionInfoDO.getPackUnitName());
|
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(businessOrderDO.getDoctor());
|
|
|
|
String yktDoctor = "";
|
|
|
|
if (doctorMappingDO != null && StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())) {
|
|
|
|
System.out.println("----------------"+hospitalSysDictDO.getDictValue());
|
|
|
|
if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
|
|
|
|
|
|
|
|
} else {
|
|
|
|
String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
|
|
|
|
if (jsonObject.getInteger("code") == 200) {
|
|
|
|
JSONArray array1 = jsonObject.getJSONArray("data");
|
|
|
|
if (array1 != null && array1.size() != 0) {
|
|
|
|
yktDoctor = array1.getJSONObject(0).getString("DOCTORUSERID");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
throw new Exception("医生映射表不存在!");
|
|
|
|
}
|
|
|
|
object.put("MedicineDoctor", yktDoctor);
|
|
|
|
array.add(object);
|
|
|
|
}
|
|
|
|
BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
|
|
|
|
String userId = null;
|
|
|
|
if (patientDO != null) {
|
|
|
|
userId = patientDO.getUserId();
|
|
|
|
}
|
|
|
|
if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
|
|
|
|
|
|
|
|
} else {
|
|
|
|
String response2 = ykyyService.addOrder4Jkzl("1", wlyyPrescriptionDO.getOrderId(), businessOrderDO.getOrderNo(), userId, array);
|
|
|
|
if (StringUtils.isNoneBlank(response2)) {
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(response2);
|
|
|
|
if (jsonObject.getString("code").equalsIgnoreCase("10000")) {
|
|
|
|
String orderId = jsonObject.getString("orderId");
|
|
|
|
String orderNo = jsonObject.getString("orderNo");
|
|
|
|
businessOrderDO.setYkOrderId(orderId);
|
|
|
|
businessOrderDO.setYkOrderNo(orderNo);
|
|
|
|
businessOrderDO.setUploadStatus(1);
|
|
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
if (businessOrderDO.getStatus()==1){
|
|
|
|
throw new Exception("该处方已支付过");
|
|
|
|
}
|
|
|
|
String a = String.valueOf(String.format("%.2f",fee));
|
|
|
|
BigDecimal b = new BigDecimal(a);
|
|
|
|
BigDecimal c = new BigDecimal(String.valueOf(100));
|
|
|
|
BigDecimal bc = b.multiply(c);
|
|
|
|
businessOrderDO.setPayPrice(bc.doubleValue());
|
|
|
|
businessOrderDO = businessOrderDao.save(businessOrderDO);
|
|
|
|
}
|
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
|
if(wxWechatDO==null){
|
|
|
|
throw new Exception("can't find wechat:the wxId is "+wechatId);
|
|
|
|
}
|
|
|
|
if (businessOrderDO!=null){
|
|
|
|
if (businessOrderDO.getStatus()==1){
|
|
|
|
throw new Exception("该处方已支付过");
|
|
|
|
}
|
|
|
|
String openId = "";
|
|
|
|
if (StringUtils.isNotBlank(appletCode)){
|
|
|
|
logger.info("appletCode不为空"+appletCode);
|
|
|
|
Map<String,Object> objectMap = checkApplets(appletCode,wxWechatDO.getApplets(),wxWechatDO.getAppletsSecret());
|
|
|
|
if (objectMap!=null){
|
|
|
|
openId = objectMap.get("openid").toString();
|
|
|
|
logger.info("appletCode"+appletCode);
|
|
|
|
logger.info("openid"+openId);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
logger.info("appletCode为空"+appletCode);
|
|
|
|
List<BasePatientWechatDo> patientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
|
|
|
|
if (patientWechatDo!=null&&patientWechatDo.size()!=0){
|
|
|
|
openId = patientWechatDo.get(0).getOpenid();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (businessOrderDO.getOrderNo()!=null&&businessOrderDO.getOrderNo().contains("HLWYYQD")){
|
|
|
|
businessOrderDO.setOrderNo("HLWYYQD"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
|
|
|
|
}else {
|
|
|
|
businessOrderDO.setOrderNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
|
|
|
|
}
|
|
|
|
businessOrderDO= businessOrderDao.save(businessOrderDO);
|
|
|
|
String url = wxWechatDO.getBaseUrl();
|
|
|
|
String notifyUrl =url;
|
|
|
|
String totalFee =businessOrderDO.getPayPrice().intValue()+"";
|
|
|
|
map = unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, depositType,openId,businessOrderDO.getOrderNo(),notifyUrl,businessOrderDO.getPatient());
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 咨询退费
|
|
* 咨询退费
|
|
* @param consult
|
|
* @param consult
|