import request from '@/utils/request'
import request2 from '@/utils/request2'
import Vue from 'vue'
// 出院获取患者信息
export function preSettlementGetPatientInfo (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.preSettlementGetPatientInfo,
        method: 'get',
        params:data
    })
}
// 出院获取患者信息
export function zyByIdCard (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.zyByIdCard,
        method: 'get',
        params:data
    })
}
// 出院获取患者信息
export function zyByInpatientNo (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.zyByInpatientNo,
        method: 'get',
        params:data
    })
}
// 更新
export function updates (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.updates+'?'+data.his_inpatient_no,
        method: 'get',
        params:data
    })
}
// 住院预结算
export function preSettlement (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.preSettlement+'/'+data.patient_id,
        method: 'post',
        data
    })
}
// // 住院预结算
// export function preSettlement (data) {
//     return request({
//         url: 'https://mock.apifox.cn/m1/2518050-0-default/settlement/1',
//         method: 'post',
//         data
//     })
// }

// 出院
export function outHospital (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.outHospital,
        method: 'post',
        data
    })
}
// 出院
export function prereturn (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.prereturn,
        method: 'get',
        params:data
    })
}

// 删除
export function deletefee (data) {
    return request({
        url: Vue.prototype.$api.patient.deletefee,
        method: 'delete',
        data
    })
}
// 获取患者医保信息
export function getPatientInfo2 (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.getPatientInfo2,
        method: 'get',
        params:data
    })
}

// 结算列表
export function jiesuanlist (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.jiesuanlist,
        method: 'get',
        params:data
    })
}
// 结算列表
export function freemoney (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.freemoney,
        method: 'post',
        data
    })
}

// 费用列表
export function feelist (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.feelist,
        method: 'get',
        params:data
    })
}
// 费用列表
export function invoice (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.invoice,
        method: 'get',
        params:data
    })
}

// 费用列表（所有人）
export function allfeelist (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.allfeelist,
        method: 'get',
        params:data
    })
}
// 数据字典
export function query_dict (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.query_dict+'/'+data.type,
        method: 'get',
        params:data
    })
}
// 结算流水号
export function get_serial_number (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.get_serial_number+'/'+data.type,
        method: 'get',
        params:data
    })
}
// 结算流水号
export function zy_mis (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.zy_mis,
        method: 'post',
        data
    })
}
// 结算流水号
export function retry_params (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.retry_params,
        method: 'get',
        params:data
    })
}
// 用血报销
export function blood (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.blood+'/'+data.jshid,
        method: 'post',
        data
    })
}
// 退款
export function refund (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.refund,
        method: 'PATCH',
        data
    })
}
// 结算流水号
export function tuikuanlist (data) {
    return request({
        url:Vue.prototype.$api.jiesuan.tuikuanlist,
        method: 'post',
        data
    })
}
// 系统配置获取
export function desconfig (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.config+'/'+data.name,
        method: 'PATCH',
        data
    })
}
// 系统配置获取
export function config () {
    return request({
        url: Vue.prototype.$api.jiesuan.config,
        method: 'get',
    })
}
// 撤销出院列表
export function rechargeList (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.discharge,
        method: 'get',
        params:data
    })
}
// 撤销出院列表
export function recharge_refund (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.recharge_refund,
        method: 'get',
        params:data
    })
}
// 修改自付比例
export function editProp (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.editProportion,
        method: 'post',
        data
    })
}
// 修改自付比例
export function zfbl (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.zfbl,
        method: 'get',
        params:data
    })
}
// 修改自付比例
export function get_zfbl (data) {
    return request({
        url: Vue.prototype.$api.jiesuan.get_zfbl,
        method: 'post',
        data
    })
}
// 医保预结算  settle/{patient_id}/pre
export function settlementPre (data) {
    return request({
        url: `/api/settle/${data.patient_id}/pre`,
        method: 'post',
        data
    })
}

// 医保预结算  settle/{patient_id}/pre
export function familybalanceinfor (data) {
    return request({
        url: `/api/settle/family-balance?${data.patient_id}`,
        method: 'get',
        params:data
    })
}
// 医保预结算  settle/{patient_id}/pre
export function hisybbalance (data) {
    return request({
        url: `/api/patient/his_yb_balance`,
        method: 'post',
        data
    })
}
export function patient (data) {
    console.log(data,'ppppppppppppppppppp')
    return request({
        // url: `${Vue.prototype.$api.jiesuan.settlementPre}/${patient_id}`,
        url: `/api/patient/${data.card_no}`,
        method: 'get',
        params:data
    })
}

// 自费预结算  settle_self/{patient_id}/pre
export function settleSelfPre (data) {
    return request({
        url: `/api/settle_self/${data.patient_id}/pre`,
        method: 'post',
        data
    })
}
export function yundaMis (data) {
    return request2({
        url: `/pos/api/trans`,
        method: 'post',
        data
    })
}

// 自费结算  settle_self/{patient_id}/settle
export function selfPre (data) {
    return request({
        url: `/api/settle_self/${data.patient_id}/settle`,
        method: 'post',
        data
    })
}

// 获取共济余额 settle/{pre_key}/family-balance
export function familyBalance (data) {
    return request({
        url: `/api/settle/${data.pre_key}/family-balance`,
        method: 'get',
        params:data
    })
}
