商城退款 实例

 http://10.100.30.140:8001/WebReport/ReportServer?reportlet=product%2Fdemohnxd%2Fthc_rcm_wuhu_yibao.cpt&id=01c43809b8764524bc2d3a36c681e814&op=vie

1.一站式支付退款参数:

{
    "orderId":"58E654C3FFDF4146812C6FDF7F443A5A",
    "patientId":"XML429lNKpjyl7t5rDI",
    "seller":"0492b551-2757-4039-9677-23e095fbe3ab",
    "orderTime":"2019-01-09 16:28:17",
    "membersNo":null,
    "bizType":3,
    "direction":2,
    "totalPrice":140,
    "payPrice":140,
    "orderNo":"",
    "refundNo":"54702249603099",
    "details":[
        {
            "orderItemNo":"54702249603100",
            "goodsId":"22002",
            "goodsName":"住院诊疗费-主治",
            "goodsType":4,
            "singleOrigPrice":60,
            "singleSalePrice":60,
            "count":1
        },
        {
            "orderItemNo":"54702249603101",
            "goodsId":"b7c7d5ee-d04e-11e8-a947-525400ccdcb2",
            "goodsName":"住院诊疗费-副主任",
            "goodsType":4,
            "singleOrigPrice":80,
            "singleSalePrice":80,
            "count":1
        }
    ]
}

2. 查询所有的未支付的账单结算单ID  SQL 

select distinct
    a.id as accountId,
    a.settlement_id,
    c.settlement_no
from thc_rcm.`mall_account_bill` a
join thc_rcm.`mall_account_bill_detail` b on a.id = b.`account_id`
join thc_rcm.`mall_settlement_detail` d on d.`account_detail_id` = b.id and d.`account_id` = a.id
join thc_rcm.`mall_settlement` c on c.id = d.`settlement_id`
inner join `thc_passport`.`patient` p on a.`patient_id` = p.id
where a.`refund_no` = '54702249603099' and a.status in (0,1)  and c.status in (0,1)
order by a.id

3. 正向单的查询:

select 
    p.name,
    a.id as accountId,
    a.settlement_id,
    c.settlement_no,
    b.id as accountDetailId,
    d.id as settlementDetailId,
    a.status as accountStatus,
    c.status as settlementStatus,
    a.isDelete as accountDelete,
    c.isDelete as settlementDelete
from thc_rcm.`mall_account_bill` a
join thc_rcm.`mall_account_bill_detail` b on a.id = b.`account_id`
join thc_rcm.`mall_settlement_detail` d on d.`account_detail_id` = b.id and d.`account_id` = a.id
join thc_rcm.`mall_settlement` c on c.id = d.`settlement_id`
inner join `thc_passport`.`patient` p on a.`patient_id` = p.id
where a.`order_no` in ('54702249603099') -- and a.status in (0,1) -- 0 新建 1待处理 2已处理 3部分退款 4全部退款
order by a.id

商城账单里回写了结算单ID字段

原文地址:https://www.cnblogs.com/guchunchao/p/10246918.html