在架构的强迫下,提交了一堆没写完的bug

segment2.0
zhanglb 2 years ago
parent 92c8e88559
commit bc3ff687f6

@ -1,81 +0,0 @@
package com.docus.server.api.segmentation;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
/**
* API
*
* @author AutoGenerator
* @since 2023-08-21
*/
@FeignClient(value = "docus-segmentation", contextId = "docus-segmentation.OcrSpRuleApi")
@RequestMapping("/ocr/SpRule")
public interface OcrSpRuleApi {
/**
*
*
* @param id id
* @return
*/
@GetMapping("/find/{id}")
OcrSpRuleVO findById(@PathVariable(value = "id") Long id);
/**
*
*
* @return
*/
@GetMapping("/findAll")
List<OcrSpRuleVO> findAll();
/**
*
*
* @param searchDTO
* @return
*/
@PostMapping("/search")
PageResult<OcrSpRuleVO> search(@RequestBody SearchDTO searchDTO);
/**
*
*
* @param addOcrSpRuleDTO
*/
@PostMapping("/add")
boolean add(@RequestBody AddOcrSpRuleDTO addOcrSpRuleDTO);
/**
*
*
* @param editOcrSpRuleDTO
*/
@PutMapping("/edit")
boolean edit(@RequestBody EditOcrSpRuleDTO editOcrSpRuleDTO);
/**
*
*
* @param deleteOcrSpRuleDTO
* @return
*/
@DeleteMapping("/delete")
int delete(@RequestBody DeleteOcrSpRuleDTO deleteOcrSpRuleDTO);
}

@ -1,44 +0,0 @@
package com.docus.server.dto.segmentation.ocrsprule;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.docus.server.enums.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
*
* AddDTO
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="AddOcrSpRuleDTO对象", description="特殊策略表")
public class AddOcrSpRuleDTO implements Serializable {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "")
private String assortId;
@ApiModelProperty(value = "规则开始json")
private String startJson;
@ApiModelProperty(value = "规则结束json")
private String endJson;
}

@ -1,34 +0,0 @@
package com.docus.server.dto.segmentation.ocrsprule;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.docus.server.enums.*;
import java.io.Serializable;
import java.util.List;
/**
*
* DeleteDTO
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="DeleteOcrSpRuleDTO对象", description="特殊策略表")
public class DeleteOcrSpRuleDTO implements Serializable {
@ApiModelProperty(value = "ids")
private List<Long> ids;
}

@ -1,44 +0,0 @@
package com.docus.server.dto.segmentation.ocrsprule;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.docus.server.enums.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
*
* EditDTO
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="EditOcrSpRuleDTO对象", description="特殊策略表")
public class EditOcrSpRuleDTO implements Serializable {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "")
private String assortId;
@ApiModelProperty(value = "规则开始json")
private String startJson;
@ApiModelProperty(value = "规则结束json")
private String endJson;
}

@ -0,0 +1,28 @@
package com.docus.server.entity.segmentation;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class OcrRuleJson {
@ApiModelProperty(value = "分段id")
private String assortId;
@ApiModelProperty(value = "分段名称")
private String assortName;
@ApiModelProperty(value = "占比分")
private Integer matchRatio;
@ApiModelProperty(value = "匹配关键词 多个#分割")
private String keyWord;
@ApiModelProperty(value = "排序")
private Integer sort;
}

@ -0,0 +1,13 @@
package com.docus.server.entity.segmentation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OcrRuleResult {
@ApiModelProperty(value = "id")
private Long id;
}

@ -1,49 +0,0 @@
package com.docus.server.entity.segmentation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
*
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("ocr_sp_rule")
@ApiModel(value = "OcrSpRule对象", description = "特殊策略表")
public class OcrSpRule implements Serializable {
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private Long id;
@ApiModelProperty(value = "")
@TableField("assort_id")
private String assortId;
@ApiModelProperty(value = "规则开始json")
@TableField("start_json")
private String startJson;
@ApiModelProperty(value = "规则结束json")
@TableField("end_json")
private String endJson;
}

@ -0,0 +1,13 @@
package com.docus.server.entity.segmentation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OcrSpecialResult {
@ApiModelProperty(value = "id")
private Long id;
}

@ -0,0 +1,19 @@
package com.docus.server.entity.segmentation;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class OcrSpecialRuleJson {
@ApiModelProperty(value = "命中分数")
private Integer score;
@ApiModelProperty(value = "匹配关键词 多个#分割")
private String keyWord;
}

@ -1,44 +0,0 @@
package com.docus.server.vo.segmentation.ocrsprule;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.docus.server.enums.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
*
* VO
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="OcrSpRuleVO对象", description="特殊策略表")
public class OcrSpRuleVO implements Serializable {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "")
private String assortId;
@ApiModelProperty(value = "规则开始json")
private String startJson;
@ApiModelProperty(value = "规则结束json")
private String endJson;
}

@ -1,100 +0,0 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.segmentation.OcrSpRuleApi;
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
import com.docus.server.service.IOcrSpRuleService;
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Api(value = "特殊策略表", tags = "特殊策略表")
@RestController
public class OcrSpRuleController implements OcrSpRuleApi {
@Resource
private IOcrSpRuleService iOcrSpRuleService;
/**
*
*
* @param id Id
* @return
*/
@ApiOperation("按主键查询")
@Override
public OcrSpRuleVO findById(Long id) {
return iOcrSpRuleService.findById(id);
}
/**
*
*
* @return
*/
@ApiOperation("查询所有")
@Override
public List<OcrSpRuleVO> findAll() {
return iOcrSpRuleService.findAll();
}
/**
*
*
* @param searchDTO
* @return
*/
@ApiOperation("关键字搜索")
@Override
public PageResult<OcrSpRuleVO> search(SearchDTO searchDTO) {
return iOcrSpRuleService.search(searchDTO);
}
/**
*
*
* @param addOcrSpRuleDTO
* @return
*/
@ApiOperation("新增")
@Override
public boolean add(AddOcrSpRuleDTO addOcrSpRuleDTO) {
return iOcrSpRuleService.add(addOcrSpRuleDTO);
}
/**
*
*
* @param editOcrSpRuleDTO
* @return
*/
@ApiOperation("编辑")
@Override
public boolean edit(EditOcrSpRuleDTO editOcrSpRuleDTO) {
return iOcrSpRuleService.edit(editOcrSpRuleDTO);
}
/**
*
*
* @param deleteOcrSpRuleDTO
* @return
*/
@ApiOperation("批量删除")
@Override
public int delete(DeleteOcrSpRuleDTO deleteOcrSpRuleDTO) {
return iOcrSpRuleService.delete(deleteOcrSpRuleDTO);
}
}

@ -1,49 +0,0 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.segmentation.OcrSpRule;
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Mapper
public interface OcrSpRuleConvert {
OcrSpRuleConvert INSTANCE = Mappers.getMapper(OcrSpRuleConvert.class);
@Mappings({})
OcrSpRule convertDO(AddOcrSpRuleDTO addOcrSpRuleDTO);
@Mappings({})
OcrSpRule convertDO(EditOcrSpRuleDTO editOcrSpRuleDTO);
@Mappings({})
List<OcrSpRule> convertAddDOList(List<AddOcrSpRuleDTO> addOcrSpRuleDTO);
@Mappings({})
List<OcrSpRule> convertEditDOList(List<EditOcrSpRuleDTO> editOcrSpRuleDTO);
@Mappings({})
OcrSpRuleVO convertVO(OcrSpRule ocrSpRule);
@Mappings({})
List<OcrSpRuleVO> convertVO(List<OcrSpRule> ocrSpRuleList);
@Mappings({})
PageResult<OcrSpRuleVO> convertVO(PageResult<OcrSpRule> pageResult);
}

@ -14,6 +14,9 @@ import java.util.List;
* @since 2023-08-29 * @since 2023-08-29
*/ */
public interface IOcrFileInfoTestDao extends IBaseDao<OcrFileInfoTest> { public interface IOcrFileInfoTestDao extends IBaseDao<OcrFileInfoTest> {
/** /**
* *
* *

@ -1,65 +0,0 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.segmentation.OcrSpRule;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-08-21
*/
public interface IOcrSpRuleDao extends IBaseDao<OcrSpRule> {
/**
*
*
* @param id id
* @return
*/
OcrSpRule findById(Long id);
/**
*
*
* @param ocrSpRule
* @return
*/
boolean add(OcrSpRule ocrSpRule);
/**
*
*
* @param ocrSpRule
* @return
*/
boolean edit(OcrSpRule ocrSpRule);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<OcrSpRule> search(SearchDTO searchDTO);
/**
*
*
* @param id
* @param name
* @return
*/
int findByIdAndName(Long id, String name);
}

@ -23,6 +23,7 @@ import java.util.List;
@Repository @Repository
public class OcrFileInfoTestDaoImpl extends BaseDaoImpl<OcrFileInfoTestMapper, OcrFileInfoTest> implements IOcrFileInfoTestDao { public class OcrFileInfoTestDaoImpl extends BaseDaoImpl<OcrFileInfoTestMapper, OcrFileInfoTest> implements IOcrFileInfoTestDao {
/** /**
* *
* *

@ -1,123 +0,0 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.segmentation.OcrSpRule;
import com.docus.server.infrastructure.dao.IOcrSpRuleDao;
import com.docus.server.infrastructure.mapper.OcrSpRuleMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Repository
public class OcrSpRuleDaoImpl extends BaseDaoImpl<OcrSpRuleMapper, OcrSpRule> implements IOcrSpRuleDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public OcrSpRule findById(Long id) {
return super.findById(id);
}
/**
*
*
* @param ocrSpRule
* @return
*/
@Override
public boolean add(OcrSpRule ocrSpRule) {
return super.save(ocrSpRule);
}
/**
*
*
* @param ocrSpRule
* @return
*/
@Override
public boolean edit(OcrSpRule ocrSpRule) {
return super.updateById(ocrSpRule);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<OcrSpRule> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<OcrSpRule> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
// query.ge(OcrSpRule::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
// query.le(OcrSpRule::getCreateTime, endTime);
}
//关键字比较多个列or
//if (!StringUtils.isEmpty(searchDTO.getKeyword())) {
//单个列用like
//query. like(OcrSpRule::getxxx, searchDTO.getKeyword());
//多个列用like
//query. and(sub -> sub.like(OcrSpRule::getxx1, searchDTO.getKeyword())
// оr(). like(OcrSpRule::getXX2, searchDTO.getKeyword()))
//);
//}
//默认createTime倒序排序
// query.orderByDesc(OcrSpRule::getCreateTime);
List<OcrSpRule> list = super.find(query);
return new PageResult<>(list);
}
/**
*
*
* @param id
* @param name
* @return
*/
@Override
public int findByIdAndName(Long id, String name) {
LambdaQueryWrapper<OcrSpRule> query = Wrappers.lambdaQuery();
if (id != null) {
query.ne(OcrSpRule::getId, id);
}
//if (Func.isNotBlank(name)) {
// query.eq(OcrSpRule::getName, name);
//}
return baseMapper.selectCount(query);
}
}

@ -1,17 +0,0 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.segmentation.OcrSpRule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Mapper
public interface OcrSpRuleMapper extends BaseMapper<OcrSpRule> {
}

@ -5,6 +5,7 @@ import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.segmentation.ocrruletest.AddOcrRuleTestDTO; import com.docus.server.dto.segmentation.ocrruletest.AddOcrRuleTestDTO;
import com.docus.server.dto.segmentation.ocrruletest.DeleteOcrRuleTestDTO; import com.docus.server.dto.segmentation.ocrruletest.DeleteOcrRuleTestDTO;
import com.docus.server.dto.segmentation.ocrruletest.EditOcrRuleTestDTO; import com.docus.server.dto.segmentation.ocrruletest.EditOcrRuleTestDTO;
import com.docus.server.entity.segmentation.OcrRuleResult;
import com.docus.server.vo.segmentation.ocrruletest.OcrRuleTestVO; import com.docus.server.vo.segmentation.ocrruletest.OcrRuleTestVO;
import java.util.List; import java.util.List;
@ -16,6 +17,14 @@ import java.util.List;
* @since 2023-08-29 * @since 2023-08-29
*/ */
public interface IOcrRuleTestService { public interface IOcrRuleTestService {
/**
*
* @param text
* @return
*/
OcrRuleResult handleSpecialRule(String text);
/** /**
* *
* *

@ -1,65 +0,0 @@
package com.docus.server.service;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-08-21
*/
public interface IOcrSpRuleService {
/**
*
*
* @param id id
* @return
*/
OcrSpRuleVO findById(Long id);
/**
*
*
* @return
*/
List<OcrSpRuleVO> findAll();
/**
*
*
* @param addOcrSpRuleDTO
* @return
*/
boolean add(AddOcrSpRuleDTO addOcrSpRuleDTO);
/**
*
*
* @param editOcrSpRuleDTO
* @return
*/
boolean edit(EditOcrSpRuleDTO editOcrSpRuleDTO);
/**
*
*
* @param deleteOcrSpRuleDTO
* @return
*/
int delete(DeleteOcrSpRuleDTO deleteOcrSpRuleDTO);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<OcrSpRuleVO> search(SearchDTO searchDTO);
}

@ -5,6 +5,7 @@ import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.segmentation.ocrspecialruletest.AddOcrSpecialRuleTestDTO; import com.docus.server.dto.segmentation.ocrspecialruletest.AddOcrSpecialRuleTestDTO;
import com.docus.server.dto.segmentation.ocrspecialruletest.DeleteOcrSpecialRuleTestDTO; import com.docus.server.dto.segmentation.ocrspecialruletest.DeleteOcrSpecialRuleTestDTO;
import com.docus.server.dto.segmentation.ocrspecialruletest.EditOcrSpecialRuleTestDTO; import com.docus.server.dto.segmentation.ocrspecialruletest.EditOcrSpecialRuleTestDTO;
import com.docus.server.entity.segmentation.OcrSpecialResult;
import com.docus.server.vo.segmentation.ocrspecialruletest.OcrSpecialRuleTestVO; import com.docus.server.vo.segmentation.ocrspecialruletest.OcrSpecialRuleTestVO;
import java.util.List; import java.util.List;
@ -16,6 +17,23 @@ import java.util.List;
* @since 2023-08-29 * @since 2023-08-29
*/ */
public interface IOcrSpecialRuleTestService { public interface IOcrSpecialRuleTestService {
/**
*
* @param ocrTextList
* @return
*/
OcrSpecialResult handleSpecialRule(List<String> ocrTextList);
/**
*
* @param result
* @return
*/
boolean handleSpecialRule(OcrSpecialResult result,String text);
/** /**
* *
* *

@ -2,6 +2,10 @@ package com.docus.server.service.handler;
import com.docus.log.annotation.TrackRetryListener; import com.docus.log.annotation.TrackRetryListener;
import com.docus.server.api.ocr.OcrApi; import com.docus.server.api.ocr.OcrApi;
import com.docus.server.entity.segmentation.OcrFileInfoTest;
import com.docus.server.entity.segmentation.OcrSpecialResult;
import com.docus.server.infrastructure.dao.IOcrFileInfoTestDao;
import com.docus.server.service.IOcrSpecialRuleTestService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -14,10 +18,29 @@ import java.util.List;
public class StartOcrTestHandler { public class StartOcrTestHandler {
@Resource @Resource
private OcrApi ocrApi; private OcrApi ocrApi;
@Resource
private IOcrFileInfoTestDao iOcrFileInfoTestDao;
@Resource
private IOcrSpecialRuleTestService iOcrSpecialRuleTestService;
@TrackRetryListener("START_OCR_TEST") @TrackRetryListener("START_OCR_TEST")
public void startOcr(String patientId) { public void startOcr(String patientId) {
System.out.println(patientId); //根据病案号查询文件列表
List<String> text = ocrApi.getText("D:\\docus\\cut\\segmentation\\20230822\\c6b03e5767814895a2c155c32f174051\\麻醉.jpg"); List<OcrFileInfoTest> fileInfoTestList = iOcrFileInfoTestDao.findBy("patientId",patientId);
for (OcrFileInfoTest fileInfoTest:fileInfoTestList) {
//遍历文件列表 获取ocr识别结果
List<String> ocrTextList = ocrApi.getText(fileInfoTest.getPicCutUrl());
//优先判断是否特殊规则开始
OcrSpecialResult ocrSpecialResult = iOcrSpecialRuleTestService.handleSpecialRule(ocrTextList);
//判断是否属于某个分段
//更新文件数据的分段
}
//更新数据库表
} }
} }

@ -7,6 +7,7 @@ import com.docus.server.convert.OcrRuleTestConvert;
import com.docus.server.dto.segmentation.ocrruletest.AddOcrRuleTestDTO; import com.docus.server.dto.segmentation.ocrruletest.AddOcrRuleTestDTO;
import com.docus.server.dto.segmentation.ocrruletest.DeleteOcrRuleTestDTO; import com.docus.server.dto.segmentation.ocrruletest.DeleteOcrRuleTestDTO;
import com.docus.server.dto.segmentation.ocrruletest.EditOcrRuleTestDTO; import com.docus.server.dto.segmentation.ocrruletest.EditOcrRuleTestDTO;
import com.docus.server.entity.segmentation.OcrRuleResult;
import com.docus.server.entity.segmentation.OcrRuleTest; import com.docus.server.entity.segmentation.OcrRuleTest;
import com.docus.server.infrastructure.dao.IOcrRuleTestDao; import com.docus.server.infrastructure.dao.IOcrRuleTestDao;
import com.docus.server.service.IOcrRuleTestService; import com.docus.server.service.IOcrRuleTestService;
@ -30,6 +31,21 @@ public class OcrRuleTestServiceImpl implements IOcrRuleTestService {
@Resource @Resource
private IdService idService; private IdService idService;
@Override
public OcrRuleResult handleSpecialRule(String text) {
//查询所有规则列表
//判断是否包含
//判断命中率
return null;
}
/** /**
* *
* *

@ -1,145 +0,0 @@
package com.docus.server.service.impl;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.convert.OcrSpRuleConvert;
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
import com.docus.server.entity.segmentation.OcrSpRule;
import com.docus.server.infrastructure.dao.IOcrSpRuleDao;
import com.docus.server.service.IOcrSpRuleService;
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-08-21
*/
@Service
public class OcrSpRuleServiceImpl implements IOcrSpRuleService {
@Resource
private IOcrSpRuleDao iOcrSpRuleDao;
@Resource
private IdService idService;
/**
*
*
* @param id Id
* @return
*/
@Override
public OcrSpRuleVO findById(Long id) {
return OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.findById(id));
}
/**
*
*
* @return
*/
@Override
public List<OcrSpRuleVO> findAll() {
return OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.findAll());
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<OcrSpRuleVO> search(SearchDTO searchDTO) {
return OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.search(searchDTO));
//PageResult<OcrSpRuleVO> result = OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.search(searchDTO));
//if (CollectionUtils.isEmpty(result.getList())) {
//return new PageResult<>();
//}
//Map<String, SchSystemParams> map = iSchSystemParamsService.find(ListUtils.distinctSelect(result.getList(), SchCollectorVO::getCollectorId));
//result.getList().forEach(p -> {
// String collectorId = String.valueOf(p.getCollectorId());
// if (map.containsKey(collectorId)) {
// p.setCollectorName(map.get(collectorId).getParamName());
// }
//});
//return result;
}
/**
*
*
* @param addOcrSpRuleDTO
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean add(AddOcrSpRuleDTO addOcrSpRuleDTO) {
OcrSpRule ocrSpRule = OcrSpRuleConvert.INSTANCE.convertDO(addOcrSpRuleDTO);
ocrSpRule.setId(idService.getDateSeq());
return iOcrSpRuleDao.add(ocrSpRule);
// String name = addOcrSpRuleDTO.getName();
//OcrSpRule ocrSpRule = iOcrSpRuleDao.findOneBy("name", name);
//if (Func.notNull(ocrSpRule)) {
// throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "特殊策略表已经存在");
// }
// OcrSpRule ocrSpRule =OcrSpRuleConvert.INSTANCE.convertDO(addOcrSpRuleDTO);
// ocrSpRule.setId(idService.getDateSeq());
// return iOcrSpRuleDao.add(schCollector);
}
/**
*
*
* @param editOcrSpRuleDTO
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean edit(EditOcrSpRuleDTO editOcrSpRuleDTO) {
OcrSpRule ocrSpRule = OcrSpRuleConvert.INSTANCE.convertDO(editOcrSpRuleDTO);
return iOcrSpRuleDao.edit(ocrSpRule);
// Long id = editOcrSpRuleDTO.getId();
// OcrSpRule ocrSpRule = iOcrSpRuleDao.findById(id);
// if (Func.isNull(ocrSpRule)) {
// throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "特殊策略表,无法更新!");
// }
// ocrSpRule.setUpdateTime(LocalDateTime.now());
// return iOcrSpRuleDao.edit(ocrSpRule);
}
/**
*
*
* @param deleteOcrSpRuleDTO
* @return
*/
@Override
public int delete(DeleteOcrSpRuleDTO deleteOcrSpRuleDTO) {
return iOcrSpRuleDao.delete(deleteOcrSpRuleDTO.getIds());
}
}

@ -7,6 +7,7 @@ import com.docus.server.convert.OcrSpecialRuleTestConvert;
import com.docus.server.dto.segmentation.ocrspecialruletest.AddOcrSpecialRuleTestDTO; import com.docus.server.dto.segmentation.ocrspecialruletest.AddOcrSpecialRuleTestDTO;
import com.docus.server.dto.segmentation.ocrspecialruletest.DeleteOcrSpecialRuleTestDTO; import com.docus.server.dto.segmentation.ocrspecialruletest.DeleteOcrSpecialRuleTestDTO;
import com.docus.server.dto.segmentation.ocrspecialruletest.EditOcrSpecialRuleTestDTO; import com.docus.server.dto.segmentation.ocrspecialruletest.EditOcrSpecialRuleTestDTO;
import com.docus.server.entity.segmentation.OcrSpecialResult;
import com.docus.server.entity.segmentation.OcrSpecialRuleTest; import com.docus.server.entity.segmentation.OcrSpecialRuleTest;
import com.docus.server.infrastructure.dao.IOcrSpecialRuleTestDao; import com.docus.server.infrastructure.dao.IOcrSpecialRuleTestDao;
import com.docus.server.service.IOcrSpecialRuleTestService; import com.docus.server.service.IOcrSpecialRuleTestService;
@ -30,6 +31,34 @@ public class OcrSpecialRuleTestServiceImpl implements IOcrSpecialRuleTestService
@Resource @Resource
private IdService idService; private IdService idService;
@Override
public OcrSpecialResult handleSpecialRule(List<String> ocrTextList) {
// 查询所以的特殊规则列表
//判断是否符合某个条件的开始条件
//默认返回空对象
return null;
}
@Override
public boolean handleSpecialRule(OcrSpecialResult result,String text) {
//获取结束条件列表
//判断得分占比
//返回结束
//默认返回没结束
return false;
}
/** /**
* *
* *

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.infrastructure.mapper.OcrSpRuleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap"
type="com.docus.server.entity.segmentation.OcrSpRule">
<id column="id" property="id"/>
<result column="assort_id" property="assortId"/>
<result column="start_json" property="startJson"/>
<result column="end_json" property="endJson"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, assort_id, start_json, end_json
</sql>
</mapper>
Loading…
Cancel
Save