|
@ -14,6 +14,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
|
|
@ -21,6 +22,8 @@ import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.prescription.*;
|
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
|
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
|
|
|
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
@ -28,7 +31,10 @@ import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.*;
|
|
|
import com.yihu.jw.oauth.OauthRsaKeyDao;
|
|
|
import com.yihu.jw.order.dao.BusinessOrderDao;
|
|
|
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyInspectionVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
|
|
@ -126,6 +132,12 @@ public class HcyyEntranceService {
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@Autowired
|
|
|
private BusinessOrderDao businessOrderDao;
|
|
|
@Autowired
|
|
|
private BusinessOrderRefundDao orderRefundDao;
|
|
|
@Autowired
|
|
|
private BasePatientMedicareCardDao basePatientMedicareCardDao;
|
|
|
|
|
|
private static String key="ydxtMEQmPymRtfz15lW76Tne88pHcuAU8WygMu/TrTKPRY5G7jttcg==";
|
|
|
|
|
@ -186,6 +198,14 @@ public class HcyyEntranceService {
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
public String getSelectRefundUrl(){
|
|
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("hcyyRefundWebSelectService");
|
|
|
|
|
|
String url = list.get(0).getDictCode();
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
//逸耀合理审方地址
|
|
|
public String getYYCheckUrl(){
|
|
|
|
|
@ -2064,6 +2084,198 @@ public class HcyyEntranceService {
|
|
|
logger.info("BrowseSingleEMR json:"+xml);
|
|
|
return xml;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 3.1.1获取病人档案信息接口
|
|
|
*
|
|
|
* @param cardNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetPatientCaseInfo(String cardNo)throws Exception{
|
|
|
String api = "GetPatientCaseInfo";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(cardNo)){
|
|
|
condition += "<cardNo>"+cardNo+"</cardNo>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("GetPatientCaseInfo params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectRefundUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("GetPatientCaseInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 3.1.2互联网线上退预交金通知接口
|
|
|
*
|
|
|
* @param cardNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String onlineRefundMoney(String orderNo,String cardNo,String name,String refundMoney)throws Exception{
|
|
|
String api = "onlineRefundMoney";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
condition ="<channel_code>1</channel_code>\n" +
|
|
|
"\t<order_id>"+orderNo+"</order_id>\n" +
|
|
|
"\t<ic_card_no>"+cardNo+"</ic_card_no>\n" +
|
|
|
"\t<sick_name>"+name+"</sick_name>\n" +
|
|
|
"\t<refund_money>"+refundMoney+"</refund_money> \n" +
|
|
|
" <refund_type>1</refund_type>\n";
|
|
|
|
|
|
//<ic_card_no>IC卡号(必传)</ic_card_no>
|
|
|
// <sick_name>病人姓名(必传)</sick_name>
|
|
|
// <sick_id>病人id(非必传)</sick_id>
|
|
|
// <refund_money>退款金额(必传)</refund_money>
|
|
|
// <not_commit>不提交标志(非必传 不传默认N)</not_commit>
|
|
|
// <refund_type>退款方式(必传)</refund_type>
|
|
|
// <bank_card_no>银行卡号(非必传)</bank_card_no>
|
|
|
// <bank_name>所属银行(非必传)</bank_name>
|
|
|
// <bank_card_owner>银行卡所属人(非必传)</bank_card_owner>
|
|
|
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("onlineRefundMoney params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectRefundUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("onlineRefundMoney json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 3.1.3互联网线上退预交金状态查询接口
|
|
|
*
|
|
|
* @param cardNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String onlineRefundQuery(String orderNo,String cardNo)throws Exception{
|
|
|
String api = "onlineRefundQuery";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
condition +="<channel_code>1</channel_code>";
|
|
|
if (StringUtils.isNoneBlank(orderNo)){
|
|
|
condition +="<order_id>"+orderNo+"</order_id>";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(cardNo)){
|
|
|
condition +="<ic_card_no>"+orderNo+"</ic_card_no>";
|
|
|
}
|
|
|
//<channel_code>退款渠道代码(必传)[1:互联网医院]</channel_code>
|
|
|
// <order_id>线上退款单号(非必传)</order_id>
|
|
|
// <ic_card_no>IC卡号(非必传)</ic_card_no>
|
|
|
// <start_time>查询开始时间(非必传)</start_time>
|
|
|
// <end_time>查询截止时间(非必传)</end_time>
|
|
|
// <refund_type>退款方式(非必传)</refund_type>
|
|
|
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("onlineRefundQuery params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectRefundUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("onlineRefundQuery json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 门诊预缴金退费接口
|
|
|
*
|
|
|
* @param outPatientId 门诊表id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
|
|
|
public void hisRefund(String outPatientId) throws Exception {
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId);
|
|
|
if (outpatientDO == null){
|
|
|
throw new Exception("门诊信息表为空");
|
|
|
}
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
|
|
|
if (businessOrderDO == null){
|
|
|
throw new Exception("订单表为空");
|
|
|
}
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByCode(outpatientDO.getCardNo());
|
|
|
if (patientMedicareCardDO == null){
|
|
|
throw new Exception("患者卡包为空");
|
|
|
}
|
|
|
|
|
|
String userName = outpatientDO.getPatientName();
|
|
|
String idNo = outpatientDO.getIdcard();
|
|
|
String cardNo =outpatientDO.getCardNo();
|
|
|
String patientInfo = GetPatientCaseInfo(cardNo);
|
|
|
JSONObject patientObject= JSONObject.parseObject(patientInfo);
|
|
|
String outTreatBalance = "";//预交金余额
|
|
|
String canReturnMoney = "";//可退余额
|
|
|
if (patientObject!=null) {
|
|
|
if (patientObject.getString("retcode").equalsIgnoreCase("0")) {
|
|
|
JSONObject data = patientObject.getJSONObject("data");
|
|
|
JSONObject sick_info = data.getJSONObject("sick_info");
|
|
|
outTreatBalance = sick_info.getString("outTreatBalance");//预交金余额
|
|
|
canReturnMoney = sick_info.getString("canReturnMoney");
|
|
|
}
|
|
|
}
|
|
|
String amount = businessOrderDO.getPayPrice().toString();
|
|
|
if (StringUtils.isNoneBlank(canReturnMoney)){
|
|
|
if (Double.parseDouble(amount)<=Double.parseDouble(canReturnMoney)){
|
|
|
String outRefundNo = "HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100;
|
|
|
String origTraceNo = businessOrderDO.getTraceNo();
|
|
|
logger.info("调用his退费通知接口开始");
|
|
|
String res = onlineRefundMoney(outRefundNo,cardNo,userName,amount);
|
|
|
JSONObject.parseObject(res);
|
|
|
BusinessOrderRefundDO businessOrderRefundDO = new BusinessOrderRefundDO();
|
|
|
businessOrderRefundDO.setOrderNo(businessOrderDO.getOrderNo());
|
|
|
businessOrderRefundDO.setOutRefundNo(outRefundNo);
|
|
|
businessOrderRefundDO.setStatus(1);
|
|
|
businessOrderRefundDO.setCreateTime(new Date());
|
|
|
businessOrderRefundDO.setUpdateTime(new Date());
|
|
|
businessOrderRefundDO.setPatient(businessOrderDO.getPatient());
|
|
|
businessOrderRefundDO.setPatientName(businessOrderDO.getPatientName());
|
|
|
businessOrderRefundDO = orderRefundDao.save(businessOrderRefundDO);
|
|
|
String query = onlineRefundQuery(outRefundNo,cardNo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//=====================微信模板消息推送===================================
|
|
|
|
|
|
public String sendMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String redirectUrl){
|
|
@ -2718,6 +2930,7 @@ public class HcyyEntranceService {
|
|
|
" </opt_diagnosis> ";
|
|
|
prescriptionDiagnoses += prescriptionDiagnose;
|
|
|
}
|
|
|
|
|
|
String savePrescription = "<opt_prescriptions> \n" +
|
|
|
" <opt_prescription> \n" +
|
|
|
" <opt_prescription_info> \n" +
|
|
@ -2860,9 +3073,9 @@ public class HcyyEntranceService {
|
|
|
if (diagnosisDOS == null || diagnosisDOS.size() == 0){
|
|
|
return "诊断信息为空";
|
|
|
}
|
|
|
String xml = "";
|
|
|
xml = initParams(hisId,"GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId);
|
|
|
String response = checkPrescription("GY_SF_V4", xml, "合理用药审查");
|
|
|
String xml = "";
|
|
|
xml = initParams(hisId,"GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId);
|
|
|
String response = checkPrescription("GY_SF_V4", xml, "合理用药审查");
|
|
|
|
|
|
return response;
|
|
|
}
|