提交修改
This commit is contained in:
parent
bff956fc43
commit
2b7f184b1f
@ -11,15 +11,25 @@ import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.medical.MedicalInvoiceResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/***
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740580001377#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8C%BB%E7%96%97%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fmedical_invoice&method=post
|
||||
*
|
||||
*医疗发票识别
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持识别全国各地门诊/住院发票的全字段信息,包括业务流水号、发票号、姓名、性别、社保卡号、金额大/小写、收款单位、省市、医保统筹支付、个人账户支付等关键字段,及收费项目明细、各省直辖市的专有信息,
|
||||
* 其中北京/广东/河北/河南/江苏/山东/上海/天津/浙江等地区票据识别效果较佳。
|
||||
* 支持识别收费项目明细,并可根据不同省市地区返回对应的识别信息,同时支持收费项目信息的医保三目录信息核验,支持包括北京、上海、广州、深圳等21 个城市的医保三目录信息核验。
|
||||
*/
|
||||
|
||||
|
||||
@ -41,7 +51,90 @@ public class MedicalInvoiceController extends BaseController {
|
||||
ApiR<BMedicalInvoiceResp> bR = bMedicalInvoiceHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BMedicalInvoiceResp bMedicalInvoiceResp = bR.getData();
|
||||
BMedicalInvoiceResp.WordsResultDTO wordsResultDTO = bMedicalInvoiceResp.getWordsResult();
|
||||
|
||||
resp.setProvince(bMedicalInvoiceResp.getProvince()); // 省市:支持返回以下省市 , n北京/广东/河北/河南/江苏/山东/上海/天津/浙江等
|
||||
resp.setInvoiceType(bMedicalInvoiceResp.getInvoiceType()); //票据种类
|
||||
resp.setAmountInWords(wordsResultDTO.getAmountInWords().getWord()); //大写合计金额
|
||||
resp.setSex(wordsResultDTO.getAmountInWords().getWord()); //性别
|
||||
resp.setInsuranceType(wordsResultDTO.getInsuranceType().getWord()); //医保类型
|
||||
resp.setName(wordsResultDTO.getName().getWord()); //姓名
|
||||
resp.setSocialSecurityNum(wordsResultDTO.getSocialSecurityNum().getWord()); //社保卡号
|
||||
resp.setDischargeDate(wordsResultDTO.getDischargeDate().getWord()); //出院时间
|
||||
resp.setHospitalNum(wordsResultDTO.getHospitalNum().getWord()); // 住院号
|
||||
resp.setHospitalName(wordsResultDTO.getHospitalName().getWord()); //医院名称
|
||||
//地区字段:根据省市返回改地区特有的字段
|
||||
resp.setClinicNum(wordsResultDTO.getClinicNum().getWord()); // 门诊号
|
||||
resp.setAmountInFiguers(wordsResultDTO.getAmountInFiguers().getWord()); //小写合计金额
|
||||
resp.setAdmissionDate(wordsResultDTO.getAdmissionDate().getWord()); // 入院时间
|
||||
resp.setHospitalType(wordsResultDTO.getHospitalType().getWord()); //医疗机构类型
|
||||
resp.setRefundAmount(wordsResultDTO.getRefundAmount().getWord()); //退费金额
|
||||
resp.setDate(wordsResultDTO.getDate().getWord()); //开票日期
|
||||
resp.setChargingUnit(wordsResultDTO.getChargingUnit().getWord()); //收款单位
|
||||
resp.setPaymentAmount(wordsResultDTO.getPaymentAmount().getWord()); //补缴金额
|
||||
resp.setPrepayAmount(wordsResultDTO.getPaymentAmount().getWord()); // 预缴金额
|
||||
resp.setPersonalPayment(wordsResultDTO.getPersonalPayment().getWord()); //个人账户支付
|
||||
resp.setHospitalDay(wordsResultDTO.getHospitalDay().getWord()); //住院天数
|
||||
resp.setBusinessNum(wordsResultDTO.getBusinessNum().getWord()); //业务流水号
|
||||
resp.setInsurancePayment(wordsResultDTO.getInsurancePayment().getWord()); //医保统筹支付
|
||||
resp.setPayee(wordsResultDTO.getPayee().getWord()); //收款人
|
||||
resp.setRecordNum(wordsResultDTO.getRecordNum().getWord()); //病例号
|
||||
resp.setInvoiceNum(wordsResultDTO.getInvoiceNum().getWord()); //发票号码
|
||||
|
||||
List< List<MedicalInvoiceResp.CostDTO>> costCategories = new ArrayList<>();
|
||||
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCostCategories())){
|
||||
for (List<BMedicalInvoiceResp.WordsResultDTO.CostCategoriesDTO> costCategory : wordsResultDTO.getCostCategories()) {
|
||||
List<MedicalInvoiceResp.CostDTO> cost = new ArrayList<>();
|
||||
for (BMedicalInvoiceResp.WordsResultDTO.CostCategoriesDTO costCategoriesDTO : costCategory) {
|
||||
MedicalInvoiceResp.CostDTO costDTO = new MedicalInvoiceResp.CostDTO();
|
||||
costDTO.setName(costCategoriesDTO.getName()); //字段名,包括:收费项目、金额
|
||||
costDTO.setWord(costCategoriesDTO.getWord()); //name字段对应的识别结果
|
||||
costDTO.setMediInfo(costCategoriesDTO.getMediInfo()); //医保目录查询结果,**当 medi_query 参数存在时,仅在「收费项目」的数组里返回,**以下参数同此说明
|
||||
costDTO.setMediCheck(costCategoriesDTO.getMediCheck()); //查询是否成功,“1”表示成功,“0”表示不成功
|
||||
costDTO.setMediName(costCategoriesDTO.getMediName()); //药品名
|
||||
costDTO.setMediType(costCategoriesDTO.getMediType()); //医保类别
|
||||
costDTO.setMediRegion(costCategoriesDTO.getMediRegion()); //医保目录的城市
|
||||
costDTO.setMediCode(costCategoriesDTO.getMediCode()); // 药品编码
|
||||
costDTO.setMediRegister(costCategoriesDTO.getMediRegister()); // 药品注册号
|
||||
cost.add(costDTO);
|
||||
}
|
||||
costCategories.add(cost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resp.setCostCategories(costCategories); //项目大类:治疗费、检查费等项目大类
|
||||
List<MedicalInvoiceResp.CostDTO> regionSupplement = new ArrayList<>(); //地区字段:根据省市返回改地区特有的字段
|
||||
if(CollectionUtils.isNotEmpty(wordsResultDTO.getRegionSupplement())){
|
||||
for (BMedicalInvoiceResp.WordsResultDTO.RegionSupplementDTO regionSupplementDTO : wordsResultDTO.getRegionSupplement()) {
|
||||
MedicalInvoiceResp.CostDTO costDTO = new MedicalInvoiceResp.CostDTO();
|
||||
costDTO.setName(regionSupplementDTO.getName());
|
||||
costDTO.setWord(regionSupplementDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setRegionSupplement(regionSupplement);
|
||||
List<List<MedicalInvoiceResp.CostDTO>> costDetail = new ArrayList<>(); //明细类别:药物/检查的明细类别
|
||||
|
||||
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCostDetail())){
|
||||
for (List<BMedicalInvoiceResp.WordsResultDTO.CostDetailDTO> costDetailList : wordsResultDTO.getCostDetail()) {
|
||||
List<MedicalInvoiceResp.CostDTO> cost = new ArrayList<>();
|
||||
for (BMedicalInvoiceResp.WordsResultDTO.CostDetailDTO costCategoriesDTO : costDetailList) {
|
||||
MedicalInvoiceResp.CostDTO costDTO = new MedicalInvoiceResp.CostDTO();
|
||||
costDTO.setName(costCategoriesDTO.getName()); //字段名,包括:收费项目、金额
|
||||
costDTO.setWord(costCategoriesDTO.getWord()); //name字段对应的识别结果
|
||||
costDTO.setMediInfo(costCategoriesDTO.getMediInfo()); //医保目录查询结果,**当 medi_query 参数存在时,仅在「收费项目」的数组里返回,**以下参数同此说明
|
||||
costDTO.setMediCheck(costCategoriesDTO.getMediCheck()); //查询是否成功,“1”表示成功,“0”表示不成功
|
||||
costDTO.setMediName(costCategoriesDTO.getMediName()); //药品名
|
||||
costDTO.setMediType(costCategoriesDTO.getMediType()); //医保类别
|
||||
costDTO.setMediRegion(costCategoriesDTO.getMediRegion()); //医保目录的城市
|
||||
costDTO.setMediCode(costCategoriesDTO.getMediCode()); // 药品编码
|
||||
costDTO.setMediRegister(costCategoriesDTO.getMediRegister()); // 药品注册号
|
||||
cost.add(costDTO);
|
||||
}
|
||||
costDetail.add(cost);
|
||||
}
|
||||
}
|
||||
resp.setCostDetail(costDetail); //明细类别:药物/检查的明细类别
|
||||
|
||||
}
|
||||
return R.error();
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
package com.heyu.api.controller.medical;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.medical.BMedicalOutpatientHandle;
|
||||
import com.heyu.api.baidu.request.medical.BMedicalOutpatientRequest;
|
||||
import com.heyu.api.baidu.response.medical.BMedicalOutpatientResp;
|
||||
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.resp.medical.MedicalOutpatientResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740582423627#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8C%BB%E7%96%97%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fmedical_outpatient&method=post
|
||||
*门诊病历识别
|
||||
*
|
||||
*接口描述
|
||||
* 支持识别全国各地各医院门诊病历的姓名、日期、诊断、检查、主诉、现病史 6个关键字段,及表格区清单项目名称、规格、单价、数量、金额、项目类型等字段。
|
||||
*/
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/medical")
|
||||
@NotIntercept
|
||||
public class MedicalOutpatientController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BMedicalOutpatientHandle bMedicalOutpatientHandle;
|
||||
|
||||
|
||||
@RequestMapping("/outpatient")
|
||||
@CacheResult
|
||||
public R outpatient(BMedicalOutpatientRequest req) {
|
||||
|
||||
MedicalOutpatientResp resp = new MedicalOutpatientResp();
|
||||
|
||||
ApiR<BMedicalOutpatientResp> bR = bMedicalOutpatientHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
|
||||
BMedicalOutpatientResp bMedicalOutpatientResp = bR.getData();
|
||||
BMedicalOutpatientResp.WordsResultDTO wordsResultDTO = bMedicalOutpatientResp.getWordsResult();
|
||||
|
||||
|
||||
List<MedicalOutpatientResp.DataDTO> commonData = new ArrayList<>();
|
||||
|
||||
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommonData())){
|
||||
for (BMedicalOutpatientResp.WordsResultDTO.CommonDataDTO commonDatum : wordsResultDTO.getCommonData()) {
|
||||
MedicalOutpatientResp.DataDTO dataDTO = new MedicalOutpatientResp.DataDTO();
|
||||
dataDTO.setWordName(commonDatum.getWordName());
|
||||
dataDTO.setWord(commonDatum.getWord());
|
||||
commonData.add(dataDTO);
|
||||
}
|
||||
}
|
||||
resp.setCommonData(commonData);
|
||||
|
||||
List<List<MedicalOutpatientResp.DataDTO>> costDetail = new ArrayList<>();
|
||||
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCostDetail())){
|
||||
for (List<BMedicalOutpatientResp.WordsResultDTO.CostDetailDTO> costDetailDTOS : wordsResultDTO.getCostDetail()) {
|
||||
List<MedicalOutpatientResp.DataDTO> dataDTO = new ArrayList<>();
|
||||
for (BMedicalOutpatientResp.WordsResultDTO.CostDetailDTO costDetailDTO : costDetailDTOS) {
|
||||
MedicalOutpatientResp.DataDTO dataDTO1 = new MedicalOutpatientResp.DataDTO();
|
||||
dataDTO1.setWordName(costDetailDTO.getWordName());
|
||||
dataDTO1.setWord(costDetailDTO.getWord());
|
||||
dataDTO.add(dataDTO1);
|
||||
}
|
||||
costDetail.add(dataDTO);
|
||||
}
|
||||
}
|
||||
resp.setCostDetail(costDetail);
|
||||
}
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.heyu.api.controller.medical;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.medical.BMedicalPrescriptionHandle;
|
||||
import com.heyu.api.baidu.request.medical.BMedicalPrescriptionRequest;
|
||||
import com.heyu.api.baidu.response.medical.BMedicalPrescriptionResp;
|
||||
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.resp.medical.MedicalOutpatientResp;
|
||||
import com.heyu.api.resp.medical.MedicalPrescriptionResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/***
|
||||
*
|
||||
*
|
||||
*
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740582532897#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8C%BB%E7%96%97%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fmedical_prescription&method=post
|
||||
*
|
||||
*处方笺识别
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持识别全国各地各医院处方笺的姓名、日期、病人ID、科别 4个关键字段,及表格区清单项目名称、规格、单价、数量、金额、频率、用量、用法等字段。
|
||||
*
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/medical")
|
||||
@NotIntercept
|
||||
public class MedicalPrescriptionController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BMedicalPrescriptionHandle bMedicalPrescriptionHandle;
|
||||
|
||||
|
||||
@RequestMapping("/prescription")
|
||||
@CacheResult
|
||||
public R prescription(BMedicalPrescriptionRequest req) {
|
||||
MedicalPrescriptionResp resp = new MedicalPrescriptionResp();
|
||||
|
||||
ApiR<BMedicalPrescriptionResp> bR = bMedicalPrescriptionHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
|
||||
BMedicalPrescriptionResp bMedicalPrescriptionResp = bR.getData();
|
||||
BMedicalPrescriptionResp.WordsResultDTO wordsResultDTO = bMedicalPrescriptionResp.getWordsResult();
|
||||
|
||||
|
||||
List<MedicalOutpatientResp.DataDTO> commonData = new ArrayList<>();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getCommonData())) {
|
||||
for (BMedicalPrescriptionResp.WordsResultDTO.CommonDataDTO commonDatum : wordsResultDTO.getCommonData()) {
|
||||
MedicalOutpatientResp.DataDTO dataDTO = new MedicalOutpatientResp.DataDTO();
|
||||
dataDTO.setWordName(commonDatum.getWordName());
|
||||
dataDTO.setWord(commonDatum.getWord());
|
||||
commonData.add(dataDTO);
|
||||
}
|
||||
}
|
||||
resp.setCommonData(commonData);
|
||||
|
||||
List<List<MedicalOutpatientResp.DataDTO>> costDetail = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getCostDetail())) {
|
||||
|
||||
for (List<BMedicalPrescriptionResp.WordsResultDTO.CostDetailDTO> costDetailDTOS : wordsResultDTO.getCostDetail()) {
|
||||
|
||||
List<MedicalOutpatientResp.DataDTO> dataDTO = new ArrayList<>();
|
||||
for (BMedicalPrescriptionResp.WordsResultDTO.CostDetailDTO costDetailDTO : costDetailDTOS) {
|
||||
MedicalOutpatientResp.DataDTO dataDTO1 = new MedicalOutpatientResp.DataDTO();
|
||||
dataDTO1.setWordName(costDetailDTO.getWordName());
|
||||
dataDTO1.setWord(costDetailDTO.getWord());
|
||||
dataDTO.add(dataDTO1);
|
||||
}
|
||||
costDetail.add(dataDTO);
|
||||
}
|
||||
}
|
||||
resp.setCostDetail(costDetail);
|
||||
}
|
||||
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.heyu.api.controller.medical;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.medical.BMedicalRecordHandle;
|
||||
import com.heyu.api.baidu.request.medical.BMedicalRecordRequest;
|
||||
import com.heyu.api.baidu.response.medical.BMedicalRecordResp;
|
||||
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.resp.medical.MedicalRecordResp;
|
||||
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/?_=1740575657628×tamp=1740581634871#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8C%BB%E7%96%97%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fmedical_record&method=post
|
||||
*
|
||||
* 病案首页识别
|
||||
*
|
||||
*接口描述
|
||||
* 支持识别全国各地病案首页的病案号、姓名、性别、出生日期、身份证号、出/入院科别、住院次数、药物过敏情况等 15 个关键字段,其中北京地区票据识别效果最佳
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/medical")
|
||||
@NotIntercept
|
||||
public class MedicalRecordController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BMedicalRecordHandle bMedicalRecordHandle;
|
||||
|
||||
|
||||
@RequestMapping("/record")
|
||||
@CacheResult
|
||||
public R record(BMedicalRecordRequest req) {
|
||||
MedicalRecordResp resp = new MedicalRecordResp();
|
||||
ApiR<BMedicalRecordResp> bR = bMedicalRecordHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BMedicalRecordResp bMedicalRecordResp = bR.getData();
|
||||
BMedicalRecordResp.WordsResultDTO wordsResultDTO = bMedicalRecordResp.getWordsResult();
|
||||
resp.setNation(wordsResultDTO.getNation().getWord()); //民族
|
||||
resp.setAllergy(wordsResultDTO.getAllergy().getWord()); //药物过敏
|
||||
resp.setSex(wordsResultDTO.getSex().getWord()); // 性别
|
||||
resp.setBirthday(wordsResultDTO.getBirthday().getWord()); //出生日期
|
||||
resp.setNationality(wordsResultDTO.getNationality().getWord()); //国籍
|
||||
resp.setName(wordsResultDTO.getName().getWord()); //姓名
|
||||
resp.setMaritalStatus(wordsResultDTO.getMaritalStatus().getWord()); //婚姻
|
||||
resp.setHospitalDay(wordsResultDTO.getHospitalDay().getWord()); //住院次数
|
||||
resp.setAdmissionDepartment(wordsResultDTO.getAdmissionDepartment().getWord()); // 入院科别
|
||||
resp.setId(wordsResultDTO.getId().getWord()); //身份证号
|
||||
resp.setDischargeDepartment(wordsResultDTO.getDischargeDepartment().getWord()); //出院科别
|
||||
resp.setCareer(wordsResultDTO.getCareer().getWord()); // 职业
|
||||
resp.setAge(wordsResultDTO.getAge().getWord()); //年龄
|
||||
resp.setBloodType(wordsResultDTO.getAge().getWord()); //血型、Rh血型、ABO血型
|
||||
resp.setRecordNum(wordsResultDTO.getRecordNum().getWord()); // 病案号
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.heyu.api.controller.medical;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.medical.BMedicalReportDetectionHandle;
|
||||
import com.heyu.api.baidu.request.medical.BMedicalReportDetectionRequest;
|
||||
import com.heyu.api.baidu.response.medical.BMedicalReportDetectionResp;
|
||||
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.resp.medical.MedicalReportDetectionResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740581217710#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8C%BB%E7%96%97%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fmedical_report_detection&method=post
|
||||
* <p>
|
||||
* <p>
|
||||
* 医疗检验报告单识别
|
||||
*
|
||||
*接口描述
|
||||
* 支持识别全国各地医疗检验报告单的姓名、性别、医院名称、报告单名称等关键字段,支持识别检查具体项目的项目名称、结果、单位、参考区间、结果提示等明细字段。
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/medical")
|
||||
@NotIntercept
|
||||
public class MedicalReportDetectionController {
|
||||
|
||||
@Autowired
|
||||
private BMedicalReportDetectionHandle bMedicalReportDetectionHandle;
|
||||
|
||||
|
||||
@RequestMapping("/reportDetection")
|
||||
@CacheResult
|
||||
public R reportDetection(BMedicalReportDetectionRequest req) {
|
||||
MedicalReportDetectionResp resp = new MedicalReportDetectionResp();
|
||||
|
||||
ApiR<BMedicalReportDetectionResp> bR = bMedicalReportDetectionHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BMedicalReportDetectionResp bMedicalReportDetectionResp = bR.getData();
|
||||
BMedicalReportDetectionResp.WordsResultDTO wordsResultDTO = bMedicalReportDetectionResp.getWordsResult();
|
||||
|
||||
|
||||
List<List<MedicalReportDetectionResp.DataDTO>> item = new ArrayList<>(); // 检查项目
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getItem())) {
|
||||
for (List<BMedicalReportDetectionResp.WordsResultDTO.ItemDTO> itemDTOS : wordsResultDTO.getItem()) {
|
||||
List<MedicalReportDetectionResp.DataDTO> dataDTOS = new ArrayList<>();
|
||||
for (BMedicalReportDetectionResp.WordsResultDTO.ItemDTO itemDTO : itemDTOS) {
|
||||
MedicalReportDetectionResp.DataDTO tempDataDTO = new MedicalReportDetectionResp.DataDTO();
|
||||
tempDataDTO.setWord(itemDTO.getWord());
|
||||
tempDataDTO.setWordName(itemDTO.getWordName());
|
||||
dataDTOS.add(tempDataDTO);
|
||||
}
|
||||
item.add(dataDTOS);
|
||||
}
|
||||
}
|
||||
List<MedicalReportDetectionResp.DataDTO> commonData = new ArrayList<>(); // 患者具体信息
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getCommonData())) {
|
||||
for (BMedicalReportDetectionResp.WordsResultDTO.CommonDataDTO commonDatum : wordsResultDTO.getCommonData()) {
|
||||
MedicalReportDetectionResp.DataDTO tempDataDTO = new MedicalReportDetectionResp.DataDTO();
|
||||
tempDataDTO.setWord(commonDatum.getWord());
|
||||
tempDataDTO.setWordName(commonDatum.getWordName());
|
||||
commonData.add(tempDataDTO);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
resp.setItem(item);
|
||||
resp.setCommonData(commonData);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.heyu.api.controller.medical;
|
||||
|
||||
import com.heyu.api.baidu.handle.medical.BMedicalStatementHandle;
|
||||
import com.heyu.api.baidu.request.medical.BMedicalStatementRequest;
|
||||
import com.heyu.api.baidu.response.medical.BMedicalStatementResp;
|
||||
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.resp.medical.MedicalStatementResp;
|
||||
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/?_=1740575657628×tamp=1740581091562#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8C%BB%E7%96%97%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fmedical_statement&method=post
|
||||
* <p>
|
||||
* 医疗费用结算单识别
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持识别全国医疗费用结算单的姓名、出/入院时间、发票总金额、自费金额、医保支付金额等 6 个关键字段,其中北京地区票据识别效果最佳。
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/medical")
|
||||
@NotIntercept
|
||||
public class MedicalStatementController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BMedicalStatementHandle bMedicalStatementHandle;
|
||||
|
||||
|
||||
@RequestMapping("/statement")
|
||||
@CacheResult
|
||||
public R statement(BMedicalStatementRequest req) {
|
||||
|
||||
MedicalStatementResp resp = new MedicalStatementResp();
|
||||
|
||||
ApiR<BMedicalStatementResp> bR = bMedicalStatementHandle.handle(req);
|
||||
|
||||
|
||||
if (bR.isSuccess()) {
|
||||
|
||||
BMedicalStatementResp bMedicalStatementResp = bR.getData();
|
||||
BMedicalStatementResp.WordResultDTO wordResultDTO = bMedicalStatementResp.getWordResult();
|
||||
|
||||
|
||||
resp.setAmountInFiguers(wordResultDTO.getAmountInFiguers().getWord()); //发票总金额
|
||||
resp.setMedicalInsuranceAmount(wordResultDTO.getMedicalInsuranceAmount().getWord()); // 医保支付
|
||||
resp.setSelfPaymentAmount(wordResultDTO.getSelfPaymentAmount().getWord()); // 全自费
|
||||
resp.setAdmissionDate(wordResultDTO.getAdmissionDate().getWord()); //入院时间
|
||||
resp.setDischargeDate(wordResultDTO.getDischargeDate().getWord()); //出院时间
|
||||
resp.setName(wordResultDTO.getName().getWord()); //姓名
|
||||
|
||||
return R.ok().setData(resp);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
}
|
||||
@ -50,9 +50,6 @@ public class MedicalInvoiceResp extends BaseResp {
|
||||
private String mediRegion; //医保目录的城市
|
||||
private String mediCode; // 药品编码
|
||||
private String mediRegister; // 药品注册号
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.heyu.api.resp.medical;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MedicalOutpatientResp extends BaseResp {
|
||||
|
||||
private List<DataDTO> commonData; //患者个人信息
|
||||
|
||||
private List<List<DataDTO>> costDetail; // 具体项目
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class DataDTO {
|
||||
private String wordName; //字段名,详见下方表格区说明
|
||||
private String word; //word_name字段对应的识别结果
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.heyu.api.resp.medical;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MedicalPrescriptionResp extends BaseResp {
|
||||
|
||||
|
||||
|
||||
|
||||
private List<MedicalOutpatientResp.DataDTO> commonData; //患者个人信息
|
||||
|
||||
private List<List<MedicalOutpatientResp.DataDTO>> costDetail; // 具体项目
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class DataDTO {
|
||||
|
||||
private String wordName; //字段名,详见下方表格区说明
|
||||
private String word; //word_name字段对应的识别结果
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.heyu.api.resp.medical;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MedicalRecordResp extends BaseResp {
|
||||
private String nation; //民族
|
||||
private String allergy; //药物过敏
|
||||
private String sex; // 性别
|
||||
private String birthday; //出生日期
|
||||
private String nationality; //国籍
|
||||
private String name; //姓名
|
||||
private String maritalStatus; //婚姻
|
||||
private String hospitalDay; //住院次数
|
||||
private String admissionDepartment; // 入院科别
|
||||
private String id; //身份证号
|
||||
private String dischargeDepartment; //出院科别
|
||||
private String career; // 职业
|
||||
private String age; //年龄
|
||||
private String bloodType; //血型、Rh血型、ABO血型
|
||||
private String recordNum; // 病案号
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.heyu.api.resp.medical;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MedicalReportDetectionResp extends BaseResp {
|
||||
|
||||
private List<List<DataDTO>> item; // 检查项目
|
||||
private List<DataDTO> commonData; // 患者具体信息
|
||||
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class DataDTO {
|
||||
private String wordName; //字段名,详见下方表格区说明
|
||||
private String word; //word_name字段对应的识别结果
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.heyu.api.resp.medical;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MedicalStatementResp extends BaseResp {
|
||||
|
||||
private String amountInFiguers; //发票总金额
|
||||
private String medicalInsuranceAmount; // 医保支付
|
||||
private String selfPaymentAmount; // 全自费
|
||||
private String admissionDate; //入院时间
|
||||
private String dischargeDate; //出院时间
|
||||
private String name; //姓名
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user