跳转到主要内容
POST
/
ai
/
service
/
v1
/
medical_recognize
医疗票据v1接口识别
curl --request POST \
  --url https://api.textin.com/ai/service/v1/medical_recognize \
  --header 'Content-Type: application/octet-stream' \
  --header 'x-ti-app-id: <api-key>' \
  --header 'x-ti-secret-code: <api-key>'
{
  "code": 200,
  "message": "success",
  "duration": 100,
  "version": "v1.0.0",
  "result": {
    "success_count": 1,
    "page_count": 1,
    "ppi": 144,
    "image_list": [
      {
        "image_angle": 0,
        "rotated_image_width": 1000,
        "rotated_image_height": 3000,
        "page_id": 0,
        "image_base64": "",
        "image_position": [
          100,
          100,
          200,
          100,
          200,
          200,
          100,
          200
        ]
      }
    ],
    "object_list": [
      {
        "type": "medical_invoice",
        "page_ids": [
          0
        ],
        "image_ids": [
          0
        ],
        "details": {
          "invoice_information": {
            "document_title_name": {
              "value": "",
              "description": "单据标题名称"
            },
            "invoice_code": {
              "value": "",
              "description": "票据代码"
            },
            "invoice_number": {
              "value": "",
              "description": "票据号码"
            },
            "business_serial_number": {
              "value": "",
              "description": "业务流水号"
            },
            "bill_verification_code": {
              "value": "",
              "description": "票据校验码"
            },
            "issuance_date": {
              "value": "",
              "description": "开具日期"
            },
            "total_pages_of_invoice": {
              "value": "",
              "description": "票据总页数"
            },
            "current_page_number": {
              "value": "",
              "description": "当前页码"
            }
          },
          "patient_information": {
            "gender": {
              "value": "",
              "description": "性别"
            },
            "inpatient_number": {
              "value": "",
              "description": "住院号"
            },
            "medical_record_number": {
              "value": "",
              "description": "病历号"
            },
            "outpatient_number": {
              "value": "",
              "description": "门诊号"
            },
            "patient_medical_insurance_number": {
              "value": "",
              "description": "患者医保编号"
            },
            "patient_medical_insurance_type": {
              "value": "",
              "description": "患者医保类型"
            },
            "patient_social_security_card_number": {
              "value": "",
              "description": "患者社保卡号"
            }
          },
          "medical_visit_institution_information": {
            "name_of_medical_institution": {
              "value": "",
              "description": "医疗机构名称"
            },
            "type_of_medical_institution": {
              "value": "",
              "description": "医疗机构类型"
            },
            "department": {
              "value": "",
              "description": "科别"
            },
            "admission_time": {
              "value": "",
              "description": "入院时间"
            },
            "discharge_time": {
              "value": "",
              "description": "出院时间"
            },
            "hospitalization_days": {
              "value": "",
              "description": "住院天数"
            }
          },
          "expense_information": {
            "total_amount_in_words": {
              "value": "",
              "description": "大写合计金额"
            },
            "total_expense_amount": {
              "value": "",
              "description": "费用合计金额"
            },
            "personal_account_balance": {
              "value": "",
              "description": "个人账户余额"
            },
            "personal_self_payment_amount": {
              "value": "",
              "description": "个人自付金额"
            },
            "personal_self_funded_amount": {
              "value": "",
              "description": "个人自费金额"
            },
            "prepaid_amount": {
              "value": "",
              "description": "预缴金额"
            },
            "supplementary_payment_amount": {
              "value": "",
              "description": "补缴金额"
            },
            "refund_amount": {
              "value": "",
              "description": "退费金额"
            }
          },
          "payment_method": {
            "payee_unit": {
              "value": "",
              "description": "收款单位"
            },
            "payee": {
              "value": "",
              "description": "收款人"
            },
            "reviewer": {
              "value": "",
              "description": "复核人"
            },
            "payer": {
              "value": "",
              "description": "交款人"
            },
            "medical_insurance_overall_planning_payment": {
              "value": "",
              "description": "医保统筹支付"
            },
            "personal_account_payment": {
              "value": "",
              "description": "个人账户支付"
            },
            "personal_cash_payment": {
              "value": "",
              "description": "个人现金支付"
            },
            "other_payments": {
              "value": "",
              "description": "其他支付"
            }
          },
          "item_details": [
            [
              {
                "amount": {},
                "remarks": {},
                "project_name": {},
                "quantity": {},
                "unit_price": {},
                "project_code_symbol": {}
              }
            ]
          ]
        }
      }
    ]
  }
}

Authorizations

x-ti-app-id
string
header
required

登录Textin后前往 "工作台-账号设置-开发者信息" 查看 x-ti-app-id

x-ti-secret-code
string
header
required

登录Textin后前往 "工作台-账号设置-开发者信息" 查看 x-ti-secret-code

Query Parameters

crop_image
enum<integer>
default:0

选择是否需要进行图片切分,0关闭切分,1开启切分,默认为0

可用选项:
0,
1
return_image_base64
enum<integer>
default:0

选择是否需要输出图片base64,对应image_list中image_base64,0关闭,1开启,默认为0

可用选项:
0,
1
category
enum<integer>
default:0

指定样本类型,不进行样本分类,直接抽取结果,默认为0不使用该功能 1: 医疗发票识别 2: 医疗费用明细 3: 医疗费用结算单 4: 医疗处方单 5: 医疗检验报告单 6: 医疗诊断报告单

可用选项:
1,
2,
3,
4,
5,
6

Body

application/octet-stream · file

支持以下两种请求格式

  1. Content-Type: application/octet-stream

要上传的图片,目前支持jpg、png、bmp、pdf、tiff、ofd、单帧gif等大部分格式,ofd文件支持多页,多页pdf样本当前版本仅识别第一页内容。 请注意,请求体的数据格式为本地文件的二进制流,非 FormData 或其他格式。文件大小不超过 20M,图像宽高须介于 20 和 10000(像素)之间。

  1. Content-Type: text/plain

请求体的数据格式为文本,内容为在线文件的URL链接(支持http以及https协议)。在线文件大小不超过 20M,图像宽高须介于 20 和 10000(像素)之间。

The body is of type file.

Response

200 - application/json
code
enum<integer>
required

错误码

  • 200: success
  • 40101: x-ti-app-id 或 x-ti-secret-code 为空
  • 40102: x-ti-app-id 或 x-ti-secret-code 无效,验证失败
  • 40103: 客户端IP不在白名单
  • 40003: 余额不足,请充值后再使用
  • 40004: 参数错误,请查看技术文档,检查传参
  • 40007: 机器人不存在或未发布
  • 40008: 机器人未开通,请至市场开通后重试
  • 40301: 图片类型不支持
  • 40302: 上传文件大小不符,文件大小不超过 20M
  • 40303: 文件类型不支持,接口会返回实际检测到的文件类型
  • 40304: 图片尺寸不符,长宽比小于2的图片宽高需在20~20000像素范围内,其他图片的宽高需在20~10000像素范围内
  • 40305: 识别文件未上传
  • 40422: 文件损坏(The file is corrupted.)
  • 40423: PDF密码错误(Password required or incorrect password.)
  • 30203: 基础服务故障,请稍后重试
  • 500: 服务器内部错误
可用选项:
200,
40101,
40102,
40103,
40003,
40004,
40007,
40008,
40301,
40302,
40303,
40304,
40305,
40422,
40423,
30203,
500
Example:

200

message
string
required

错误信息

Example:

"success"

duration
integer

接口总耗时,单位为毫秒

Example:

100

version
string

接口版本

Example:

"v1.0.0"

result
object

样本识别结果