跳转到主要内容
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>' \
  --data '"success"'
import requests

url = "https://api.textin.com/ai/service/v1/medical_recognize"

payload = "success"
headers = {
"x-ti-app-id": "<api-key>",
"x-ti-secret-code": "<api-key>",
"Content-Type": "application/octet-stream"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'x-ti-app-id': '<api-key>',
'x-ti-secret-code': '<api-key>',
'Content-Type': 'application/octet-stream'
},
body: JSON.stringify('success')
};

fetch('https://api.textin.com/ai/service/v1/medical_recognize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.textin.com/ai/service/v1/medical_recognize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode('success'),
CURLOPT_HTTPHEADER => [
"Content-Type: application/octet-stream",
"x-ti-app-id: <api-key>",
"x-ti-secret-code: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.textin.com/ai/service/v1/medical_recognize"

payload := strings.NewReader("\"success\"")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-ti-app-id", "<api-key>")
req.Header.Add("x-ti-secret-code", "<api-key>")
req.Header.Add("Content-Type", "application/octet-stream")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.textin.com/ai/service/v1/medical_recognize")
.header("x-ti-app-id", "<api-key>")
.header("x-ti-secret-code", "<api-key>")
.header("Content-Type", "application/octet-stream")
.body("\"success\"")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.textin.com/ai/service/v1/medical_recognize")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<api-key>'
request["x-ti-secret-code"] = '<api-key>'
request["Content-Type"] = 'application/octet-stream'
request.body = "\"success\""

response = http.request(request)
puts response.read_body
{
  "code": 200,
  "message": "success",
  "duration": 100,
  "version": "v1.3.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_position": [
          100,
          100,
          200,
          100,
          200,
          200,
          100,
          200
        ],
        "image_base64": ""
      }
    ],
    "object_list": [
      {
        "fields": [
          {
            "value": "住院发票",
            "label": "单据标题名称",
            "bounding_regions": [
              {
                "page_id": 0,
                "image_id": 0,
                "value": "",
                "position": [
                  100,
                  100,
                  200,
                  100,
                  200,
                  200,
                  100,
                  200
                ],
                "char_pos": [
                  [
                    100,
                    100,
                    200,
                    100,
                    200,
                    200,
                    100,
                    200
                  ]
                ]
              }
            ],
            "key": "document_title_name",
            "type": "invoice_information"
          }
        ],
        "tables": [
          {
            "name": "expense_item_summary_table",
            "label": "费目金额汇总表",
            "items": [
              [
                {
                  "value": "住院发票",
                  "label": "单据标题名称",
                  "bounding_regions": [
                    {
                      "page_id": 0,
                      "image_id": 0,
                      "value": "",
                      "position": [
                        100,
                        100,
                        200,
                        100,
                        200,
                        200,
                        100,
                        200
                      ],
                      "char_pos": [
                        [
                          100,
                          100,
                          200,
                          100,
                          200,
                          200,
                          100,
                          200
                        ]
                      ]
                    }
                  ],
                  "key": "project_name"
                }
              ]
            ]
          }
        ],
        "page_ids": [
          0
        ],
        "image_ids": [
          0
        ]
      }
    ]
  }
}

授权

x-ti-app-id
string
header
必填

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

x-ti-secret-code
string
header
必填

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

查询参数

crop_image
enum<integer>
默认值:0

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

可用选项:
0,
1
return_image_base64
enum<integer>
默认值:0

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

可用选项:
0,
1
category
enum<integer>
默认值:0

指定样本类型,不进行样本分类,直接抽取结果,默认为0不使用该功能 1: 医疗住院收费票据(纸质) 2: 医疗门诊收费票据(纸质) 3: 医疗住院收费票据(电子) 4: 医疗门诊收费票据(电子) 5: 医保结算单 6: 医疗费用明细 7: 医疗处方笺 8: 实验室检验报告 9: 影像学检查报告 10: 门急诊病历 11: 出院小结 12: 诊断证明书 13: 入院记录 14: 病理报告 15: 体检报告 16: 病案首页 17: 手术记录单

可用选项:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17
coord_restore
enum<integer>
默认值:0

调整各字段的返回坐标逻辑,1代表坐标以原图为基准,0代表坐标以切图后转正图为基准,默认为0

可用选项:
0,
1
is_same_file
enum<integer>
默认值:0

PDF是否为一个整份文件,开启则不再对每一页进行单独切图和分类

可用选项:
0,
1

请求体

application/octet-stream

要上传的图片,目前支持jpg, png, bmp, pdf, tiff, ofd, webp, 单帧gif等大部分格式.

The body is of type file.

响应

200 - application/json
code
enum<integer>
必填

错误码

  • 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
示例:

200

message
string
必填

错误信息

示例:

"success"

duration
integer
必填

接口总耗时,单位为毫秒

示例:

100

version
string
必填

接口版本

示例:

"v1.3.0"

result
object
必填

样本识别结果