电子保单识别接口

接口描述

用户通过发送HTTP Post请求方式提交数据至公有云服务器,服务器识别并返回json格式的识别结果。

接口说明

请求URL:http://api.exocr.com/ocr/v1/e_policy

请求方式:HTTP Post

返回格式:json

参数
Content-Type 使用二进制方式时,为multipart/form-data;使用base64和url方式时,为application/x-www-form-urlencoded

请求参数

参数 必选 类型 说明
app_key string 请在控制台->我的应用中获取
app_secret string 请在控制台->我的应用中获取
image_base64 string 图像base64编码。image_base64、image_url、image_binary三个参数中至少选择一个,读取优先级从前到后依次降低。如:同时选择了以上三个参数,则以image_base64图像为准。
image_url string 图像url地址。image_base64、image_url、image_binary三个参数中至少选择一个,读取优先级从前到后依次降低。如:同时选择了以上三个参数,则以image_base64图像为准。
image_binary data 图像二进制。image_base64、image_url、image_binary三个参数中至少选择一个,读取优先级从前到后依次降低。如:同时选择了以上三个参数,则以image_base64图像为准。

调用示例

java(相关依赖库下载)

package com.exocr.httpclient;



import java.io.File;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.IOException;

import java.io.InputStream;

import java.util.HashMap;

import java.util.Map;



import com.exocr.common.utils.HttpClientUtils;



public class Test {



  public static void main(String[] args) throws FileNotFoundException {

   /**

    * base64

    */

   //识别url

   String url = " http://api.exocr.com/ocr/v1/e_invoice";

   //设置请求参数

   Map<String, String> params = new HashMap<String, String>();

   params.put("app_key", "#####");

   params.put("app_secret", "#####");

   //设置识别图像base64编码

   params.put("image_base64", "base64ImageStr");

   //发送请求,得到识别结果

   String result = HttpClientUtils.doPost(url, params);

   System.*out*.println(result);

   /**

    * url

    */

   //设置请求参数、识别图像url

   params.put("app_key", "#####");

   params.put("app_secret", "#####");

   params.put("image_url", "imageUrl");

   //发送请求,得到识别结果

   result = HttpClientUtils.doPost(url, params);

   System.*out*.println(result);

   /**

    * 二进制

    */

   //设置请求参数

   params.put("app_key", "#####");

   params.put("app_secret", "#####");

   //拿到本地图像,写入数据流

   File file = new File("/Users/mac/logs/test.png");

   InputStream in = new FileInputStream(file);

   //设置数据流

   Map<String, InputStream> streamMap = new HashMap<String, InputStream>();

   streamMap.put("image_binary", in);

   //发送请求,得到识别结果

   result = HttpClientUtils.doPostStream(url, params, streamMap);

   //关闭io流

   try {

     in.close();

   } catch (IOException e) {

     e.printStackTrace();

   }

   System.*out*.println(result);

  }

}

返回示例

{

  "result":{

    "machine_no":{

      "words":"66###748",

      "score":1,

      "position":{

        "left":123,

        "top":150,

        "width":171,

        "height":23

      },

      "chinese_key":"机器编号"

    },

    "invoice_code":{

      "words":"011001800111",

      "score":1,

      "position":{

        "left":1069,

        "top":28,

        "width":165,

        "height":22

      },

      "chinese_key":"发票代码"

    },

    "invoice_no":{

      "words":"25###62",

      "score":1,

      "position":{

        "left":1072,

        "top":68,

        "width":122,

        "height":24

      },

      "chinese_key":"发票号码"

    },

    "create_date":{

      "words":"2018年02月10日",

      "score":1,

      "position":{

        "left":1087,

        "top":110,

        "width":205,

        "height":24

      },

      "chinese_key":"开票日期"

    },

    "buyer_name":{

      "words":"##公司",

      "score":1,

      "position":{

        "left":252,

        "top":197,

        "width":259,

        "height":28

      },

      "chinese_key":"购方名称"

    },

    "buyer_tax_no":{

      "words":"91110##897136",

      "score":1,

      "position":{

        "left":254,

        "top":235,

        "width":285,

        "height":26

      },

      "chinese_key":"购方纳税人识别号"

    },

    "buyer_address":{

      "words":"",

      "score":1,

      "position":{

        "left":87,

        "top":173,

        "width":774,

        "height":168

      },

      "chinese_key":"购方地址电话"

    },

    "buyer_bank_info":{

      "words":"",

      "score":1,

      "position":{

        "left":87,

        "top":173,

        "width":774,

        "height":168

      },

      "chinese_key":"购方开户行及账号"

    },

    "seller_name":{

      "words":"##公司",

      "score":1,

      "position":{

        "left":250,

        "top":688,

        "width":259,

        "height":28

      },

      "chinese_key":"销方名称"

    },

    "seller_tax_no":{

      "words":"9111##X48",

      "score":1,

      "position":{

        "left":218,

        "top":723,

        "width":339,

        "height":29

      },

       "chinese_key":"销方纳税人识别号"

    },

    "seller_address":{

      "words":"##",

      "score":1,

      "position":{

        "left":205,

        "top":756,

        "width":564,

        "height":25

      },

      "chinese_key":"销方地址电话"

    },

    "seller_bank_info":{

      "words":"##",

      "score":1,

      "position":{

        "left":195,

        "top":789,

        "width":546,

        "height":24

      },

      "chinese_key":"销方开户行及账号"

    },

    "amount_big":{

      "words":"⨂肆拾贰圆捌角",

      "score":1,

      "position":{

        "left":415,

        "top":644,

        "width":157,

        "height":26

      },

      "chinese_key":"价税合计(大写)"

    },

    "amount_small":{

      "words":"42.80",

      "score":1,

      "position":{

        "left":1120,

        "top":646,

        "width":86,

        "height":24

      },

      "chinese_key":"价税合计(小写)"

    },

    "total":{

      "words":"¥36.58",

      "score":1,

      "position":{

        "left":1027,

        "top":607,

        "width":96,

        "height":26

      },

      "chinese_key":"合计金额"

    },

    "total_tax":{

      "words":"¥6.22",

      "score":1,

      "position":{

        "left":1306,

        "top":610,

        "width":77,

        "height":20

      },

      "chinese_key":"合计税额"

    },

    "receiver":{

      "words":"京东商城",

      "score":1,

      "position":{

        "left":151,

        "top":833,

        "width":88,

        "height":24

      },

      "chinese_key":"收款人"

    },

    "check":{

      "words":"",

      "score":1,

      "position":{

        "left":503,

        "top":813,

        "width":230,

        "height":111

      },

      "chinese_key":"复核"

    },

    "creator":{

      "words":"京东商城",

      "score":1,

      "position":{

        "left":811,

        "top":833,

        "width":89,

        "height":24

      },

      "chinese_key":"开票人"

    }

  },

  "error_code":0,

  "description":"识别成功",

  "request_id":"BD49ECD33B62479DB7DDF614845F306A",

  "recognize_time":1345,

  "available_count":9997

}

返回说明

通用参数

参数 类型 说明
result array 返回结果数组,包括所有字段的识别信息
error_code int 错误码,返回0为正确,其他为错误
description string 识别结果描述
request_id string 请求唯一标识符
recognize_time int 识别所用时间,单位为毫秒
available_count int 识别剩余可用次数,次数不足时无法继续识别,可在控制台进行充值次数

电子保单识别特有参数

参数 类型 说明
insurance_details List 保险详情列表,每条承保险种为一个元素
amount Object 保险金额
type Object 承保险种
insurant Object 被保险人
plate_no Object 号牌号码
brand Object 厂牌型号
vin Object 车架号
engine_no Object 发动机号
passenger_capacity Object 核定载客
load_capacity Object 核定载质量
first_reg_date Object 初次登记日期
character Object 使用性质
annual_mileage Object 年平均行驶里程
vehicle_type Object 机动车种类
fee_big Object 保险费合计(大写)
fee_small Object 保险费合计(小写)
period Object 保险期间
beneficiary Object 第一受益人
company_name Object 保险公司名称
chinese_key String 该字段中文含义
words String 识别结果
score Float 照片可信度,取值范围为0~1
quad String 四个顶点坐标,依次为左上,右上,右下,左下四个点的坐标值
position Object 位置矩形框,以左上角为基准,距离左侧,上侧,右侧矩形框长度,下侧矩形框长度
no string 编号
displacement string 排量
power string 功率
template_name object 保险单名称
policy_number object 保险单号
left int 位置值,距离原图左侧距离x,单位为像素
top int 位置值,距离原图上方距离y,单位为像素
width int 位置值,字段所在图框宽度w,单位为像素
height int 位置值,字段所在图框高度h,单位为像素
Copyright © 2020 易道博识 all right reserved,powered by Gitbook该文件修订时间: 2023-12-04 14:10:10

results matching ""

    No results matching ""