npm package: @imedx/ics-imedx-tripart-universal-charge-js-sdk
Description: v7三方通用收费sdk
Author: 丁薇
Latest version: 0.0.1-beta.19

<!--
 * @Author: 文贝
 * @Date: 2024-05-20 13:38:26
 * @LastEditors: dingwei wding914@163.com
 * @LastEditTime: 2025-11-05 15:44:44
 * @Description: 
 * @FilePath: \ics-imedx-tripart-universal-charge-js-sdk\README.md
-->
### Usage

```bash
npm i @imedx/ics-imedx-tripart-universal-charge-js-sdk@latest
```
### feature
```
0.0.1-beta.19 count 调价后写死确定传3
0.0.1-beta.17 tradeClient传数字
0.0.1-beta.16 refundApplyOrderCheck接口加chargeSceneId
0.0.1-beta.15 接口改包服务
0.0.1-beta.14 取消结算排错
0.0.1-beta.13 typing路径加types
0.0.1-beta.12 医保接口 自助机 serviceMode:1
0.0.1-beta.11 完善入参信息，出参数据格式
0.0.1-beta.10 真实初始化 传参（baseUrl、appId、appSecret、userId）
0.0.1-beta.9  无需初始化
0.0.1 初始提供
```

### Features
### Importing library

You can import the generated bundle to use the whole library generated by this starter:

```javascript
// 引入
import UniChargePlatForm from '@imedx/ics-imedx-tripart-universal-charge-js-sdk'
// 用法
const clientInfo = {
          baseUrl: "http://192.168.11.17:8448", 
          appId: "ics-self-service", // 自助机appId
          appSecret: "ci63K4iNcPW0HZWjorezvW68ZRzP7a8MyFwsYkvx4SvTrZVq7wXKTVSqDjN1Avwk", // 自助机appSecret
          userId: "admin" // 用户
        }
const UniCharge = new UniChargePlatForm(clientInfo)
UniCharge.init()
```

### UniChargePlatForm

```javascript
  /**
   *  初始化(注册自助机)
   * @param baseUrl  基础路由
   * @param appId  应用编码
   * @param appSecret 应用密钥
   * @param userId  用户id
   * new创建实例时传参
   */
  init(): Promise<any>
   new UniChargePlatForm().init()

  /**
   * 读卡接口
   * @param visitId 就诊编码
   * @param oPFlag  1门诊 2住院
   * @param scene  读卡场景
   * @param readCardType  读卡方式
   * @param isMobile  是否移动端
   * @param deptId  科室id
   * @param deptName  科室name
   * @param createOrgId  机构id
   * @param createOrgName  机构名称
   * @param clientId  客户端id
   * @param tradeClient  交易端口
   */
cardRead({
    visitId,
    oPFlag,
    scene,
    readCardType,
    isMobile,
    deptId,
    deptName,
    createOrgId,
    createOrgName,
    clientId,
    tradeClient
  }: {
    visitId: string
    oPFlag: string
    scene: number
    readCardType: string
    isMobile: boolean
    deptId: string
    deptName: string
    createOrgId: string
    createOrgName: string
    clientId: string
    tradeClient: string
  }): Promise<any>


/**
   * 预结算接口
   * @param isChsCharge 是否医保收费
   * @param settleType  结算类型 1 预约 2 挂号 3 缴费 4 取号
   * @param visitId   患者就诊id
   * @param oPFlag  1门诊 2住院
   * @param consumeAmount  金额
   * @param discount  优惠金额
   * @param discountReason  优惠原因
   * @param itemIds  项目ids
   * @param operateDeptId  操作科室ID
   * @param operateDeptName  操作科室名称
   * @param createOrgId  创建机构ID
   * @param createOrgName   创建机构名称
   */
  settlePre({
    isChsCharge,
    settleType,
    visitId,
    oPFlag,
    consumeAmount,
    discount,
    discountReason,
    itemIds,
    operateDeptId,
    operateDeptName,
    createOrgId,
    createOrgName
  }: {
    isChsCharge: boolean
    settleType: number
    visitId: string
    oPFlag: string
    consumeAmount: number
    discount: number
    discountReason: string
    itemIds: Array<string>
    operateDeptId: string
    operateDeptName: string
    createOrgId: string
    createOrgName: string
  }): Promise<any>

/**
   * 结算接口
   * @param settleType  结算类型 1 预约 2 挂号 3 缴费 4 取号
   * @param chargeApplyId   收费申请id
   * @param difference  补差金额
   * @param isOtherPay  是否他人代付
   * @param tradeChannelId  支付渠道id
   * @param clientId  客户端id
   */
  settle({
    settleType,
    chargeApplyId,
    difference,
    isOtherPay,
    tradeChannelId,
    clientId,
    tradeClient,
    tradeSubjectId
  }: {
    settleType: string
    chargeApplyId: string
    difference: number
    isOtherPay: number
    tradeChannelId: string
    clientId: string
    tradeClient: string
    tradeSubjectId: string
  }): Promise<any>


/**
   * 支付结果确认
   * @param payBillId   v7支付订单id
   * @param status   移动支付结果状态
   * @param thirdBillNo  移动支付三方流水号
   * @param chargeApplyId  收费申请id
   * @param payPlatformBillId  移动平台账单id
   */
  payResultConfirm({
    payBillId,
    status,
    thirdBillNo,
    chargeApplyId,
    payPlatformBillId
  }: {
    payBillId: string
    status: number
    thirdBillNo: string
    chargeApplyId: string
    payPlatformBillId: string
  }): Promise<any>

  /**
   * 取消结算
   * @param chargeApplyId  收费申请id
   */
  settleCancel({ chargeApplyId }: { chargeApplyId: string }): Promise<any>

```