提交修改

This commit is contained in:
quyixiao 2025-03-21 20:08:54 +08:00
parent 2fe680f3d1
commit 3467c4547b
7 changed files with 615 additions and 0 deletions

View File

@ -1,8 +1,10 @@
package com.heyu.api.baidu.response.certificate;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.heyu.api.baidu.response.BBaseResp;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
@ -83,10 +85,218 @@ import lombok.Data;
* "words_result_num": 22
* }
*/
@NoArgsConstructor
@Data
public class BBouseholdRegisterResp extends BBaseResp {
@JsonProperty("words_result")
private WordsResultDTO wordsResult;
@JsonProperty("log_id")
private String logId;
@JsonProperty("words_result_num")
private Integer wordsResultNum;
@NoArgsConstructor
@Data
public static class WordsResultDTO {
@JsonProperty("Nation")
private NationDTO nation;
@JsonProperty("Sex")
private SexDTO sex;
@JsonProperty("Birthday")
private BirthdayDTO birthday;
@JsonProperty("Date")
private DateDTO date;
@JsonProperty("BirthAddress")
private BirthAddressDTO birthAddress;
@JsonProperty("Name")
private NameDTO name;
@JsonProperty("FormerName")
private FormerNameDTO formerName;
@JsonProperty("HouseholdNum")
private HouseholdNumDTO householdNum;
@JsonProperty("WWToCity")
private WWToCityDTO wWToCity;
@JsonProperty("WWHere")
private WWHereDTO wWHere;
@JsonProperty("CardNo")
private CardNoDTO cardNo;
@JsonProperty("Education")
private EducationDTO education;
@JsonProperty("Relationship")
private RelationshipDTO relationship;
@JsonProperty("Height")
private HeightDTO height;
@JsonProperty("Career")
private CareerDTO career;
@JsonProperty("WorkAddress")
private WorkAddressDTO workAddress;
@JsonProperty("Hometown")
private HometownDTO hometown;
@JsonProperty("OtherAddress")
private OtherAddressDTO otherAddress;
@JsonProperty("Belief")
private BeliefDTO belief;
@JsonProperty("BloodType")
private BloodTypeDTO bloodType;
@JsonProperty("MaritalStatus")
private MaritalStatusDTO maritalStatus;
@JsonProperty("VeteranStatus")
private VeteranStatusDTO veteranStatus;
@NoArgsConstructor
@Data
public static class NationDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class SexDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class BirthdayDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class DateDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class BirthAddressDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class NameDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class FormerNameDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class HouseholdNumDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class WWToCityDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class WWHereDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class CardNoDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class EducationDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class RelationshipDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class HeightDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class CareerDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class WorkAddressDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class HometownDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class OtherAddressDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class BeliefDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class BloodTypeDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class MaritalStatusDTO {
@JsonProperty("words")
private String words;
}
@NoArgsConstructor
@Data
public static class VeteranStatusDTO {
@JsonProperty("words")
private String words;
}
}
}

View File

@ -0,0 +1,84 @@
package com.heyu.api.controller.certificate;
import com.heyu.api.baidu.handle.certificate.BBirthCertificateHandle;
import com.heyu.api.baidu.request.certificate.BBirthCertificateRequest;
import com.heyu.api.baidu.response.certificate.BBirthCertificateResp;
import com.heyu.api.controller.BaseController;
import com.heyu.api.data.annotation.CacheResult;
import com.heyu.api.data.annotation.NotIntercept;
import com.heyu.api.data.utils.ApiR;
import com.heyu.api.data.utils.R;
import com.heyu.api.request.certificate.BirthCertificateReq;
import com.heyu.api.resp.certificate.BirthCertificateResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1740309618781#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Fbirth_certificate&method=post
* <p>
* <p>
* 出生医学证明识别
*
*接口描述
* 支持对出生医学证明的23个关键字段进行结构化识别包括新生儿姓名性别出生时间父亲姓名母亲姓名出生证编号等
*
*/
@Slf4j
@RestController
@RequestMapping("/birth")
@NotIntercept
public class BirthCertificateController extends BaseController {
@Autowired
private BBirthCertificateHandle birthCertificateHandle;
@RequestMapping("/certificate")
@CacheResult
public R recognize(BirthCertificateReq request) {
BirthCertificateResp resp = new BirthCertificateResp();
BBirthCertificateRequest birthCertificateRequest = new BBirthCertificateRequest();
birthCertificateRequest.setImageBase64(request.getImageBase64());
birthCertificateRequest.setImageUrl(request.getImageUrl());
ApiR<BBirthCertificateResp> bR = birthCertificateHandle.handle(birthCertificateRequest);
if(bR.isSuccess()){
BBirthCertificateResp bBirthCertificateResp = bR.getData();
BBirthCertificateResp.WordsResultDTO wordsResultDTO = bBirthCertificateResp.getWordsResult();
resp.setBirthProvince(wordsResultDTO.getBirthProvince().getWords());
resp.setBirthWeight(wordsResultDTO.getBirthWeight().getWords());
resp.setMotherNationality(wordsResultDTO.getMotherNationality().getWords());
resp.setFatherAddress(wordsResultDTO.getFatherAddress().getWords());
resp.setMotherEthnic(wordsResultDTO.getMotherEthnic().getWords());
resp.setMotherAddress(wordsResultDTO.getMotherAddress().getWords());
resp.setCode(wordsResultDTO.getCode().getWords());
resp.setBabySex(wordsResultDTO.getBabySex().getWords());
resp.setBirthCity(wordsResultDTO.getBirthCity().getWords());
resp.setBabyBirthday(wordsResultDTO.getBabyBirthday().getWords());
resp.setBabyName(wordsResultDTO.getBabyName().getWords());
resp.setFatherAge(wordsResultDTO.getFatherAge().getWords());
resp.setFatherEthnic(wordsResultDTO.getFatherEthnic().getWords());
resp.setMotherName(wordsResultDTO.getMotherName().getWords());
resp.setMotherIdNumber(wordsResultDTO.getMotherID().getWords());
resp.setBirthLength(wordsResultDTO.getBirthLength().getWords());
resp.setGestationalAge(wordsResultDTO.getGestationalAge().getWords());
resp.setBirthCity(wordsResultDTO.getBirthCity().getWords());
resp.setMotherAge(wordsResultDTO.getMotherAge().getWords());
resp.setHospital(wordsResultDTO.getHospital().getWords());
resp.setFatherNationality(wordsResultDTO.getFatherNationality().getWords());
resp.setFatherIdNumber(wordsResultDTO.getFatherID().getWords());
resp.setFatherName(wordsResultDTO.getFatherName().getWords());
return R.ok().setData(resp);
}
return R.error(bR.getErrorMsg());
}
}

View File

@ -0,0 +1,87 @@
package com.heyu.api.controller.certificate;
import com.heyu.api.baidu.handle.certificate.BBouseholdRegisterHandle;
import com.heyu.api.baidu.request.certificate.BBouseholdRegisterRequest;
import com.heyu.api.baidu.response.certificate.BBouseholdRegisterResp;
import com.heyu.api.data.annotation.CacheResult;
import com.heyu.api.data.annotation.NotIntercept;
import com.heyu.api.data.utils.ApiR;
import com.heyu.api.data.utils.R;
import com.heyu.api.request.certificate.BouseholdRegisterReq;
import com.heyu.api.resp.certificate.BouseholdRegisterResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1740309163756#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Fhousehold_register&method=post
* <p>
* <p>
* 户口本识别
* <p>
* 接口描述
* 支持对户口本内常住人口登记卡的全部 22 个字段包括户号姓名与户主关系性别出生地民族出生日期身份证号本市县其他住址曾用名籍贯宗教信仰身高血型文化程度婚姻状况兵役状况服务处所职业何时由何地迁往本市何时由何地迁往本址登记日期
* <p>
* 支持对户口本内户主页的5个字段进行结构化识别包括户别户主姓名户号住址户主页时间
*/
@Slf4j
@RestController
@RequestMapping("/bousehold")
@NotIntercept
public class BouseholdRegisterController {
@Autowired
private BBouseholdRegisterHandle bBouseholdRegisterHandle;
@RequestMapping("/recognize")
@CacheResult
public R recognize(BouseholdRegisterReq request) {
BouseholdRegisterResp resp = new BouseholdRegisterResp();
BBouseholdRegisterRequest bBouseholdRegisterRequest = new BBouseholdRegisterRequest();
bBouseholdRegisterRequest.setHouseholdRegisterSide(request.getHouseholdRegisterSide());
bBouseholdRegisterRequest.setImageBase64(request.getImageBase64());
bBouseholdRegisterRequest.setImageUrl(request.getImageUrl());
ApiR<BBouseholdRegisterResp> bR = bBouseholdRegisterHandle.handle(bBouseholdRegisterRequest);
if (bR.isSuccess()) {
BBouseholdRegisterResp bBouseholdRegisterResp = bR.getData();
BBouseholdRegisterResp.WordsResultDTO wordsResultDTO = bBouseholdRegisterResp.getWordsResult();
resp.setNation(wordsResultDTO.getNation().getWords());
resp.setSex(wordsResultDTO.getSex().getWords());
resp.setBirthday(wordsResultDTO.getBirthday().getWords());
resp.setDate(wordsResultDTO.getDate().getWords());
resp.setBirthAddress(wordsResultDTO.getBirthAddress().getWords());
resp.setName(wordsResultDTO.getName().getWords());
resp.setFormerName(wordsResultDTO.getFormerName().getWords());
resp.setHouseholdNum(wordsResultDTO.getHouseholdNum().getWords());
resp.setWWToCity(wordsResultDTO.getWWToCity().getWords());
resp.setWWHere(wordsResultDTO.getWWHere().getWords());
resp.setCardNo(wordsResultDTO.getCardNo().getWords());
resp.setEducation(wordsResultDTO.getEducation().getWords());
resp.setRelationship(wordsResultDTO.getRelationship().getWords());
resp.setHeight(wordsResultDTO.getHeight().getWords());
resp.setCareer(wordsResultDTO.getCareer().getWords());
resp.setWorkAddress(wordsResultDTO.getWorkAddress().getWords());
resp.setHometown(wordsResultDTO.getHometown().getWords());
resp.setOtherAddress(wordsResultDTO.getOtherAddress().getWords());
resp.setOtherAddress(wordsResultDTO.getOtherAddress().getWords());
resp.setBelief(wordsResultDTO.getBelief().getWords());
resp.setBloodType(wordsResultDTO.getBloodType().getWords());
resp.setMaritalStatus(wordsResultDTO.getMaritalStatus().getWords());
resp.setVeteranStatus(wordsResultDTO.getVeteranStatus().getWords());
return R.ok().setData(resp);
}
return R.error(bR.getErrorMsg());
}
}

View File

@ -0,0 +1,9 @@
package com.heyu.api.request.certificate;
import com.heyu.api.request.CommonReq;
import lombok.Data;
@Data
public class BirthCertificateReq extends CommonReq {
}

View File

@ -0,0 +1,19 @@
package com.heyu.api.request.certificate;
import com.heyu.api.request.CommonReq;
import lombok.Data;
@Data
public class BouseholdRegisterReq extends CommonReq {
/**
* -subpage默认值常住人口登记卡成员页
* -homepage户主页
*/
private String householdRegisterSide = "subpage";
}

View File

@ -0,0 +1,105 @@
package com.heyu.api.resp.certificate;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
@Data
public class BirthCertificateResp extends BaseResp {
/***
* 出生地点_省
*/
private String birthProvince;
/***
*出生体重
*/
private String birthWeight;
/**
* 母亲国籍
*/
private String motherNationality;
/**
* 父亲住址
*/
private String fatherAddress;
/***
* 母亲民族
*/
private String motherEthnic;
/***
* 母亲地址
*/
private String motherAddress;
/**
* 出生证编号
*/
private String code;
/***
* 性别
*/
private String babySex;
/***
* 出生地点_县
*/
private String birthCounty;
/***
* 出生时间
*/
private String babyBirthday;
/***
* 姓名
*/
private String babyName;
/**
* 父亲年龄
*/
private String fatherAge;
/**
* 父亲民族
*/
private String fatherEthnic;
/**
* 母亲姓名
*/
private String motherName;
/**
* 母亲身份证号
*/
private String motherIdNumber;
/**
* 出生身长
*/
private String birthLength;
/**
* 出生孕周
*/
private String gestationalAge;
/**
* 出生地点_市
*/
private String birthCity;
/**
* 母亲年龄
*/
private String motherAge;
/**
* 出生医院/医疗机构名称
*/
private String hospital;
/**
* 父亲国籍
*/
private String fatherNationality;
/**
* 父亲身份证号
*/
private String fatherIdNumber;
/**
* 父亲姓名
*/
private String fatherName;
}

View File

@ -0,0 +1,101 @@
package com.heyu.api.resp.certificate;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
@Data
public class BouseholdRegisterResp extends BaseResp {
/**
* 民族
*/
private String nation;
/**
*性别
*/
private String sex;
/**
* 生日
*/
private String birthday;
/**
* 登记日期
*/
private String date;
/**
* 出生地
*/
private String birthAddress;
/**
* 姓名
*/
private String name;
/**
* 曾用名
*/
private String formerName;
/**
* 户号
*/
private String householdNum;
/**
* 何时由何地迁来本市()
*/
private String wWToCity;
/**
* 何时由何地迁往本址
*/
private String wWHere;
/**
* 身份证号
*/
private String cardNo;
/**
* 文化程度
*/
private String education;
/**
* 户主或与户主关系
*/
private String relationship;
/**
* 身高
*/
private String height;
/**
* 职业
*/
private String career;
/**
* 服务处所
*/
private String workAddress;
/**
* 籍贯
*/
private String hometown;
/**
* 本市其他住址
*/
private String otherAddress;
/**
* 宗教信仰
*/
private String belief;
/**
* 血型
*/
private String bloodType;
/**
* 婚姻状况
*/
private String maritalStatus;
/**
* 兵役状况
*/
private String veteranStatus;
}