|
@ -10,6 +10,8 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalBillDO;
|
|
|
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
|
|
|
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
|
|
|
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
|
|
|
import com.yihu.jw.entity.hospital.httplog.YlzHttpLogDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
@ -22,6 +24,8 @@ import com.yihu.jw.healthCare.utils.AES;
|
|
|
import com.yihu.jw.healthCare.utils.SafeUtil;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.hospital.healthCare.YlzMedicailBillDao;
|
|
|
import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
|
|
|
import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
|
|
|
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
|
|
|
import com.yihu.jw.hospital.httplog.dao.YlzHttpLogDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
@ -83,6 +87,10 @@ public class HealthCareService {
|
|
|
private YlzMedicailRelationDao ylzMedicailRelationDao;
|
|
|
@Autowired
|
|
|
private YlzMedicailBillDao ylzMedicailBillDao;
|
|
|
@Autowired
|
|
|
private YlzMedicailIcdDao ylzMedicailIcdDao;
|
|
|
@Autowired
|
|
|
private YlzMedicailMxDao ylzMedicailMxDao;
|
|
|
|
|
|
private String ylzConfigUrl;
|
|
|
private String ylzConfigAppid;
|
|
@ -879,24 +887,24 @@ public class HealthCareService {
|
|
|
*/
|
|
|
public String register(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.01";
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("上传医保失败:门诊为空!");
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("上传医保挂号失败:结算信息为空!");
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("region_code","350200");//参保地区划代码
|
|
|
data.put("idcard",outpatientDO.getIdcard());//证件号码
|
|
|
data.put("name",outpatientDO.getPatientName());//姓名
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
data.put("medical_mode","10");//医疗就诊方式
|
|
|
data.put("medical_type","11");//医疗类别
|
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//his流水号
|
|
|
data.put("his_dept_code",outpatientDO.getDept());//his内部科室编码
|
|
|
data.put("his_dept_name",outpatientDO.getDeptName());//his内部科室名称
|
|
|
data.put("emergency_sign",0);//急诊标志0 否,1 是
|
|
|
data.put("trauma_sign",0);//外伤标志0 否,1 是
|
|
|
data.put("date", DateUtil.dateToStrLong(outpatientDO.getAdmDate()));//实际门诊/入院日期 若为空,默认取系统时间
|
|
|
data.put("data_source","53");//数据来源
|
|
|
data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
|
|
|
data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
|
|
|
data.put("name",ylzMedicalRelationDO.getName());//姓名
|
|
|
data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
|
|
|
data.put("his_dept_code",ylzMedicalRelationDO.getHisDeptCode());//his内部科室编码
|
|
|
data.put("his_dept_name",ylzMedicalRelationDO.getHisDeptName());//his内部科室名称
|
|
|
data.put("emergency_sign",ylzMedicalRelationDO.getEmergencySign());//急诊标志0 否,1 是
|
|
|
data.put("trauma_sign",ylzMedicalRelationDO.getTraumaSign());//外伤标志0 否,1 是
|
|
|
data.put("date", DateUtil.dateToStrLong(ylzMedicalRelationDO.getDate()));//实际门诊/入院日期 若为空,默认取系统时间
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
String result = requestYlz(data,funid,"医保挂号");
|
|
|
if (result==null){
|
|
|
throw new Exception("上传医保挂号失败!");
|
|
@ -905,9 +913,8 @@ public class HealthCareService {
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String insuranceSerial = encryptData.getString("insurance_serial");
|
|
|
outpatientDO.setInsuranceSerial(insuranceSerial);
|
|
|
outpatientDO.setMedicalStatus(1);
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
ylzMedicalRelationDO.setInsuranceSerial(insuranceSerial);
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
logger.info("医保挂号流水号保存成功");
|
|
|
}
|
|
|
return result;
|
|
@ -925,20 +932,20 @@ public class HealthCareService {
|
|
|
*/
|
|
|
public String registerBack(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.02";
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("上传医保失败:门诊为空!");
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保挂号冲销失败:结算信息为空!");
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("region_code","350200");//参保地区划代码
|
|
|
data.put("idcard",outpatientDO.getIdcard());//证件号码
|
|
|
data.put("name",outpatientDO.getPatientName());//姓名
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
data.put("medical_mode","10");//医疗就诊方式
|
|
|
data.put("medical_type","11");//医疗类别
|
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//his流水号
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("data_source","53");//数据来源
|
|
|
data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
|
|
|
data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
|
|
|
data.put("name",ylzMedicalRelationDO.getName());//姓名
|
|
|
data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
String result = requestYlz(data,funid,"医保挂号冲销");
|
|
|
if (result==null){
|
|
|
throw new Exception("上传医保挂号冲销失败!");
|
|
@ -947,9 +954,6 @@ public class HealthCareService {
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String invalidSerial = encryptData.getString("refund_serial");
|
|
|
outpatientDO.setInvalidSerial(invalidSerial);
|
|
|
outpatientDO.setMedicalStatus(0);
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
logger.info("医保挂号冲销流水号保存成功");
|
|
|
}
|
|
|
return result;
|
|
@ -965,80 +969,64 @@ public class HealthCareService {
|
|
|
*/
|
|
|
public String feeDetailUpload(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.03";
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("上传医保费用明细失败:门诊信息为空!");
|
|
|
}
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
|
|
|
if (doctorDO==null){
|
|
|
throw new Exception("上传医保费用明细失败:医生信息为空!");
|
|
|
}
|
|
|
String peopleType = "";
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findByHospitalAndDictCode("doctorType",doctorDO.getJobTitleName());
|
|
|
Double register = outpatientDO.getFee();
|
|
|
Double drugFee= 0.0;
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS){
|
|
|
drugFee +=wlyyPrescriptionDO.getDrugFee();
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保费用明细上传:结算信息为空!");
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("region_code","350200");//参保地区划代码
|
|
|
data.put("name",outpatientDO.getPatientName());//姓名
|
|
|
data.put("idcard",outpatientDO.getIdcard());//证件号码
|
|
|
data.put("cert_type","01");//证件类型 TODO
|
|
|
data.put("medical_mode","10");//医疗就诊方式
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//his流水号
|
|
|
data.put("item_count",2);//明细项目数量
|
|
|
data.put("total_amount",drugFee+register);//医疗费总金额
|
|
|
data.put("data_source","53");//数据来源
|
|
|
String icd10 = outpatientDO.getIcd10();
|
|
|
String icd10Name = outpatientDO.getIcd10Name();
|
|
|
String icd[] = icd10.split(",");
|
|
|
String icdName[] = icd10Name.split(",");
|
|
|
data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
|
|
|
data.put("name",ylzMedicalRelationDO.getName());//姓名
|
|
|
data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
|
|
|
data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型 TODO
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
|
|
|
data.put("item_count",ylzMedicalRelationDO.getItemCount());//明细项目数量
|
|
|
data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
List<YlzMedicalIcdDO> ylzMedicalIcdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
if (ylzMedicalIcdDOList==null){
|
|
|
throw new Exception("医保费用明细上传:诊断结算信息为空!");
|
|
|
}
|
|
|
JSONArray icdArray = new JSONArray();
|
|
|
for (int i=0;i<icd.length;i++){
|
|
|
for (YlzMedicalIcdDO ylzMI:ylzMedicalIcdDOList){
|
|
|
JSONObject icdObj = new JSONObject();
|
|
|
icdObj.put("disease_code_icd10",icd[i]);//诊断或症状编码
|
|
|
icdObj.put("disease_name_icd10",icdName[i]);//诊断或症状名称
|
|
|
icdObj.put("disease_type","01");//诊断或症状类型
|
|
|
icdObj.put("disease_order",i);//诊断或症状序号
|
|
|
icdObj.put("disease_code_icd10",ylzMI.getDiseaseCodeIcd10());//诊断或症状编码
|
|
|
icdObj.put("disease_name_icd10",ylzMI.getDiseaseNameIcd10());//诊断或症状名称
|
|
|
icdObj.put("disease_type",ylzMI.getDiseaseType());//诊断或症状类型
|
|
|
icdObj.put("disease_order",ylzMI.getDiseaseOrder());//诊断或症状序号
|
|
|
icdArray.add(icdObj);
|
|
|
}
|
|
|
data.put("zdlist",icdArray);
|
|
|
List<YlzMedicalMxDO> ylzMedicalMxDOS = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
if (ylzMedicalIcdDOList==null){
|
|
|
throw new Exception("医保费用明细上传:诊断结算信息为空!");
|
|
|
}
|
|
|
JSONArray infoArray = new JSONArray();
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS){
|
|
|
List<WlyyPrescriptionInfoDO> prescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:prescriptionInfoDOS){
|
|
|
for (YlzMedicalMxDO ylzMedicalMxDO:ylzMedicalMxDOS){
|
|
|
JSONObject infoObj = new JSONObject();
|
|
|
infoObj.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
|
|
|
infoObj.put("his_detail_sn",wlyyPrescriptionDO.getVoucherNo());//his处方明细流水号
|
|
|
infoObj.put("item_name","西药费");//医保项目名称
|
|
|
infoObj.put("item_code","61");//医保项目编码
|
|
|
infoObj.put("specification_type",wlyyPrescriptionInfoDO.getSpecification());//规格型号
|
|
|
infoObj.put("dosage_form",wlyyPrescriptionInfoDO.getDosage());//剂型
|
|
|
infoObj.put("charge_unit",wlyyPrescriptionInfoDO.getPackUnitName());//单位
|
|
|
infoObj.put("price",wlyyPrescriptionInfoDO.getPackRetprice());//单价
|
|
|
infoObj.put("amount",wlyyPrescriptionInfoDO.getQuantity());//数量
|
|
|
infoObj.put("total_money",wlyyPrescriptionInfoDO.getPackRetprice()*Integer.parseInt(wlyyPrescriptionInfoDO.getQuantity()));//金额
|
|
|
infoObj.put("prescription_date", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()));//处方日期
|
|
|
infoObj.put("his_dept_code",wlyyPrescriptionDO.getDept());//his内部科室编码
|
|
|
infoObj.put("his_dept_name",wlyyPrescriptionDO.getDeptName());//his内部科室名称
|
|
|
infoObj.put("medical_per_name",wlyyPrescriptionDO.getDoctorName());//医疗服务人员姓名
|
|
|
infoObj.put("medical_per_id",doctorDO.getIdcard());//医疗服务人员证件号码
|
|
|
infoObj.put("limit_type","");//限制范围类别
|
|
|
infoObj.put("actg_date",DateUtil.dateToStr(wlyyPrescriptionDO.getPrescribeTime(),DateUtil.YYYYMMDD));//记帐日期
|
|
|
infoObj.put("his_item_name",wlyyPrescriptionInfoDO.getDrugName());//HIS院内项目名称
|
|
|
infoObj.put("his_item_code",wlyyPrescriptionInfoDO.getDrugNo());//HIS院内项目编码
|
|
|
infoObj.put("clerk_days",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPrescribeTime()));//记帐日期
|
|
|
if (hospitalSysDictDO==null){
|
|
|
infoObj.put("people_type","03");//医保服务人员类别
|
|
|
}else {
|
|
|
infoObj.put("people_type",hospitalSysDictDO.getDictValue());//医保服务人员类别
|
|
|
}
|
|
|
|
|
|
infoObj.put("prescription_code",ylzMedicalMxDO.getPrescriptionCode());//医院处方编号
|
|
|
infoObj.put("his_detail_sn",ylzMedicalMxDO.getHisDetailSn());//his处方明细流水号
|
|
|
infoObj.put("item_name",ylzMedicalMxDO.getItemName());//医保项目名称
|
|
|
infoObj.put("item_code",ylzMedicalMxDO.getItemCode());//医保项目编码
|
|
|
infoObj.put("specification_type",ylzMedicalMxDO.getSpecificationType());//规格型号
|
|
|
infoObj.put("dosage_form",ylzMedicalMxDO.getDosageForm());//剂型
|
|
|
infoObj.put("charge_unit",ylzMedicalMxDO.getChargeUnit());//单位
|
|
|
infoObj.put("price",ylzMedicalMxDO.getPrice());//单价
|
|
|
infoObj.put("amount",ylzMedicalMxDO.getAmount());//数量
|
|
|
infoObj.put("total_money",ylzMedicalMxDO.getTotalMoney());//金额
|
|
|
infoObj.put("prescription_date", DateUtil.dateToStrLong(ylzMedicalMxDO.getPrescriptionDate()));//处方日期
|
|
|
infoObj.put("his_dept_code",ylzMedicalMxDO.getHisDeptCode());//his内部科室编码
|
|
|
infoObj.put("his_dept_name",ylzMedicalMxDO.getHisDeptName());//his内部科室名称
|
|
|
infoObj.put("medical_per_name",ylzMedicalMxDO.getMedicalPerName());//医疗服务人员姓名
|
|
|
infoObj.put("medical_per_id",ylzMedicalMxDO.getMedicalPerId());//医疗服务人员证件号码
|
|
|
infoObj.put("limit_type",ylzMedicalMxDO.getLimitType());//限制范围类别
|
|
|
infoObj.put("actg_date",DateUtil.dateToStr(ylzMedicalMxDO.getActgDate(),DateUtil.YYYYMMDD));//记帐日期
|
|
|
infoObj.put("his_item_name",ylzMedicalMxDO.getHisItemName());//HIS院内项目名称
|
|
|
infoObj.put("his_item_code",ylzMedicalMxDO.getHisItemCode());//HIS院内项目编码
|
|
|
infoObj.put("clerk_days",DateUtil.dateToStrLong(ylzMedicalMxDO.getClerkDays()));//记帐日期
|
|
|
infoObj.put("people_type",ylzMedicalMxDO.getPeopleType());//医保服务人员类别
|
|
|
infoArray.add(infoObj);
|
|
|
}
|
|
|
}
|
|
|
data.put("mxlist",infoArray);
|
|
|
String result = requestYlz(data,funid,"医保费用明细上传");
|
|
@ -1049,11 +1037,8 @@ public class HealthCareService {
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String detailSerial = encryptData.getString("detail_serial");
|
|
|
for (WlyyPrescriptionDO presDo:wlyyPrescriptionDOS){
|
|
|
presDo.setDetailSerial(detailSerial);
|
|
|
presDo.setMedicalStatus(1);
|
|
|
prescriptionDao.save(presDo);
|
|
|
}
|
|
|
ylzMedicalRelationDO.setDetailSerial(detailSerial);
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
logger.info("医保费用明细上传失败保存成功");
|
|
|
}
|
|
|
return result;
|
|
@ -1070,40 +1055,26 @@ public class HealthCareService {
|
|
|
*/
|
|
|
public String feeDetailRefund(String outpatientId,String prescriptionId,String remark) throws Exception{
|
|
|
String funid = "N20.17.04.04";
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("上传医保失败:门诊为空!");
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保费用明细上传:结算信息为空!");
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("region_code","350200");//参保地区划代码
|
|
|
data.put("idcard",outpatientDO.getIdcard());//证件号码
|
|
|
data.put("name",outpatientDO.getPatientName());//姓名
|
|
|
data.put("medical_mode","10");//医疗就诊方式
|
|
|
data.put("medical_type","11");//医疗类别
|
|
|
if (StringUtils.isNoneBlank(prescriptionId)){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
data.put("detail_serial",wlyyPrescriptionDO.getDetailSerial());//医保明细流水号
|
|
|
}
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
|
|
|
data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
|
|
|
data.put("name",ylzMedicalRelationDO.getName());//姓名
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
|
|
|
data.put("detail_serial",ylzMedicalRelationDO.getDetailSerial());//医保明细流水号
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("invalidation_reason",remark);//作废原因
|
|
|
data.put("data_source","53");//数据来源
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
String result = requestYlz(data,funid,"医保费用明细上传冲销");
|
|
|
if (result==null){
|
|
|
throw new Exception("医保费用明细上传冲销失败!");
|
|
|
}
|
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
if (StringUtils.isNoneBlank(prescriptionId)){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
wlyyPrescriptionDO.setMedicalStatus(0);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}else {
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutPatientIdListAndMedical(outpatientId);
|
|
|
for (WlyyPrescriptionDO preDo:prescriptionDOList){
|
|
|
preDo.setMedicalStatus(0);
|
|
|
prescriptionDao.save(preDo);
|
|
|
}
|
|
|
}
|
|
|
logger.info("医保费用明细上传冲销保存成功");
|
|
|
}
|
|
|
return result;
|
|
@ -1120,54 +1091,30 @@ public class HealthCareService {
|
|
|
*/
|
|
|
public String preSettlement(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.05";
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("上传医保预结算服务失败:门诊为空!");
|
|
|
}
|
|
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
|
|
|
if (doctorDO==null){
|
|
|
throw new Exception("上传医保预结算服务失败:医生信息为空!");
|
|
|
}
|
|
|
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findByHospitalAndDictCode("doctorType",doctorDO.getJobTitleName());
|
|
|
Double register = outpatientDO.getFee();
|
|
|
Double drugFee= 0.0;
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
List<String> list = new ArrayList<>();
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS){
|
|
|
drugFee +=wlyyPrescriptionDO.getDrugFee();
|
|
|
if (list!=null&&list.size()!=0&&!list.contains(wlyyPrescriptionDO.getRealOrder())){
|
|
|
list.add(wlyyPrescriptionDO.getRealOrder());
|
|
|
}
|
|
|
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保费用明细上传:结算信息为空!");
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("region_code","350200");//参保地区划代码
|
|
|
data.put("idcard",outpatientDO.getIdcard());//证件号码
|
|
|
data.put("name",outpatientDO.getPatientName());//姓名
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
data.put("medical_mode","10");//医疗就诊方式
|
|
|
data.put("medical_type","11");//医疗类别
|
|
|
data.put("his_bill_serial",outpatientDO.getXtgzh());//his收费单据流水号
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
|
|
|
data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
|
|
|
data.put("name",ylzMedicalRelationDO.getName());//姓名
|
|
|
data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
|
|
|
data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("settlement_sign",0);//结算标识
|
|
|
data.put("date",outpatientDO.getAdmDate());//实际就诊日期
|
|
|
data.put("date",DateUtil.dateToStrLong(ylzMedicalRelationDO.getDate()));//实际就诊日期
|
|
|
data.put("leave_method","09");//离院方式
|
|
|
data.put("pre_count",list.size());//处方项目数
|
|
|
data.put("total_amount",drugFee+register);//医疗费总金额
|
|
|
data.put("data_source","53");//数据来源
|
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//his流水号
|
|
|
if (hospitalSysDictDO==null){
|
|
|
data.put("doctor_level","03");//医师诊查费等级
|
|
|
data.put("trt_fee_level","03");//医师诊查费等级
|
|
|
}else {
|
|
|
data.put("doctor_level",hospitalSysDictDO.getDictValue());//医师诊查费等级
|
|
|
data.put("trt_fee_level",hospitalSysDictDO.getDictValue());//医师诊查费等级
|
|
|
}
|
|
|
|
|
|
data.put("dept_code",outpatientDO.getDept());//科室编码
|
|
|
data.put("charge_qty",1+list.size());//本次收费次数
|
|
|
data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
|
|
|
data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
|
|
|
data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
|
|
|
data.put("trt_fee_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
|
|
|
data.put("dept_code",ylzMedicalRelationDO.getDeptCode());//科室编码
|
|
|
data.put("charge_qty",1);//本次收费次数
|
|
|
|
|
|
String result = requestYlz(data,funid,"医保预结算服务");
|
|
|
if (result==null){
|
|
@ -1177,41 +1124,28 @@ public class HealthCareService {
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String billSerial = encryptData.getString("bill_serial");
|
|
|
outpatientDO.setBillSerial(billSerial);
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
YlzMedicalRelationDO ylzMr = new YlzMedicalRelationDO();
|
|
|
ylzMr.setCardNo(encryptData.getString("card_no"));
|
|
|
ylzMr.setInsuranceSerial(encryptData.getString("insurance_serial"));
|
|
|
ylzMr.setBillSerial(encryptData.getString("bill_serial"));
|
|
|
ylzMr.setHisBillSerial(encryptData.getString("his_bill_serial"));
|
|
|
ylzMr.setMedicalMode(encryptData.getString("medical_mode"));
|
|
|
ylzMr.setMedicalType(encryptData.getString("medical_type"));
|
|
|
ylzMr.setPersonalCode(encryptData.getString("personal_code"));
|
|
|
ylzMr.setName(encryptData.getString("name"));
|
|
|
ylzMr.setSex(encryptData.getString("sex"));
|
|
|
ylzMr.setSexMc(encryptData.getString("sex_mc"));
|
|
|
ylzMr.setTotalAmount(encryptData.getString("total_amount"));
|
|
|
ylzMr.setPersonCash(encryptData.getString("person_cash"));
|
|
|
ylzMr.setPersonAccount(encryptData.getString("person_account"));
|
|
|
ylzMr.setFundPrice(encryptData.getString("fund_price"));
|
|
|
ylzMr.setJkzhPay(encryptData.getString("jkzh_pay"));
|
|
|
ylzMr.setOwnPay(encryptData.getString("own_pay"));
|
|
|
ylzMr.setAccountBalance(encryptData.getString("account_balance"));
|
|
|
ylzMr.setHospitalizationQty(encryptData.getString("hospitalization_qty"));
|
|
|
ylzMr.setDate(DateUtil.strToDateLong(encryptData.getString("date")));
|
|
|
ylzMr.setPayDate(DateUtil.strToDateLong(encryptData.getString("pay_date")));
|
|
|
ylzMr.setInvoiceJj(encryptData.getString("invoice_jj"));
|
|
|
ylzMr.setInvoiceXj(encryptData.getString("invoice_xj"));
|
|
|
ylzMr.setInvoiceZh(encryptData.getString("invoice_zh"));
|
|
|
ylzMr.setDel(1);
|
|
|
ylzMr.setRelationCode(outpatientId);
|
|
|
ylzMr.setCreateTime(new Date());
|
|
|
ylzMr = ylzMedicailRelationDao.save(ylzMr);
|
|
|
ylzMedicalRelationDO.setInsuranceSerial(encryptData.getString("insurance_serial"));
|
|
|
ylzMedicalRelationDO.setBillSerial(encryptData.getString("bill_serial"));
|
|
|
ylzMedicalRelationDO.setHisBillSerial(encryptData.getString("his_bill_serial"));
|
|
|
ylzMedicalRelationDO.setSexMc(encryptData.getString("sex_mc"));
|
|
|
ylzMedicalRelationDO.setPersonCash(encryptData.getString("person_cash"));
|
|
|
ylzMedicalRelationDO.setPersonAccount(encryptData.getString("person_account"));
|
|
|
ylzMedicalRelationDO.setFundPrice(encryptData.getString("fund_price"));
|
|
|
ylzMedicalRelationDO.setJkzhPay(encryptData.getString("jkzh_pay"));
|
|
|
ylzMedicalRelationDO.setOwnPay(encryptData.getString("own_pay"));
|
|
|
ylzMedicalRelationDO.setAccountBalance(encryptData.getString("account_balance"));
|
|
|
ylzMedicalRelationDO.setHospitalizationQty(encryptData.getString("hospitalization_qty"));
|
|
|
ylzMedicalRelationDO.setPayDate(DateUtil.strToDateLong(encryptData.getString("pay_date")));
|
|
|
ylzMedicalRelationDO.setInvoiceJj(encryptData.getString("invoice_jj"));
|
|
|
ylzMedicalRelationDO.setInvoiceXj(encryptData.getString("invoice_xj"));
|
|
|
ylzMedicalRelationDO.setInvoiceZh(encryptData.getString("invoice_zh"));
|
|
|
ylzMedicalRelationDO.setCreateTime(new Date());
|
|
|
ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
JSONArray jsonArray = encryptData.getJSONArray("fplist");
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
YlzMedicalBillDO ylzMb = new YlzMedicalBillDO();
|
|
|
ylzMb.setMedicalId(ylzMr.getId());
|
|
|
ylzMb.setMedicalId(ylzMedicalRelationDO.getId());
|
|
|
ylzMb.setInvoicePay(jsonObject.getString("invoice_pay"));
|
|
|
ylzMb.setInvoiceType(jsonObject.getString("invoice_type"));
|
|
|
ylzMb.setInvoiceTypeName(jsonObject.getString("invoice_type_name"));
|
|
@ -1238,21 +1172,21 @@ public class HealthCareService {
|
|
|
*/
|
|
|
public String preSettlementRefund(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.06";
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("上传医保失败:门诊为空!");
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保结算冲销上传:结算信息为空!");
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("region_code","350200");//参保地区划代码
|
|
|
data.put("idcard",outpatientDO.getIdcard());//证件号码
|
|
|
data.put("name",outpatientDO.getPatientName());//姓名
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
data.put("medical_mode","10");//医疗就诊方式
|
|
|
data.put("bill_serial",outpatientDO.getBillSerial());//医保收费流水号
|
|
|
data.put("his_bill_serial",outpatientDO.getXtgzh());//his收费单据流水号
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("data_source","53");//数据来源
|
|
|
data.put("refund_serial",outpatientDO.getRegisterNo());//医院退费操作流水号
|
|
|
data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
|
|
|
data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
|
|
|
data.put("name",ylzMedicalRelationDO.getName());//姓名
|
|
|
data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("bill_serial",ylzMedicalRelationDO.getBillSerial());//医保收费流水号
|
|
|
data.put("his_bill_serial",ylzMedicalRelationDO.getHisSerial());//his收费单据流水号
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
data.put("refund_serial",ylzMedicalRelationDO.getHisSerial());//医院退费操作流水号
|
|
|
String result = requestYlz(data,funid,"医保结算冲销服务");
|
|
|
if (result==null){
|
|
|
throw new Exception("医保结算冲销服务失败!");
|
|
@ -1277,57 +1211,32 @@ public class HealthCareService {
|
|
|
public String getSettlementResultUrl(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.07";
|
|
|
JSONObject data = new JSONObject();
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("获取医保结算页面地址失败:门诊为空!");
|
|
|
}
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO =ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("获取医保结算页面地址失败:预结算信息为空");
|
|
|
throw new Exception("获取医保结算页面地址:结算信息为空!");
|
|
|
}
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("ResultRedirectUrl");
|
|
|
if (wlyyHospitalSysDictDO==null){
|
|
|
throw new Exception("获取医保结算页面地址失败:回调地址为空");
|
|
|
}
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
|
|
|
if (doctorDO==null){
|
|
|
throw new Exception("获取医保结算页面地址失败:医生信息为空!");
|
|
|
}
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findByHospitalAndDictCode("doctorType",doctorDO.getJobTitleName());
|
|
|
Double register = outpatientDO.getFee();
|
|
|
Double drugFee= 0.0;
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
List<String> list = new ArrayList<>();
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS){
|
|
|
drugFee +=wlyyPrescriptionDO.getDrugFee();
|
|
|
if (list!=null&&list.size()!=0&&!list.contains(wlyyPrescriptionDO.getRealOrder())){
|
|
|
list.add(wlyyPrescriptionDO.getRealOrder());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
data.put("region_code","350200");//参保地区划代码
|
|
|
data.put("name",outpatientDO.getPatientName());//姓名
|
|
|
data.put("idcard",outpatientDO.getIdcard());//证件号码
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
|
|
|
data.put("name",ylzMedicalRelationDO.getName());//姓名
|
|
|
data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
|
|
|
data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//
|
|
|
data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
|
|
|
data.put("date",ylzMedicalRelationDO.getDate());//实际就诊日期
|
|
|
data.put("leave_method","09");//离院方式
|
|
|
data.put("pre_count",list.size());//处方项目数
|
|
|
data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
|
|
|
data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
|
|
|
data.put("person_cash",ylzMedicalRelationDO.getPersonCash());//个人现金支付金额(实付现金)
|
|
|
data.put("person_account",ylzMedicalRelationDO.getPersonAccount());//个人账户支付金额
|
|
|
data.put("fund_price",ylzMedicalRelationDO.getFundPrice());//基金支付总额
|
|
|
data.put("data_source","53");//数据来源
|
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//his流水号
|
|
|
if (hospitalSysDictDO==null){
|
|
|
data.put("doctor_level","03");//医师诊查费等级
|
|
|
}else {
|
|
|
data.put("doctor_level",hospitalSysDictDO.getDictValue());//医师诊查费等级
|
|
|
}
|
|
|
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
|
|
|
data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
|
|
|
data.put("redirect_url",wlyyHospitalSysDictDO.getDictValue());//回调地址
|
|
|
String result = requestYlz(data,funid,"获取医保结算结果");
|
|
|
if (result==null){
|