Selaa lähdekoodia

[医保代码]

wangzhinan 3 vuotta sitten
vanhempi
commit
f75e952681

+ 151 - 74
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -42,6 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -300,7 +301,7 @@ public class HealthCareService {
            throw new Exception("事前提醒失败:居民生日信息有误");
        }
        data.put("birth",birth);//出生日期 	String	Y
        data.put("medical_type","");//医疗类别	String	Y
        data.put("medical_type","11");//医疗类别	String	Y
        data.put("ticket_no","");//单据流水号	String	Y
        data.put("disease_code","");//特殊门诊病情编码	String	Y
@ -432,8 +433,8 @@ public class HealthCareService {
        }
        data.put("birth",birth);//出生日期 	String	Y
        data.put("phone",patientDO.getMobile());//用户手机号
        data.put("medical_type","");//医疗类别	String	Y
        data.put("medical_type_name","");//医疗类别	String	Y
        data.put("medical_type","11");//医疗类别	String	Y
        data.put("medical_type_name","普通门诊");//医疗类别	String	Y
//        data.put("insurance_ticket_no","");//诊查费结算后的收费单据号	String	N
        data.put("medical_time",DateUtil.dateToStr(outpatientDO.getCreateTime(),DateUtil.YYYY_MM_DD_HH_MM_SS));//特殊门诊病情编码	String	Y
        data.put("disease_code","");//特殊门诊病情编码	String	Y
@ -789,7 +790,7 @@ public class HealthCareService {
            throw new Exception("患者his信息不存在");
        }
        JSONObject data = new JSONObject();
        data.put("service_id","N20.17.01.01");
        data.put("service_id","10000");
        data.put("name",patientDO.getName());
        data.put("idcard",patientDO.getIdcard());
        data.put("cert_type","01");//TODO
@ -822,7 +823,7 @@ public class HealthCareService {
            throw new Exception("患者his信息不存在");
        }
        JSONObject data = new JSONObject();
        data.put("service_id","N20.17.01.01");
        data.put("service_id","10000");
        data.put("name",patientDO.getName());
        data.put("idcard",patientDO.getIdcard());
        data.put("cert_type","01");//TODO
@ -850,12 +851,12 @@ public class HealthCareService {
            throw new Exception("上传医保失败:门诊为空!");
        }
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        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","门(急)诊");//医疗类别
        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内部科室名称
@ -896,12 +897,12 @@ public class HealthCareService {
            throw new Exception("上传医保失败:门诊为空!");
        }
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        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","门(急)诊");//医疗类别
        data.put("medical_type","11");//医疗类别
        data.put("his_serial",outpatientDO.getRegisterNo());//his流水号
        data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保流水号
        data.put("data_source","53");//数据来源
@ -939,6 +940,8 @@ public class HealthCareService {
        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);
@ -946,7 +949,7 @@ public class HealthCareService {
            drugFee +=wlyyPrescriptionDO.getDrugFee();
        }
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        data.put("region_code","350200");//参保地区划代码
        data.put("name",outpatientDO.getPatientName());//姓名
        data.put("idcard",outpatientDO.getIdcard());//证件号码
        data.put("cert_type","01");//证件类型 TODO
@ -963,10 +966,10 @@ public class HealthCareService {
        JSONArray icdArray = new JSONArray();
        for (int i=0;i<icd.length;i++){
            JSONObject icdObj = new JSONObject();
            icdObj.put("disease_code_icd10","");//诊断或症状编码
            icdObj.put("disease_name_icd10","");//诊断或症状名称
            icdObj.put("disease_type","");//诊断或症状类型
            icdObj.put("disease_order","");//诊断或症状序号
            icdObj.put("disease_code_icd10",icd[i]);//诊断或症状编码
            icdObj.put("disease_name_icd10",icdName[i]);//诊断或症状名称
            icdObj.put("disease_type","01");//诊断或症状类型
            icdObj.put("disease_order",i);//诊断或症状序号
            icdArray.add(icdObj);
        }
        data.put("zdlist",icdArray);
@ -976,12 +979,12 @@ public class HealthCareService {
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:prescriptionInfoDOS){
                JSONObject infoObj = new JSONObject();
                infoObj.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
                infoObj.put("his_detail_sn","");//his处方明细流水号
                infoObj.put("item_name","");//医保项目名称
                infoObj.put("item_code","");//医保项目编码
                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","");//单位
                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()));//金额
@ -991,11 +994,16 @@ public class HealthCareService {
                infoObj.put("medical_per_name",wlyyPrescriptionDO.getDoctorName());//医疗服务人员姓名
                infoObj.put("medical_per_id",doctorDO.getIdcard());//医疗服务人员证件号码
                infoObj.put("limit_type","");//限制范围类别
                infoObj.put("actg_date","");//记帐日期
                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","");//记帐日期
                infoObj.put("people_type","");//医保服务人员类别
                infoObj.put("clerk_days",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPrescribeTime()));//记帐日期
                if (hospitalSysDictDO==null){
                    infoObj.put("people_type","03");//医保服务人员类别
                }else {
                    infoObj.put("people_type",hospitalSysDictDO.getDictValue());//医保服务人员类别
                }
                infoArray.add(infoObj);
            }
        }
@ -1034,18 +1042,18 @@ public class HealthCareService {
            throw new Exception("上传医保失败:门诊为空!");
        }
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        data.put("region_code","350200");//参保地区划代码
        data.put("idcard",outpatientDO.getIdcard());//证件号码
        data.put("name",outpatientDO.getPatientName());//姓名
        data.put("medical_mode","");//医疗就诊方式
        data.put("medical_type","");//医疗类别
        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("invalidation_reason",remark);//作废原因
        data.put("data_source","");//数据来源
        data.put("data_source","53");//数据来源
        String result = requestYlz(data,funid,"医保费用明细上传冲销");
        if (result==null){
            throw new Exception("医保费用明细上传冲销失败!");
@ -1081,28 +1089,53 @@ public class HealthCareService {
        String funid = "N20.17.04.05";
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO==null){
            throw new Exception("上传医保失败:门诊为空!");
            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());
            }
        }
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        data.put("region_code","350200");//参保地区划代码
        data.put("idcard",outpatientDO.getIdcard());//证件号码
        data.put("name",outpatientDO.getPatientName());//姓名
        data.put("cert_type","");//证件类型
        data.put("medical_mode","");//医疗就诊方式
        data.put("medical_type","");//医疗类别
        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("settlement_sign",0);//结算标识
        data.put("date",outpatientDO.getAdmDate());//实际就诊日期
        data.put("leave_method","");//离院方式
        data.put("pre_count","");//处方项目数
        data.put("total_amount","");//医疗费总金额
        data.put("data_source","");//数据来源
        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流水号
        data.put("doctor_level","");//医师诊查费等级
        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","");//本次收费次数
        data.put("trt_fee_level","");//医师诊查费等级
        data.put("charge_qty",1+list.size());//本次收费次数
        String result = requestYlz(data,funid,"医保预结算服务");
        if (result==null){
            throw new Exception("医保预结算服务失败!");
@ -1177,16 +1210,16 @@ public class HealthCareService {
            throw new Exception("上传医保失败:门诊为空!");
        }
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        data.put("region_code","350200");//参保地区划代码
        data.put("idcard",outpatientDO.getIdcard());//证件号码
        data.put("name",outpatientDO.getPatientName());//姓名
        data.put("cert_type","");//证件类型
        data.put("medical_mode","");//医疗就诊方式
        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","");//数据来源
        data.put("refund_serial","");//医院退费操作流水号
        data.put("data_source","53");//数据来源
        data.put("refund_serial",outpatientDO.getRegisterNo());//医院退费操作流水号
        String result = requestYlz(data,funid,"医保结算冲销服务");
        if (result==null){
            throw new Exception("医保结算冲销服务失败!");
@ -1223,24 +1256,45 @@ public class HealthCareService {
        if (wlyyHospitalSysDictDO==null){
            throw new Exception("获取医保结算页面地址失败:回调地址为空");
        }
        data.put("region_code","");//参保地区划代码
        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","");//证件类型
        data.put("cert_type","01");//证件类型
        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","");//离院方式
        data.put("pre_count","");//处方项目数
        data.put("leave_method","09");//离院方式
        data.put("pre_count",list.size());//处方项目数
        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","");//数据来源
        data.put("data_source","53");//数据来源
        data.put("his_serial",outpatientDO.getRegisterNo());//his流水号
        data.put("doctor_level","");//医师诊查费等级
        if (hospitalSysDictDO==null){
            data.put("doctor_level","03");//医师诊查费等级
        }else {
            data.put("doctor_level",hospitalSysDictDO.getDictValue());//医师诊查费等级
        }
        data.put("redirect_url",wlyyHospitalSysDictDO.getDictValue());//回调地址
        String result = requestYlz(data,funid,"获取医保结算结果");
        if (result==null){
@ -1274,30 +1328,40 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param code
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String uploadMedicalHistory(String outpatientId) throws Exception{
        String funid = "N20.17.06.01";
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        data.put("idcard","");//身份证号
        data.put("name","");//姓名
        data.put("cert_type","");//证件类型
        data.put("insurance_serial","");//医保流水号
        data.put("blood_type","");//血型
        data.put("allergy","");//过敏史
        data.put("diagnosis","");//病理诊断
        data.put("describe","");//病情描述
        data.put("difficult_cases","");//疑难病例
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
        if (wlyyOutpatientDO==null){
            throw new Exception("医保上传户病史病情及医学报告失败!门诊为空");
        }
        data.put("region_code","350200");//参保地区划代码
        data.put("idcard",wlyyOutpatientDO.getId());//身份证号
        data.put("name",wlyyOutpatientDO.getPatientName());//姓名
        data.put("cert_type","01");//证件类型
        data.put("insurance_serial",wlyyOutpatientDO.getInsuranceSerial());//医保流水号
        data.put("blood_type",wlyyOutpatientDO.getBloodType());//血型
        data.put("allergy",wlyyOutpatientDO.getAllergy());//过敏史
        data.put("diagnosis",wlyyOutpatientDO.getIcd10Name());//病理诊断
        data.put("describe",wlyyOutpatientDO.getDescription());//病情描述
        data.put("difficult_cases","无");//疑难病例
        data.put("file_list_count",0);//医学报告附件数量
        data.put("data_source","");//数据来源
        data.put("data_source","53");//数据来源
        String result = requestYlz(data,funid,"上传用户病史病情及医学报告");
        if (result==null){
            throw new Exception("上传用户病史病情及医学报告失败!");
        }
        JSONObject object = JSONObject.parseObject(result);
        if (object.getString("flag").equalsIgnoreCase("1")){
            JSONObject encryptData = object.getJSONObject("encrypt_data");
            wlyyOutpatientDO.setInsuranceMedHistserial(encryptData.getString("insurance_med_hist_serial"));
            logger.info("上传用户病史病情及医学报告保存成功");
        }
        return result;
    }
@ -1313,14 +1377,19 @@ public class HealthCareService {
    public String refundMedicalHistory(String outpatientId,String remark) throws Exception{
        String funid = "N20.17.06.06";
        JSONObject data = new JSONObject();
        data.put("insurance_serial","");//医保流水号
        data.put("insurance_med_hist_serial","");//医保病史上传流水号
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
        if (wlyyOutpatientDO==null){
            throw new Exception("医保上传户病史病情及医学报告失败!门诊为空");
        }
        data.put("insurance_serial",wlyyOutpatientDO.getInsuranceSerial());//医保流水号
        data.put("insurance_med_hist_serial",wlyyOutpatientDO.getInsuranceMedHistserial());//医保病史上传流水号
        data.put("invalid_reason",remark);//作废原因
        data.put("data_source","");//数据来源
        data.put("data_source","53");//数据来源
        String result = requestYlz(data,funid,"作废用户病史病情及医学报告");
        if (result==null){
            throw new Exception("作废用户病史病情及医学报告失败!");
        }
        return result;
    }
@ -1329,25 +1398,33 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param code
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String uploadIcdProcess(String code) throws Exception{
    public String uploadIcdProcess(String outpatientId) throws Exception{
        String funid = "N20.17.06.02";
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
        if (wlyyOutpatientDO==null){
            throw new Exception("获取问诊过程数据失败!门诊为空");
        }
        BaseDoctorDO doctorDO = doctorDao.findById(wlyyOutpatientDO.getDoctor());
        if (doctorDO==null){
            throw new Exception("获取问诊过程数据失败!医生信息为空");
        }
        JSONObject data = new JSONObject();
        data.put("region_code","");//参保地区划代码
        data.put("idcard","");//身份证号
        data.put("name","");//姓名
        data.put("cert_type","");//证件类型
        data.put("service_serial_id","");//问诊流水号
        data.put("doctor_id_card","");//医师身份证
        data.put("doctor_name","");//医师姓名
        data.put("file_list_count","");//附件总数
        data.put("region_code","350200");//参保地区划代码
        data.put("idcard",wlyyOutpatientDO.getIdcard());//身份证号
        data.put("name",wlyyOutpatientDO.getPatientName());//姓名
        data.put("cert_type","01");//证件类型
        data.put("service_serial_id",wlyyOutpatientDO.getRegisterNo());//问诊流水号
        data.put("doctor_id_card",doctorDO.getIdcard());//医师身份证
        data.put("doctor_name",wlyyOutpatientDO.getDoctorName());//医师姓名
        /*data.put("file_list_count","");//附件总数
        data.put("filelist","");//附件列表
        data.put("file_bytes","");//二进制字节流
        data.put("file_name","");//文件名
        data.put("order_num",0);//顺序号
        data.put("order_num",0);//顺序号*/
        String result = requestYlz(data,funid,"获取问诊过程数据");
        if (result==null){

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/httplog/YlzHttpLogDO.java

@ -92,6 +92,7 @@ public class YlzHttpLogDO extends UuidIdentityEntity {
        this.createTime = createTime;
    }
    @Column(name = "request_encrypt")
    public String getRequestEncrypt() {
        return requestEncrypt;
    }
@ -100,6 +101,7 @@ public class YlzHttpLogDO extends UuidIdentityEntity {
        this.requestEncrypt = requestEncrypt;
    }
    @Column(name = "response_encrpty")
    public String getResponseEncrypt() {
        return responseEncrypt;
    }

+ 33 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -299,6 +299,39 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    private String billSerial;//医保收费流水号
    private String insuranceMedHistserial;//医保病史上传流水号
    private String bloodType;//血型
    private String allergy;//过敏史
    @Column(name = "blood_type")
    public String getBloodType() {
        return bloodType;
    }
    public void setBloodType(String bloodType) {
        this.bloodType = bloodType;
    }
    @Column(name = "allergy")
    public String getAllergy() {
        return allergy;
    }
    public void setAllergy(String allergy) {
        this.allergy = allergy;
    }
    @Column(name = "insurance_med_hist_serial")
    public String getInsuranceMedHistserial() {
        return insuranceMedHistserial;
    }
    public void setInsuranceMedHistserial(String insuranceMedHistserial) {
        this.insuranceMedHistserial = insuranceMedHistserial;
    }
    @Column(name = "bill_serial")
    public String getBillSerial() {
        return billSerial;