From 648049d81a01b13e1c5f4f81f026410e24425aa7 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 9 Sep 2021 15:04:02 +0800 Subject: [PATCH 01/21] bug --- .../ccsens/carbasics/api/OrganizationController.java | 2 +- .../com/ccsens/carbasics/api/ProjectController.java | 8 +++++++- .../com/ccsens/carbasics/bean/dto/ProjectDto.java | 2 ++ .../ccsens/carbasics/service/IQcpProjectService.java | 2 +- .../ccsens/carbasics/service/QcpProjectService.java | 12 ++++++------ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java index 4dc8c89..291e52b 100644 --- a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java +++ b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java @@ -23,7 +23,7 @@ import java.util.List; /** * @description: - * @author: whj + * @author: whjswitchProject * @time: 2021/9/3 16:38 */ @Api(tags = "机构(质控,医院)相关") diff --git a/src/main/java/com/ccsens/carbasics/api/ProjectController.java b/src/main/java/com/ccsens/carbasics/api/ProjectController.java index 365c5e7..428f7bc 100644 --- a/src/main/java/com/ccsens/carbasics/api/ProjectController.java +++ b/src/main/java/com/ccsens/carbasics/api/ProjectController.java @@ -9,6 +9,7 @@ import com.ccsens.common.bean.vo.CProjectVo; import com.ccsens.common.service.IProjectService; import com.ccsens.util.JsonResponse; import com.ccsens.util.bean.dto.QueryDto; +import com.ccsens.util.message.SwitchoverProjectUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.HashSet; +import java.util.Set; /** * @author 逗 @@ -58,7 +61,10 @@ public class ProjectController { @RequestMapping(value = "/switchProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse switchProject(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { log.info("切换项目:{}", params); - qcpProjectService.switchProject(params.getParam(), params.getUserId()); + Set userIds = new HashSet<>(); + userIds.add(params.getUserId().toString()); + ProjectDto.SwitchProject param = params.getParam(); + SwitchoverProjectUtil.switchoverProject(userIds,param.getProjectId(), param.getUrl()); log.info("切换项目"); return JsonResponse.newInstance().ok(); } diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/ProjectDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/ProjectDto.java index 69bd61c..353ac8a 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/ProjectDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/ProjectDto.java @@ -61,6 +61,8 @@ public class ProjectDto { public static class SwitchProject { @ApiModelProperty("项目id") private Long projectId; + @ApiModelProperty("项目访问域") + private String url; } @Data diff --git a/src/main/java/com/ccsens/carbasics/service/IQcpProjectService.java b/src/main/java/com/ccsens/carbasics/service/IQcpProjectService.java index 3a157fc..96ec1d2 100644 --- a/src/main/java/com/ccsens/carbasics/service/IQcpProjectService.java +++ b/src/main/java/com/ccsens/carbasics/service/IQcpProjectService.java @@ -23,5 +23,5 @@ public interface IQcpProjectService { * @param param 项目id * @param userId 当前用户id */ - void switchProject(ProjectDto.SwitchProject param, Long userId) throws Exception; +// void switchProject(ProjectDto.SwitchProject param, Long userId) throws Exception; } diff --git a/src/main/java/com/ccsens/carbasics/service/QcpProjectService.java b/src/main/java/com/ccsens/carbasics/service/QcpProjectService.java index b4205f4..003e7aa 100644 --- a/src/main/java/com/ccsens/carbasics/service/QcpProjectService.java +++ b/src/main/java/com/ccsens/carbasics/service/QcpProjectService.java @@ -192,11 +192,11 @@ public class QcpProjectService implements IQcpProjectService { // return createCaseV; // } - @Override - public void switchProject(ProjectDto.SwitchProject param, Long userId) throws Exception { - Set userIds = new HashSet<>(); - userIds.add(userId.toString()); - SwitchoverProjectUtil.switchoverProject(userIds,param.getProjectId()); - } +// @Override +// public void switchProject(ProjectDto.SwitchProject param, Long userId) throws Exception { +// Set userIds = new HashSet<>(); +// userIds.add(userId.toString()); +// SwitchoverProjectUtil.switchoverProject(userIds,param.getProjectId()); +// } } From 143ff00a7cc865c2951979de6eccf4df850b57e1 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 9 Sep 2021 17:42:44 +0800 Subject: [PATCH 02/21] bug --- .../carbasics/api/OrganizationController.java | 1 - .../carbasics/api/ProjectController.java | 8 ++--- .../com/ccsens/carbasics/bean/vo/OcrVo.java | 4 +-- .../carbasics/service/AsyncService.java | 35 +++++++++++++++++++ .../carbasics/service/IAsyncService.java | 11 ++++++ src/main/resources/application.yml | 4 +-- 6 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/ccsens/carbasics/service/AsyncService.java create mode 100644 src/main/java/com/ccsens/carbasics/service/IAsyncService.java diff --git a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java index 291e52b..65e1de6 100644 --- a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java +++ b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java @@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -import java.util.List; /** * @description: diff --git a/src/main/java/com/ccsens/carbasics/api/ProjectController.java b/src/main/java/com/ccsens/carbasics/api/ProjectController.java index 428f7bc..30fb50d 100644 --- a/src/main/java/com/ccsens/carbasics/api/ProjectController.java +++ b/src/main/java/com/ccsens/carbasics/api/ProjectController.java @@ -2,6 +2,7 @@ package com.ccsens.carbasics.api; import com.ccsens.carbasics.bean.dto.ProjectDto; import com.ccsens.carbasics.bean.vo.ProjectVo; +import com.ccsens.carbasics.service.IAsyncService; import com.ccsens.carbasics.service.IQcpProjectService; import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.common.bean.dto.CProjectDto; @@ -37,6 +38,8 @@ public class ProjectController { private IProjectService projectService; @Resource private IQcpProjectService qcpProjectService; + @Resource + private IAsyncService asyncService; @ApiOperation(value = "根据id查询项目信息", notes = "根据id查询项目信息") @RequestMapping(value = "/findProjectById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @@ -61,10 +64,7 @@ public class ProjectController { @RequestMapping(value = "/switchProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse switchProject(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { log.info("切换项目:{}", params); - Set userIds = new HashSet<>(); - userIds.add(params.getUserId().toString()); - ProjectDto.SwitchProject param = params.getParam(); - SwitchoverProjectUtil.switchoverProject(userIds,param.getProjectId(), param.getUrl()); + asyncService.switchProject(params); log.info("切换项目"); return JsonResponse.newInstance().ok(); } diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java index 6efebf1..36b981f 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java @@ -19,11 +19,11 @@ public class OcrVo { @ApiModelProperty("姓名") private String name; @ApiModelProperty("性别") - private byte sex; + private Byte sex; @ApiModelProperty("身份证号") private String idCardNo; @ApiModelProperty("年龄") - private int age; + private Integer age; @ApiModelProperty("民族") private String nation; diff --git a/src/main/java/com/ccsens/carbasics/service/AsyncService.java b/src/main/java/com/ccsens/carbasics/service/AsyncService.java new file mode 100644 index 0000000..dd0743c --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/service/AsyncService.java @@ -0,0 +1,35 @@ +package com.ccsens.carbasics.service; + +import com.ccsens.carbasics.bean.dto.ProjectDto; +import com.ccsens.util.bean.dto.QueryDto; +import com.ccsens.util.message.SwitchoverProjectUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashSet; +import java.util.Set; + +/** + * @description: + * @author: whj + * @time: 2021/9/9 15:37 + */ +@Slf4j +@Service +@Async +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class AsyncService implements IAsyncService { + @Override + public void switchProject(QueryDto params) throws Exception { + log.info("开始接受切换项目"); + Thread.sleep(1000); + log.info("切换项目"); + Set userIds = new HashSet<>(); + userIds.add(params.getUserId().toString()); + ProjectDto.SwitchProject param = params.getParam(); + SwitchoverProjectUtil.switchoverProject(userIds,param.getProjectId(), param.getUrl()); + } +} diff --git a/src/main/java/com/ccsens/carbasics/service/IAsyncService.java b/src/main/java/com/ccsens/carbasics/service/IAsyncService.java new file mode 100644 index 0000000..8e0ec43 --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/service/IAsyncService.java @@ -0,0 +1,11 @@ +package com.ccsens.carbasics.service; + +import com.ccsens.carbasics.bean.dto.ProjectDto; +import com.ccsens.util.bean.dto.QueryDto; + +public interface IAsyncService { + /** + * 通知TALL切换项目 + * */ + void switchProject(QueryDto params) throws Exception; +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c3b11fb..5abf242 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: common, util-test + active: prod + include: common, util-prod From 6908ddf6d3d35a5955058a22c3539d3b5b4fe562 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 9 Sep 2021 19:26:31 +0800 Subject: [PATCH 03/21] bug --- .../java/com/ccsens/carbasics/bean/dto/PatientDto.java | 4 ++-- .../java/com/ccsens/carbasics/bean/vo/FirstAidLogVo.java | 2 +- src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java index cbd43ce..6a1e14b 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java @@ -119,7 +119,7 @@ public class PatientDto { @ApiModelProperty("患者姓名") private String name; @ApiModelProperty("性别 0女 1男") - private byte gender; + private Byte gender; @Length(max = 20,message = "名字名称过长") @ApiModelProperty("民族") private String nation; @@ -129,7 +129,7 @@ public class PatientDto { @ApiModelProperty("疑似诊断信息") private String suspected; @ApiModelProperty("是否是演示数据 0正式 1演示") - private byte valueType; + private Byte valueType; } diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/FirstAidLogVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/FirstAidLogVo.java index eee4903..4eeaef9 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/FirstAidLogVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/FirstAidLogVo.java @@ -28,7 +28,7 @@ public class FirstAidLogVo { @ApiModelProperty("日志ID") private Long id; @ApiModelProperty("角色 0:分诊护士 1:神内医生 2:神外医生") - private byte role; + private Byte role; @ApiModelProperty("医生名字") private String name; } diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java index 04b56d6..8396b58 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java @@ -33,15 +33,15 @@ public class PatientVo { @ApiModelProperty("名称") private String name; @ApiModelProperty("性别") - private byte gender; + private Byte gender; @ApiModelProperty("年龄") - private int age; + private Integer age; @ApiModelProperty("平车id") private Long carId; @ApiModelProperty("是否是演示数据 0否 1是") - private byte demonstrate; + private Byte demonstrate; @ApiModelProperty("病例状态 0:创建 1:急救审核通过 2:急救审核拒绝 3出院审核通过 4出院审核拒绝 5:申请修改 6:申请拒绝") - private byte dataStatus; + private Byte dataStatus; @ApiModelProperty("急救:发病时间 转归:出院时间") private String record1; @ApiModelProperty("急救:到院时间 转归:离院方式") From 1aa19b3e17be923b72e074e5437cedbf7d782a96 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Fri, 10 Sep 2021 09:42:48 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccsens/carbasics/api/ShareController.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/main/java/com/ccsens/carbasics/api/ShareController.java diff --git a/src/main/java/com/ccsens/carbasics/api/ShareController.java b/src/main/java/com/ccsens/carbasics/api/ShareController.java new file mode 100644 index 0000000..2910851 --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/api/ShareController.java @@ -0,0 +1,50 @@ +package com.ccsens.carbasics.api; + + +import com.ccsens.cloudutil.annotation.MustLogin; +import com.ccsens.common.bean.dto.CShareDto; +import com.ccsens.common.bean.vo.CShareVo; +import com.ccsens.common.service.IShareService; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.bean.dto.QueryDto; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@Api(tags = "分享相关") +@RestController +@RequestMapping("/share") +@Slf4j +public class ShareController { + @Resource + private IShareService shareService; + + @MustLogin + @ApiOperation(value = "创建分享连接", notes = "") + @RequestMapping(value = "/create", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse createShareUrl(@ApiParam @Validated @RequestBody QueryDto params) { + log.info("创建分享连接开始:{}",params); + CShareVo.CreateShareUrl shareUrl = shareService.createShareUrl(params.getParam(), params.getUserId()); + log.info("创建分享连接结束:{}",shareUrl); + return JsonResponse.newInstance().ok(shareUrl); + } + + @MustLogin + @ApiOperation(value = "点击分享连接", notes = "") + @RequestMapping(value = "/click", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse queryByProjectId(@ApiParam @Validated @RequestBody QueryDto params) { + log.info("点击分享链接开始:{}",params); + CShareVo.ClickShareInfo clickShareInfo = shareService.clickShareUrl(params.getParam(), params.getUserId(),params.getUserName(),params.getPhone()); + log.info("点击分享链接结束:{}",clickShareInfo); + return JsonResponse.newInstance().ok(clickShareInfo); + } + +} From 6c12ff9911fb98a0ff7a17769d43b667fdb68920 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Fri, 10 Sep 2021 16:37:43 +0800 Subject: [PATCH 05/21] bug --- .../carbasics/api/OrganizationController.java | 44 +++++++++ .../ccsens/carbasics/bean/dto/PatientDto.java | 4 +- .../carbasics/bean/dto/StatisticalDto.java | 2 +- .../carbasics/persist/dao/FirstAidDao.java | 7 +- .../persist/dao/OrganizationDao.java | 19 ++++ .../carbasics/service/FirstAidService.java | 14 +-- .../service/IOrganizationService.java | 10 +++ .../service/OrganizationService.java | 90 ++++++++++++++++++- .../carbasics/service/StatisticalService.java | 2 +- .../com/ccsens/carbasics/util/Constant.java | 10 +++ src/main/resources/mapper_dao/FirstAidDao.xml | 17 ++-- .../mapper_dao/FirstAidRecordDao.xml | 6 +- .../resources/mapper_dao/OrganizationDao.xml | 35 +++++--- 13 files changed, 225 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java index 65e1de6..73ab522 100644 --- a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java +++ b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java @@ -1,13 +1,23 @@ package com.ccsens.carbasics.api; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; import com.ccsens.carbasics.bean.dto.OrganizationDto; import com.ccsens.carbasics.bean.dto.StatisticalDto; import com.ccsens.carbasics.bean.vo.OrganizationVo; import com.ccsens.carbasics.bean.vo.StatisticalVo; import com.ccsens.carbasics.service.IOrganizationService; +import com.ccsens.carbasics.util.Constant; +import com.ccsens.carbasics.util.DefaultCodeError; import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.util.JsonResponse; +import com.ccsens.util.PoiUtil; +import com.ccsens.util.PropUtil; +import com.ccsens.util.WebConstant; import com.ccsens.util.bean.dto.QueryDto; +import com.ccsens.util.exception.BaseException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -17,8 +27,12 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.File; +import java.util.Date; +import java.util.List; /** * @description: @@ -43,4 +57,34 @@ public class OrganizationController { log.info("山西省地市查询结果:{}", rank); return JsonResponse.newInstance().ok(rank); } + + @MustLogin + @ApiOperation(value = "机构导入", notes = "") + @RequestMapping(value = "/import", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse importOrganization( QueryDto params) throws Exception { + MultipartFile f = params.getParam(); + String ext = FileUtil.extName(f.getOriginalFilename()); + if(StrUtil.isEmpty(ext) || !Constant.WbsExcel.WBS_FILE_FORMAT.contains(ext)){ + throw new BaseException(DefaultCodeError.FILE_FORMAT_ERROR); + } + //文件路径 + String dir = PropUtil.path + "organization/"; + String path = DateUtil.format(new Date(), "yyyyMMdd") + File.separator + IdUtil.simpleUUID() + "." + ext; + String fullPath = dir + path; + //转成file + File file = new File(fullPath); + if (!file.getParentFile().exists()) { + file.mkdirs(); + } + + FileUtil.writeFromStream(f.getInputStream(), fullPath); + + List rowList = PoiUtil.readExce(file, 0, null, 1, false); + //导入数据库 + String result = organizationService.importCode(rowList,params.getUserId()); + JsonResponse ok = JsonResponse.newInstance().ok(); + ok.setMsg(StrUtil.isBlank(result) ? ok.getMsg() : result); + return ok; + } + } diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java index 6a1e14b..33ebced 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java @@ -172,7 +172,7 @@ public class PatientDto { @ApiModelProperty("项目id") private Long projectId; @ApiModelProperty("病例状态 0:创建 1:急救审核通过 2:急救审核拒绝 3出院审核通过 4出院审核拒绝 5:申请修改 6:申请拒绝") - private byte dataStatus; + private Byte dataStatus; @ApiModelProperty("患者姓名") private String name; @ApiModelProperty("到院时间-开始") @@ -185,6 +185,8 @@ public class PatientDto { @Length(max = 18,message = "请输入正确的身份证号") @ApiModelProperty("证件号") private String idcard; + @ApiModelProperty("查询类型,0:急救 1:出院") + private Byte queryType = 0; @ApiModelProperty("第几页") @Min(value = 1) diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/StatisticalDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/StatisticalDto.java index 102488c..742f5fd 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/StatisticalDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/StatisticalDto.java @@ -135,7 +135,7 @@ public class StatisticalDto { public static class AreaMedian { @NotNull(message = "请选择对应的省份信息") @ApiModelProperty("省质控code") - private String code; + private String code = "SZK"; @ApiModelProperty("开始时间") private Long startTime; @NotNull diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java index fff7bbf..c7c4038 100644 --- a/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java +++ b/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java @@ -1,16 +1,13 @@ package com.ccsens.carbasics.persist.dao; import com.ccsens.carbasics.bean.dto.PatientDto; -import com.ccsens.carbasics.bean.dto.StatisticalDto; import com.ccsens.carbasics.bean.po.FirstAid; import com.ccsens.carbasics.bean.po.Organization; import com.ccsens.carbasics.bean.vo.PatientVo; -import com.ccsens.carbasics.bean.vo.StatisticalVo; import com.ccsens.carbasics.persist.mapper.FirstAidMapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; -import java.math.BigDecimal; import java.util.List; /** @@ -28,11 +25,13 @@ public interface FirstAidDao extends FirstAidMapper { /** * 质检员查看急救列表 + * + * @param templates 模板列表 * @param hospitalId 医院id * @param param 筛选条件 * @return 返回急救信息 */ - List queryPatientListByQuality(@Param("template")byte template,@Param("hospitalId")Long hospitalId, @Param("param")PatientDto.QueryListByQuality param); + List queryPatientListByQuality(@Param("templates") List templates, @Param("hospitalId")Long hospitalId, @Param("param")PatientDto.QueryListByQuality param); /** * 秘书查看急救列表 diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/OrganizationDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/OrganizationDao.java index 9e02323..283cb42 100644 --- a/src/main/java/com/ccsens/carbasics/persist/dao/OrganizationDao.java +++ b/src/main/java/com/ccsens/carbasics/persist/dao/OrganizationDao.java @@ -1,6 +1,7 @@ package com.ccsens.carbasics.persist.dao; import com.ccsens.carbasics.bean.po.Organization; +import com.ccsens.carbasics.bean.po.OrganizationParent; import com.ccsens.carbasics.bean.vo.OrganizationVo; import com.ccsens.carbasics.persist.mapper.OrganizationMapper; import org.apache.ibatis.annotations.Param; @@ -61,4 +62,22 @@ public interface OrganizationDao extends OrganizationMapper { List rankByDntMedian(@Param("areaId") Long areaId, @Param("level")byte level); + /** + * 根据机构名查找唯一的机构 + * @param name 机构名 + * @return 机构 + */ + Organization getOrganizationByName(@Param("name") String name); + + /** + * 批量添加机构 + * @param organizations 机构 + */ + void batchInsert(@Param("organizations") List organizations); + + /** + * 批量添加机构上级 + * @param parents 机构上级 + */ + void batchInsertParent(@Param("parents") List parents); } diff --git a/src/main/java/com/ccsens/carbasics/service/FirstAidService.java b/src/main/java/com/ccsens/carbasics/service/FirstAidService.java index 870e291..71bb327 100644 --- a/src/main/java/com/ccsens/carbasics/service/FirstAidService.java +++ b/src/main/java/com/ccsens/carbasics/service/FirstAidService.java @@ -281,10 +281,10 @@ public class FirstAidService implements IFirstAidService{ @Override public PageInfo queryPatientListByQuality(PatientDto.QueryListByQuality param, Long userId) { //根据项目id查找医院id - FirstAid firstAid = firstAidDao.getIdByProjectId(param.getProjectId()); - if(ObjectUtil.isNull(firstAid) || ObjectUtil.isNull(firstAid.getHospitalId())){ - throw new BaseException(DefaultCodeError.NOT_HOSPITAL_ID); - } +// FirstAid firstAid = firstAidDao.getIdByProjectId(param.getProjectId()); +// if(ObjectUtil.isNull(firstAid) || ObjectUtil.isNull(firstAid.getHospitalId())){ +// throw new BaseException(DefaultCodeError.NOT_HOSPITAL_ID); +// } //查找当前用户的职位和科室 OrganizationVo.MemberPosition memberPosition = organizationMemberDao.getMemberPosition(userId); //用户的科室必须是医院的科室 @@ -299,9 +299,13 @@ public class FirstAidService implements IFirstAidService{ if(CollectionUtil.isEmpty(templateList)){ throw new BaseException(DefaultCodeError.NOT_TEMPLATE); } + List templates = new ArrayList<>(); + templateList.forEach(template -> { + templates.add(template.getTemplate()); + }); //查找病例信息 PageHelper.startPage(param.getPageNum(),param.getPageSize()); - List patientList = firstAidDao.queryPatientListByQuality(templateList.get(0).getTemplate(),firstAid.getHospitalId(),param); + List patientList = firstAidDao.queryPatientListByQuality(templates,organization.getId(),param); return new PageInfo<>(patientList); } diff --git a/src/main/java/com/ccsens/carbasics/service/IOrganizationService.java b/src/main/java/com/ccsens/carbasics/service/IOrganizationService.java index 26505ab..f6b2f66 100644 --- a/src/main/java/com/ccsens/carbasics/service/IOrganizationService.java +++ b/src/main/java/com/ccsens/carbasics/service/IOrganizationService.java @@ -3,6 +3,8 @@ package com.ccsens.carbasics.service; import com.ccsens.carbasics.bean.dto.OrganizationDto; import com.ccsens.carbasics.bean.vo.OrganizationVo; +import java.util.List; + public interface IOrganizationService { /** @@ -12,4 +14,12 @@ public interface IOrganizationService { * @return 医院排名 */ OrganizationVo.Rank rank(OrganizationDto.Rank param, Long userId); + + /** + * 导入机构信息 + * @param fullPath 文件路径 + * @param userId 用户ID + * @return + */ + String importCode(List fullPath, Long userId) throws Exception; } diff --git a/src/main/java/com/ccsens/carbasics/service/OrganizationService.java b/src/main/java/com/ccsens/carbasics/service/OrganizationService.java index 90cbdd3..d2155ab 100644 --- a/src/main/java/com/ccsens/carbasics/service/OrganizationService.java +++ b/src/main/java/com/ccsens/carbasics/service/OrganizationService.java @@ -1,11 +1,15 @@ package com.ccsens.carbasics.service; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.StrUtil; import com.ccsens.carbasics.bean.dto.OrganizationDto; -import com.ccsens.carbasics.bean.po.Organization; +import com.ccsens.carbasics.bean.po.*; import com.ccsens.carbasics.bean.vo.OrganizationVo; import com.ccsens.carbasics.persist.dao.OrganizationDao; +import com.ccsens.carbasics.persist.mapper.OrganizationParentMapper; import com.ccsens.carbasics.util.Constant; +import com.ccsens.util.WebConstant; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -13,7 +17,9 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @description: @@ -27,6 +33,10 @@ public class OrganizationService implements IOrganizationService { @Resource private OrganizationDao organizationDao; + @Resource + private OrganizationParentMapper organizationParentMapper; + @Resource + private Snowflake snowflake; @Override public OrganizationVo.Rank rank(OrganizationDto.Rank param, Long userId) { @@ -46,9 +56,14 @@ public class OrganizationService implements IOrganizationService { break; default:break; } + for (int i = 0; i rowList, Long userId) throws Exception { + if (CollectionUtil.isEmpty(rowList)) { + return null; + } + List organizations = new ArrayList<>(); + List parents = new ArrayList<>(); + Map nameMap = new HashMap<>(); + int nameIndex = 0; + StringBuilder builder = new StringBuilder(); + rowList.forEach(row -> { + if (row == null || row.length <= nameIndex || StrUtil.isBlank((String)row[nameIndex])) { + return; + } + Organization newOrganization = new Organization(); + String name = (String)row[nameIndex]; + name = name.trim(); + Organization oldOrganization = organizationDao.getOrganizationByName(name); + newOrganization.setId(oldOrganization == null ? snowflake.nextId() : oldOrganization.getId()); + newOrganization.setName(name); + newOrganization.setOperator(userId); + for (String key: Constant.Organization.typeMap.keySet()) { + if (name.endsWith(key)) { + newOrganization.setOrganizationType(Constant.Organization.typeMap.get(key)); + } + } + if (newOrganization.getOrganizationType() == null) { + builder.append(name).append("无法判断类型,设置默认类型为医院。"); + newOrganization.setOrganizationType(Constant.Organization.HOSPITAL); + } + newOrganization.setCode(row.length > 1 && row[1] != null ? (String)row[1] : ""); + newOrganization.setShortName(row.length > 2 && row[2] != null ? (String)row[2] : ""); + newOrganization.setIntroduce(row.length > 3 && row[3] != null ? (String)row[3] : ""); + newOrganization.setLevel(row.length > 4 && row[4] != null ? Byte.parseByte((String)row[4]) : 0); + organizations.add(newOrganization); + nameMap.put(name, newOrganization.getId()); + int parentIndex = 5; + if (row.length <= parentIndex || row[parentIndex] == null || StrUtil.isBlank((String)row[parentIndex])) { + return; + } + String parentName = (String) row[parentIndex]; + parentName = parentName.trim(); + if (!nameMap.containsKey(parentName)) { + builder.append(name).append("的上级").append(parentName) + .append("未找到,请检查机构排序是否存在或排序是否正确。"); + } else { + OrganizationParent parent = new OrganizationParent(); + if (oldOrganization != null) { + // 删除原有的上下级关系 + OrganizationParentExample parentExample = new OrganizationParentExample(); + parentExample.createCriteria().andOrganizationIdEqualTo(oldOrganization.getId()); + OrganizationParent update = new OrganizationParent(); + update.setRecStatus(WebConstant.REC_STATUS.Deleted.value); + organizationParentMapper.updateByExampleSelective(update, parentExample); + } + parent.setId(snowflake.nextId()); + parent.setOrganizationId(newOrganization.getId()); + parent.setParentId(nameMap.get(parentName)); + parent.setOperator(userId); + parents.add(parent); + } + }); + if (CollectionUtil.isNotEmpty(organizations)) { + organizationDao.batchInsert(organizations); + } + if (CollectionUtil.isNotEmpty(parents)) { + organizationDao.batchInsertParent(parents); + } + return builder.toString(); + } } diff --git a/src/main/java/com/ccsens/carbasics/service/StatisticalService.java b/src/main/java/com/ccsens/carbasics/service/StatisticalService.java index abccf14..e9a16d5 100644 --- a/src/main/java/com/ccsens/carbasics/service/StatisticalService.java +++ b/src/main/java/com/ccsens/carbasics/service/StatisticalService.java @@ -218,7 +218,7 @@ public class StatisticalService implements IStatisticalService { List hospitalIds = getHospitalIds(param.getProjectId()); List items = firstAidRecordDao.countTimeMedian(param.getMinuendCode(), param.getSubtractionCode(), hospitalIds, param.getStartTime(), param.getEndTime(), param.getCountType()); StatisticalVo.Common common = new StatisticalVo.Common(); - BigDecimal median = firstAidRecordDao.countMedian(Constant.Statistical.Dnt.MINUEND_CODE, Constant.Statistical.Dnt.SUBTRACTION_CODE, hospitalIds, param.getStartTime(), param.getEndTime()); + BigDecimal median = firstAidRecordDao.countMedian(param.getMinuendCode(), param.getSubtractionCode(), hospitalIds, param.getStartTime(), param.getEndTime()); common.setTotal(median == null ? "" : median.toString()); List newItems = fillItems(items, param.getStartTime(), param.getEndTime(), param.getCountType()); common.setList(newItems); diff --git a/src/main/java/com/ccsens/carbasics/util/Constant.java b/src/main/java/com/ccsens/carbasics/util/Constant.java index 94e515e..e55dfaa 100644 --- a/src/main/java/com/ccsens/carbasics/util/Constant.java +++ b/src/main/java/com/ccsens/carbasics/util/Constant.java @@ -96,6 +96,16 @@ public class Constant { public static final class Organization{ /**医院*/ public final static byte HOSPITAL = 3; + public final static Map typeMap = new HashMap<>(); + + static { + typeMap.put("省卫健委", (byte)0); + typeMap.put("省质控", (byte)1); + typeMap.put("市质控", (byte)2); + typeMap.put("医院", (byte)3); + } + + } /**科室相关*/ diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index e88d8ef..638ff11 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -88,7 +88,9 @@ AND rec_status = 0 AND hospital_id = #{hospitalId} - AND type = #{template} + + #{id} + ) t LEFT JOIN t_qcp_first_aid_record t1 ON t.firstAidId = t1.first_aid_id AND t1.question_code = 'JBXX-ZYH' @@ -103,7 +105,10 @@ AND t4.question_code = 'CYQK-CYSJ' AND t4.rec_status = 0 WHERE - t4.id IS NULL + + t4.id IS NULL + t4.id IS NOT NULL + AND t1.answer LIKE concat('%',#{param.hospitalNumber},'%') @@ -113,8 +118,8 @@ AND t2.answer + 0 < #{param.endTime} - GROUP BY - t.updated_at DESC + GROUP BY t.firstAidId + ORDER BY t.updated_at DESC diff --git a/src/main/resources/mapper_dao/FirstAidRecordDao.xml b/src/main/resources/mapper_dao/FirstAidRecordDao.xml index fbf0f35..f2a4d3c 100644 --- a/src/main/resources/mapper_dao/FirstAidRecordDao.xml +++ b/src/main/resources/mapper_dao/FirstAidRecordDao.xml @@ -235,7 +235,7 @@ FROM_UNIXTIME(r1.answer/1000,'%Y-%m') as date, FROM_UNIXTIME(r1.answer/1000,'%Y-%m-%d') as date, - count(*) as cnt + count(*)/2 as cnt from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2 where a.id = r1.first_aid_id and r1.question_code = #{minuendCode} and a.id = r2.first_aid_id and r2.question_code = #{subtractionCode} @@ -310,8 +310,8 @@ SELECT @@ -88,7 +100,6 @@ LIMIT 1 + From ca077da6f8f559cd4a9988389dccd0262bbd2d94 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Sat, 11 Sep 2021 18:39:31 +0800 Subject: [PATCH 06/21] bug --- .../carbasics/api/OrganizationController.java | 2 +- .../service/OrganizationService.java | 42 ++++++++++--------- src/main/resources/mapper_dao/FirstAidDao.xml | 3 +- .../mapper_dao/FirstAidRecordDao.xml | 2 +- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java index 73ab522..a909078 100644 --- a/src/main/java/com/ccsens/carbasics/api/OrganizationController.java +++ b/src/main/java/com/ccsens/carbasics/api/OrganizationController.java @@ -74,7 +74,7 @@ public class OrganizationController { //转成file File file = new File(fullPath); if (!file.getParentFile().exists()) { - file.mkdirs(); + file.getParentFile().mkdirs(); } FileUtil.writeFromStream(f.getInputStream(), fullPath); diff --git a/src/main/java/com/ccsens/carbasics/service/OrganizationService.java b/src/main/java/com/ccsens/carbasics/service/OrganizationService.java index d2155ab..72590ce 100644 --- a/src/main/java/com/ccsens/carbasics/service/OrganizationService.java +++ b/src/main/java/com/ccsens/carbasics/service/OrganizationService.java @@ -116,27 +116,31 @@ public class OrganizationService implements IOrganizationService { if (row.length <= parentIndex || row[parentIndex] == null || StrUtil.isBlank((String)row[parentIndex])) { return; } - String parentName = (String) row[parentIndex]; - parentName = parentName.trim(); - if (!nameMap.containsKey(parentName)) { - builder.append(name).append("的上级").append(parentName) - .append("未找到,请检查机构排序是否存在或排序是否正确。"); - } else { - OrganizationParent parent = new OrganizationParent(); - if (oldOrganization != null) { - // 删除原有的上下级关系 - OrganizationParentExample parentExample = new OrganizationParentExample(); - parentExample.createCriteria().andOrganizationIdEqualTo(oldOrganization.getId()); - OrganizationParent update = new OrganizationParent(); - update.setRecStatus(WebConstant.REC_STATUS.Deleted.value); - organizationParentMapper.updateByExampleSelective(update, parentExample); + String parentCell = (String) row[parentIndex]; + String[] parentNames = parentCell.split(Constant.STRING_REGEX); + for (String parentName: parentNames) { + parentName = parentName.trim(); + if (!nameMap.containsKey(parentName)) { + builder.append(name).append("的上级").append(parentName) + .append("未找到,请检查机构排序是否存在或排序是否正确。"); + } else { + OrganizationParent parent = new OrganizationParent(); + if (oldOrganization != null) { + // 删除原有的上下级关系 + OrganizationParentExample parentExample = new OrganizationParentExample(); + parentExample.createCriteria().andOrganizationIdEqualTo(oldOrganization.getId()); + OrganizationParent update = new OrganizationParent(); + update.setRecStatus(WebConstant.REC_STATUS.Deleted.value); + organizationParentMapper.updateByExampleSelective(update, parentExample); + } + parent.setId(snowflake.nextId()); + parent.setOrganizationId(newOrganization.getId()); + parent.setParentId(nameMap.get(parentName)); + parent.setOperator(userId); + parents.add(parent); } - parent.setId(snowflake.nextId()); - parent.setOrganizationId(newOrganization.getId()); - parent.setParentId(nameMap.get(parentName)); - parent.setOperator(userId); - parents.add(parent); } + }); if (CollectionUtil.isNotEmpty(organizations)) { organizationDao.batchInsert(organizations); diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index 638ff11..051a3ad 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -79,7 +79,8 @@ FROM t_qcp_first_aid WHERE - data_status = #{param.dataStatus} + 1=1 + and data_status = #{param.dataStatus} AND `name` LIKE concat('%',#{param.name},'%') diff --git a/src/main/resources/mapper_dao/FirstAidRecordDao.xml b/src/main/resources/mapper_dao/FirstAidRecordDao.xml index f2a4d3c..375cfec 100644 --- a/src/main/resources/mapper_dao/FirstAidRecordDao.xml +++ b/src/main/resources/mapper_dao/FirstAidRecordDao.xml @@ -35,7 +35,7 @@ from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2 where a.id = r1.first_aid_id and r1.question_code = 'JMRSSJ' and a.id = r2.first_aid_id and r2.question_code = 'JBXX-DYSJ' - and r1.answer + 0 <= #{startTime} and r1.answer + 0 >= #{endTime} + and r1.answer + 0 <= #{endTime} and r1.answer + 0 >= #{startTime} #{id} From 4da40f8194cd3370ab6ff2f60a10cb2b7f70868c Mon Sep 17 00:00:00 2001 From: ccsens_wu <2377881365@qq.com> Date: Wed, 15 Sep 2021 20:50:24 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E5=8D=95=E4=B8=AA=E4=B8=AD=E4=BD=8D?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper_dao/FirstAidRecordDao.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/mapper_dao/FirstAidRecordDao.xml b/src/main/resources/mapper_dao/FirstAidRecordDao.xml index 375cfec..8b903b6 100644 --- a/src/main/resources/mapper_dao/FirstAidRecordDao.xml +++ b/src/main/resources/mapper_dao/FirstAidRecordDao.xml @@ -68,7 +68,8 @@ ( select ROUND((r1.answer - r2.answer)/60000, 2) as val - from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2 + from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2, + (SELECT @rownum:=0) r where a.id = r1.first_aid_id and r1.question_code = #{minuendCode} and a.id = r2.first_aid_id and r2.question_code = #{subtractionCode} and r1.answer + 0 >= #{startTime} and r1.answer + 0 <= #{endTime} @@ -77,9 +78,8 @@ AND a.value_type = 0 and a.data_status in (1, 3, 5, 6) and a.rec_status = 0 and r1.rec_status = 0 and r2.rec_status = 0 - )d, - (SELECT @rownum:=0) r - ORDER BY d.val + order by r1.answer - r2.answer asc + )d ) as dd WHERE dd.row_number IN ( FLOOR((@total_rows+1)/2), FLOOR((@total_rows+2)/2) ) From b14270aca75e38d454fe9e91f8a464c9f31d4c5e Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 16 Sep 2021 09:07:18 +0800 Subject: [PATCH 08/21] bug --- .../ccsens/carbasics/bean/dto/PatientDto.java | 6 ++--- .../com/ccsens/carbasics/bean/vo/OcrVo.java | 26 ++++++++++++++----- .../ccsens/carbasics/bean/vo/PatientVo.java | 4 ++- .../carbasics/service/FirstAidService.java | 18 +++++++++---- src/main/resources/mapper_dao/FirstAidDao.xml | 2 +- .../mapper_dao/FirstAidRecordDao.xml | 10 +++---- .../resources/mapper_dao/OrganizationDao.xml | 4 +-- 7 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java index 33ebced..a0e1efa 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java @@ -144,9 +144,9 @@ public class PatientDto { @Data @ApiModel("修改急救信息") public static class UpdatePatient{ - @NotNull(message = "请输入项目id") - @ApiModelProperty("项目id") - private Long projectId; +// @NotNull(message = "请输入项目id") +// @ApiModelProperty("项目id") +// private Long projectId; @NotNull(message = "请输入急救id") @ApiModelProperty("急救id") private Long firstAidId; diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java index 36b981f..8be311e 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java @@ -2,6 +2,7 @@ package com.ccsens.carbasics.bean.vo; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.StrUtil; import com.ccsens.util.baidu.BaiDuVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -37,14 +38,27 @@ public class OcrVo { words.forEach(wordNode ->{ String word = wordNode.getWords(); if (word.startsWith(idCardName)) { - this.name = word.substring(2); + this.name = word.substring(idCardName.length()); } else if (word.startsWith(idCardSex)) { - String sexWord = word.substring(2,3); - this.sex = "女".equals(sexWord) ? (byte)0 : (byte)1; - this.nation = word.substring(5); + int sexIndex = 2; + if (word.length() > sexIndex) { + String sexWord = word.substring(sexIndex,sexIndex +1); + this.sex = "女".equals(sexWord) ? (byte)0 : (byte)1; + } + int nationIndex = 5; + if (word.length() > nationIndex) { + this.nation = word.substring(nationIndex); + } + } else if (word.startsWith(idCardNo)) { - this.idCardNo = word.substring(6); - this.age = IdcardUtil.getAgeByIdCard(this.idCardNo); + int idCardIndex = 6; + int idCardMinLength = 15; + if (word.length() > idCardIndex) { + this.idCardNo = word.substring(6); + } + if (StrUtil.isNotBlank(this.idCardNo) && this.idCardNo.length() >= idCardMinLength) { + this.age = IdcardUtil.getAgeByIdCard(this.idCardNo); + } } }); } diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java index 8396b58..553d660 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java @@ -126,11 +126,13 @@ public class PatientVo { @ApiModelProperty("患者姓名") private String name; @ApiModelProperty("性别 0女 1男") - private byte gender; + private Byte gender; @ApiModelProperty("民族") private String nation; @ApiModelProperty("证件号") private String idcard; + @ApiModelProperty("疑似诊断信息") + private String suspected; } @Data diff --git a/src/main/java/com/ccsens/carbasics/service/FirstAidService.java b/src/main/java/com/ccsens/carbasics/service/FirstAidService.java index 71bb327..3cc5a73 100644 --- a/src/main/java/com/ccsens/carbasics/service/FirstAidService.java +++ b/src/main/java/com/ccsens/carbasics/service/FirstAidService.java @@ -13,12 +13,8 @@ import com.ccsens.carbasics.bean.vo.FirstAidLogVo; import com.ccsens.carbasics.bean.vo.FirstAidVo; import com.ccsens.carbasics.bean.vo.OrganizationVo; import com.ccsens.carbasics.bean.vo.PatientVo; -import com.ccsens.carbasics.persist.dao.FirstAidDao; -import com.ccsens.carbasics.persist.dao.FirstAidLogDao; +import com.ccsens.carbasics.persist.dao.*; -import com.ccsens.carbasics.persist.dao.FirstAidMemberDao; -import com.ccsens.carbasics.persist.dao.OrganizationDao; -import com.ccsens.carbasics.persist.dao.OrganizationMemberDao; import com.ccsens.carbasics.persist.mapper.*; import com.ccsens.carbasics.util.Constant; import com.ccsens.carbasics.util.DefaultCodeError; @@ -67,6 +63,8 @@ public class FirstAidService implements IFirstAidService{ @Resource private FirstAidRecordLogMapper firstAidRecordLogMapper; @Resource + private PatientDao patientDao; + @Resource private RedisUtil redisUtil; @@ -213,7 +211,17 @@ public class FirstAidService implements IFirstAidService{ getPatient.setGender(firstAids.get(0).getGender()); getPatient.setNation(firstAids.get(0).getNation()); getPatient.setIdcard(firstAids.get(0).getIdcard()); + // 查找疑似病例 + FirstAidRecordExample recordExample = new FirstAidRecordExample(); + recordExample.createCriteria().andFirstAidIdEqualTo(firstAids.get(0).getId()).andQuestionCodeEqualTo(Constant.QuestionCode.CJBL_YSBL); + recordExample.setOrderByClause("id desc limit 1"); + List firstAidRecords = firstAidRecordMapper.selectByExample(recordExample); + if (CollectionUtil.isNotEmpty(firstAidRecords)) { + getPatient.setSuspected(firstAidRecords.get(0).getAnswer()); + } + } + return getPatient; } diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index 051a3ad..c580d39 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -15,7 +15,7 @@ and r.question_code = 'CYQK-CYSJ' and r.rec_status = 0 left join t_qcp_first_aid_record r1 on a.id = r1.first_aid_id and r1.rec_status = 0 - and r1.question_code='JBXX-FBSJ' + and r1.question_code='JBXX-FBTime' and r1.question_code='CYQK-LYFS' left join t_qcp_first_aid_record r2 on a.id = r2.first_aid_id and r2.rec_status = 0 diff --git a/src/main/resources/mapper_dao/FirstAidRecordDao.xml b/src/main/resources/mapper_dao/FirstAidRecordDao.xml index 375cfec..92d49d2 100644 --- a/src/main/resources/mapper_dao/FirstAidRecordDao.xml +++ b/src/main/resources/mapper_dao/FirstAidRecordDao.xml @@ -5,7 +5,7 @@ @@ -215,7 +217,7 @@ FROM_UNIXTIME(r1.answer/1000,'%Y-%m-%d') as date, ROUND((r1.answer - r2.answer)/60000, 2) as val - from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2 + from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2, (select @rk := 0, @team := '') t where a.id = r1.first_aid_id and r1.question_code = #{minuendCode} and a.id = r2.first_aid_id and r2.question_code = #{subtractionCode} and r1.answer + 0 >= #{startTime} and r1.answer + 0 <= #{endTime} @@ -224,9 +226,9 @@ AND a.value_type = 0 and a.data_status in (1, 3, 5, 6) and a.rec_status = 0 and r1.rec_status = 0 and r2.rec_status = 0 - ) d, - (select @rk := 0, @team := '') t - order by date, val) t1 + order by r1.answer/1000, r1.answer/1000 + ) d + ) t1 left join ( select @@ -259,11 +261,11 @@ + From 9fbc9d2d5d776ce8441f179a30419e2a0ff67531 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Sat, 18 Sep 2021 09:57:55 +0800 Subject: [PATCH 12/21] =?UTF-8?q?Ocr=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccsens/carbasics/api/OcrController.java | 6 +- .../com/ccsens/carbasics/bean/dto/OcrDto.java | 16 +- .../ccsens/carbasics/bean/po/OcrKeyword.java | 139 +++ .../carbasics/bean/po/OcrKeywordExample.java | 911 ++++++++++++++++++ .../carbasics/bean/po/OcrKeywordOption.java | 95 ++ .../bean/po/OcrKeywordOptionExample.java | 641 ++++++++++++ .../carbasics/bean/vo/QuestionOcrVo.java | 15 + .../persist/dao/FirstAidRecordDao.java | 7 + .../carbasics/persist/dao/OcrKeywordDao.java | 25 + .../persist/dao/OcrKeywordOptionDao.java | 18 + .../persist/mapper/OcrKeywordMapper.java | 30 + .../mapper/OcrKeywordOptionMapper.java | 30 + .../ccsens/carbasics/service/IOcrService.java | 13 + .../ccsens/carbasics/service/OcrService.java | 462 +++++++-- .../com/ccsens/carbasics/util/Constant.java | 11 + .../mapper_dao/FirstAidRecordDao.xml | 11 + .../resources/mapper_dao/OcrKeywordDao.xml | 41 + .../mapper_dao/OcrKeywordOptionDao.xml | 18 + .../resources/mapper_raw/OcrKeywordMapper.xml | 306 ++++++ .../mapper_raw/OcrKeywordOptionMapper.xml | 243 +++++ src/main/resources/mbg.xml | 4 +- 21 files changed, 2930 insertions(+), 112 deletions(-) create mode 100644 src/main/java/com/ccsens/carbasics/bean/po/OcrKeyword.java create mode 100644 src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordExample.java create mode 100644 src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOption.java create mode 100644 src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOptionExample.java create mode 100644 src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordDao.java create mode 100644 src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordOptionDao.java create mode 100644 src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordMapper.java create mode 100644 src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordOptionMapper.java create mode 100644 src/main/resources/mapper_dao/OcrKeywordDao.xml create mode 100644 src/main/resources/mapper_dao/OcrKeywordOptionDao.xml create mode 100644 src/main/resources/mapper_raw/OcrKeywordMapper.xml create mode 100644 src/main/resources/mapper_raw/OcrKeywordOptionMapper.xml diff --git a/src/main/java/com/ccsens/carbasics/api/OcrController.java b/src/main/java/com/ccsens/carbasics/api/OcrController.java index e820b49..66ac670 100644 --- a/src/main/java/com/ccsens/carbasics/api/OcrController.java +++ b/src/main/java/com/ccsens/carbasics/api/OcrController.java @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.imageio.ImageIO; @@ -66,10 +67,9 @@ public class OcrController { @MustLogin @ApiOperation(value = "图片文字识别",notes = "") @RequestMapping(value="/general/basic",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) - public JsonResponse> queryInpatient(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { - + public JsonResponse> queryInpatient(QueryDto> params, Long firstAidId) throws Exception { log.info("图片文字识别请求:{}", params); - List words = ocrService.identifyWords(params.getParam(), params.getUserId()); + List words = ocrService.discernWords(params.getParam(), params.getUserId(),firstAidId); log.info("图片文字识别结束:{}", words); return JsonResponse.newInstance().ok(words); } diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/OcrDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/OcrDto.java index d1ebe3d..77e98df 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/OcrDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/OcrDto.java @@ -6,8 +6,10 @@ import lombok.Data; import org.springframework.web.multipart.MultipartFile; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.File; +import java.util.List; public class OcrDto { @@ -15,17 +17,11 @@ public class OcrDto { @Data public static class GeneralBasic{ @NotNull - @ApiModelProperty("患者ID") - private Long patientId; - @ApiModelProperty("报告单类型") - @NotBlank - private String code; - @ApiModelProperty("图片路径") - private String url; - @ApiModelProperty("图片ID") - private Long fileId; + @ApiModelProperty("急救id") + private Long firstAidId; + @NotEmpty @ApiModelProperty("图片") - private MultipartFile file; + private List fileList; } } diff --git a/src/main/java/com/ccsens/carbasics/bean/po/OcrKeyword.java b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeyword.java new file mode 100644 index 0000000..c48f8b8 --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeyword.java @@ -0,0 +1,139 @@ +package com.ccsens.carbasics.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class OcrKeyword implements Serializable { + private Long id; + + private String code; + + private String option; + + private String keyword; + + private String keywordExclude; + + private Byte verifyType; + + private String queryRule; + + private Long organizationId; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code == null ? null : code.trim(); + } + + public String getOption() { + return option; + } + + public void setOption(String option) { + this.option = option == null ? null : option.trim(); + } + + public String getKeyword() { + return keyword; + } + + public void setKeyword(String keyword) { + this.keyword = keyword == null ? null : keyword.trim(); + } + + public String getKeywordExclude() { + return keywordExclude; + } + + public void setKeywordExclude(String keywordExclude) { + this.keywordExclude = keywordExclude == null ? null : keywordExclude.trim(); + } + + public Byte getVerifyType() { + return verifyType; + } + + public void setVerifyType(Byte verifyType) { + this.verifyType = verifyType; + } + + public String getQueryRule() { + return queryRule; + } + + public void setQueryRule(String queryRule) { + this.queryRule = queryRule == null ? null : queryRule.trim(); + } + + public Long getOrganizationId() { + return organizationId; + } + + public void setOrganizationId(Long organizationId) { + this.organizationId = organizationId; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", code=").append(code); + sb.append(", option=").append(option); + sb.append(", keyword=").append(keyword); + sb.append(", keywordExclude=").append(keywordExclude); + sb.append(", verifyType=").append(verifyType); + sb.append(", queryRule=").append(queryRule); + sb.append(", organizationId=").append(organizationId); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordExample.java b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordExample.java new file mode 100644 index 0000000..ba0318f --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordExample.java @@ -0,0 +1,911 @@ +package com.ccsens.carbasics.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class OcrKeywordExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public OcrKeywordExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andCodeIsNull() { + addCriterion("code is null"); + return (Criteria) this; + } + + public Criteria andCodeIsNotNull() { + addCriterion("code is not null"); + return (Criteria) this; + } + + public Criteria andCodeEqualTo(String value) { + addCriterion("code =", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotEqualTo(String value) { + addCriterion("code <>", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThan(String value) { + addCriterion("code >", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThanOrEqualTo(String value) { + addCriterion("code >=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThan(String value) { + addCriterion("code <", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThanOrEqualTo(String value) { + addCriterion("code <=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLike(String value) { + addCriterion("code like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotLike(String value) { + addCriterion("code not like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeIn(List values) { + addCriterion("code in", values, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotIn(List values) { + addCriterion("code not in", values, "code"); + return (Criteria) this; + } + + public Criteria andCodeBetween(String value1, String value2) { + addCriterion("code between", value1, value2, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotBetween(String value1, String value2) { + addCriterion("code not between", value1, value2, "code"); + return (Criteria) this; + } + + public Criteria andOptionIsNull() { + addCriterion("option is null"); + return (Criteria) this; + } + + public Criteria andOptionIsNotNull() { + addCriterion("option is not null"); + return (Criteria) this; + } + + public Criteria andOptionEqualTo(String value) { + addCriterion("option =", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionNotEqualTo(String value) { + addCriterion("option <>", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionGreaterThan(String value) { + addCriterion("option >", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionGreaterThanOrEqualTo(String value) { + addCriterion("option >=", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionLessThan(String value) { + addCriterion("option <", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionLessThanOrEqualTo(String value) { + addCriterion("option <=", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionLike(String value) { + addCriterion("option like", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionNotLike(String value) { + addCriterion("option not like", value, "option"); + return (Criteria) this; + } + + public Criteria andOptionIn(List values) { + addCriterion("option in", values, "option"); + return (Criteria) this; + } + + public Criteria andOptionNotIn(List values) { + addCriterion("option not in", values, "option"); + return (Criteria) this; + } + + public Criteria andOptionBetween(String value1, String value2) { + addCriterion("option between", value1, value2, "option"); + return (Criteria) this; + } + + public Criteria andOptionNotBetween(String value1, String value2) { + addCriterion("option not between", value1, value2, "option"); + return (Criteria) this; + } + + public Criteria andKeywordIsNull() { + addCriterion("keyword is null"); + return (Criteria) this; + } + + public Criteria andKeywordIsNotNull() { + addCriterion("keyword is not null"); + return (Criteria) this; + } + + public Criteria andKeywordEqualTo(String value) { + addCriterion("keyword =", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordNotEqualTo(String value) { + addCriterion("keyword <>", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordGreaterThan(String value) { + addCriterion("keyword >", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordGreaterThanOrEqualTo(String value) { + addCriterion("keyword >=", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordLessThan(String value) { + addCriterion("keyword <", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordLessThanOrEqualTo(String value) { + addCriterion("keyword <=", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordLike(String value) { + addCriterion("keyword like", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordNotLike(String value) { + addCriterion("keyword not like", value, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordIn(List values) { + addCriterion("keyword in", values, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordNotIn(List values) { + addCriterion("keyword not in", values, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordBetween(String value1, String value2) { + addCriterion("keyword between", value1, value2, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordNotBetween(String value1, String value2) { + addCriterion("keyword not between", value1, value2, "keyword"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeIsNull() { + addCriterion("keyword_exclude is null"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeIsNotNull() { + addCriterion("keyword_exclude is not null"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeEqualTo(String value) { + addCriterion("keyword_exclude =", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeNotEqualTo(String value) { + addCriterion("keyword_exclude <>", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeGreaterThan(String value) { + addCriterion("keyword_exclude >", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeGreaterThanOrEqualTo(String value) { + addCriterion("keyword_exclude >=", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeLessThan(String value) { + addCriterion("keyword_exclude <", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeLessThanOrEqualTo(String value) { + addCriterion("keyword_exclude <=", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeLike(String value) { + addCriterion("keyword_exclude like", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeNotLike(String value) { + addCriterion("keyword_exclude not like", value, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeIn(List values) { + addCriterion("keyword_exclude in", values, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeNotIn(List values) { + addCriterion("keyword_exclude not in", values, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeBetween(String value1, String value2) { + addCriterion("keyword_exclude between", value1, value2, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andKeywordExcludeNotBetween(String value1, String value2) { + addCriterion("keyword_exclude not between", value1, value2, "keywordExclude"); + return (Criteria) this; + } + + public Criteria andVerifyTypeIsNull() { + addCriterion("verify_type is null"); + return (Criteria) this; + } + + public Criteria andVerifyTypeIsNotNull() { + addCriterion("verify_type is not null"); + return (Criteria) this; + } + + public Criteria andVerifyTypeEqualTo(Byte value) { + addCriterion("verify_type =", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeNotEqualTo(Byte value) { + addCriterion("verify_type <>", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeGreaterThan(Byte value) { + addCriterion("verify_type >", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("verify_type >=", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeLessThan(Byte value) { + addCriterion("verify_type <", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeLessThanOrEqualTo(Byte value) { + addCriterion("verify_type <=", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeIn(List values) { + addCriterion("verify_type in", values, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeNotIn(List values) { + addCriterion("verify_type not in", values, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeBetween(Byte value1, Byte value2) { + addCriterion("verify_type between", value1, value2, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeNotBetween(Byte value1, Byte value2) { + addCriterion("verify_type not between", value1, value2, "verifyType"); + return (Criteria) this; + } + + public Criteria andQueryRuleIsNull() { + addCriterion("query_rule is null"); + return (Criteria) this; + } + + public Criteria andQueryRuleIsNotNull() { + addCriterion("query_rule is not null"); + return (Criteria) this; + } + + public Criteria andQueryRuleEqualTo(String value) { + addCriterion("query_rule =", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleNotEqualTo(String value) { + addCriterion("query_rule <>", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleGreaterThan(String value) { + addCriterion("query_rule >", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleGreaterThanOrEqualTo(String value) { + addCriterion("query_rule >=", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleLessThan(String value) { + addCriterion("query_rule <", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleLessThanOrEqualTo(String value) { + addCriterion("query_rule <=", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleLike(String value) { + addCriterion("query_rule like", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleNotLike(String value) { + addCriterion("query_rule not like", value, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleIn(List values) { + addCriterion("query_rule in", values, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleNotIn(List values) { + addCriterion("query_rule not in", values, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleBetween(String value1, String value2) { + addCriterion("query_rule between", value1, value2, "queryRule"); + return (Criteria) this; + } + + public Criteria andQueryRuleNotBetween(String value1, String value2) { + addCriterion("query_rule not between", value1, value2, "queryRule"); + return (Criteria) this; + } + + public Criteria andOrganizationIdIsNull() { + addCriterion("organization_id is null"); + return (Criteria) this; + } + + public Criteria andOrganizationIdIsNotNull() { + addCriterion("organization_id is not null"); + return (Criteria) this; + } + + public Criteria andOrganizationIdEqualTo(Long value) { + addCriterion("organization_id =", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotEqualTo(Long value) { + addCriterion("organization_id <>", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdGreaterThan(Long value) { + addCriterion("organization_id >", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdGreaterThanOrEqualTo(Long value) { + addCriterion("organization_id >=", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdLessThan(Long value) { + addCriterion("organization_id <", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdLessThanOrEqualTo(Long value) { + addCriterion("organization_id <=", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdIn(List values) { + addCriterion("organization_id in", values, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotIn(List values) { + addCriterion("organization_id not in", values, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdBetween(Long value1, Long value2) { + addCriterion("organization_id between", value1, value2, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotBetween(Long value1, Long value2) { + addCriterion("organization_id not between", value1, value2, "organizationId"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOption.java b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOption.java new file mode 100644 index 0000000..6828add --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOption.java @@ -0,0 +1,95 @@ +package com.ccsens.carbasics.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class OcrKeywordOption implements Serializable { + private Long id; + + private String code; + + private String answer; + + private Long keywordId; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code == null ? null : code.trim(); + } + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer == null ? null : answer.trim(); + } + + public Long getKeywordId() { + return keywordId; + } + + public void setKeywordId(Long keywordId) { + this.keywordId = keywordId; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", code=").append(code); + sb.append(", answer=").append(answer); + sb.append(", keywordId=").append(keywordId); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOptionExample.java b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOptionExample.java new file mode 100644 index 0000000..fc89d55 --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/bean/po/OcrKeywordOptionExample.java @@ -0,0 +1,641 @@ +package com.ccsens.carbasics.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class OcrKeywordOptionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public OcrKeywordOptionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andCodeIsNull() { + addCriterion("code is null"); + return (Criteria) this; + } + + public Criteria andCodeIsNotNull() { + addCriterion("code is not null"); + return (Criteria) this; + } + + public Criteria andCodeEqualTo(String value) { + addCriterion("code =", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotEqualTo(String value) { + addCriterion("code <>", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThan(String value) { + addCriterion("code >", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThanOrEqualTo(String value) { + addCriterion("code >=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThan(String value) { + addCriterion("code <", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThanOrEqualTo(String value) { + addCriterion("code <=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLike(String value) { + addCriterion("code like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotLike(String value) { + addCriterion("code not like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeIn(List values) { + addCriterion("code in", values, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotIn(List values) { + addCriterion("code not in", values, "code"); + return (Criteria) this; + } + + public Criteria andCodeBetween(String value1, String value2) { + addCriterion("code between", value1, value2, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotBetween(String value1, String value2) { + addCriterion("code not between", value1, value2, "code"); + return (Criteria) this; + } + + public Criteria andAnswerIsNull() { + addCriterion("answer is null"); + return (Criteria) this; + } + + public Criteria andAnswerIsNotNull() { + addCriterion("answer is not null"); + return (Criteria) this; + } + + public Criteria andAnswerEqualTo(String value) { + addCriterion("answer =", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerNotEqualTo(String value) { + addCriterion("answer <>", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerGreaterThan(String value) { + addCriterion("answer >", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerGreaterThanOrEqualTo(String value) { + addCriterion("answer >=", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerLessThan(String value) { + addCriterion("answer <", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerLessThanOrEqualTo(String value) { + addCriterion("answer <=", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerLike(String value) { + addCriterion("answer like", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerNotLike(String value) { + addCriterion("answer not like", value, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerIn(List values) { + addCriterion("answer in", values, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerNotIn(List values) { + addCriterion("answer not in", values, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerBetween(String value1, String value2) { + addCriterion("answer between", value1, value2, "answer"); + return (Criteria) this; + } + + public Criteria andAnswerNotBetween(String value1, String value2) { + addCriterion("answer not between", value1, value2, "answer"); + return (Criteria) this; + } + + public Criteria andKeywordIdIsNull() { + addCriterion("keyword_id is null"); + return (Criteria) this; + } + + public Criteria andKeywordIdIsNotNull() { + addCriterion("keyword_id is not null"); + return (Criteria) this; + } + + public Criteria andKeywordIdEqualTo(Long value) { + addCriterion("keyword_id =", value, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdNotEqualTo(Long value) { + addCriterion("keyword_id <>", value, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdGreaterThan(Long value) { + addCriterion("keyword_id >", value, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdGreaterThanOrEqualTo(Long value) { + addCriterion("keyword_id >=", value, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdLessThan(Long value) { + addCriterion("keyword_id <", value, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdLessThanOrEqualTo(Long value) { + addCriterion("keyword_id <=", value, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdIn(List values) { + addCriterion("keyword_id in", values, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdNotIn(List values) { + addCriterion("keyword_id not in", values, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdBetween(Long value1, Long value2) { + addCriterion("keyword_id between", value1, value2, "keywordId"); + return (Criteria) this; + } + + public Criteria andKeywordIdNotBetween(Long value1, Long value2) { + addCriterion("keyword_id not between", value1, value2, "keywordId"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/QuestionOcrVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/QuestionOcrVo.java index 420ad15..d80f690 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/QuestionOcrVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/QuestionOcrVo.java @@ -1,5 +1,6 @@ package com.ccsens.carbasics.bean.vo; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -38,4 +39,18 @@ public class QuestionOcrVo { @ApiModelProperty("结束标识") private String end; } + + @ApiModel("报告单图片文字通用识别-返回") + @Data + public static class CodeAndAnswer{ + @ApiModelProperty("code") + private String code; + @ApiModelProperty("答案") + private String answer; + @ApiModelProperty("是否通过验证(0否,1是)") + private Byte isOk; + @JsonIgnore + @ApiModelProperty("匹配中的文字") + private String matchStr; + } } diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidRecordDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidRecordDao.java index 23bba7b..80565b7 100644 --- a/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidRecordDao.java +++ b/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidRecordDao.java @@ -162,4 +162,11 @@ public interface FirstAidRecordDao extends FirstAidRecordMapper { * @return 返回质控信息 */ List provinceCityStatistical(@Param("code")String code); + + /** + * 查询发病时间 + * @param firstAidId 急救id + * @return 发病时间戳 + */ + Long queryDiseaseTime(@Param("firstAidId") Long firstAidId); } diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordDao.java new file mode 100644 index 0000000..6851bb4 --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordDao.java @@ -0,0 +1,25 @@ +package com.ccsens.carbasics.persist.dao; + +import com.ccsens.carbasics.bean.po.OcrKeyword; +import com.ccsens.carbasics.persist.mapper.OcrKeywordMapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface OcrKeywordDao extends OcrKeywordMapper { + /** + * 根据医院id查询所有关键词 + * @param hospitalId 医院id + * @return 关键词列表 + */ + List queryByHospital(@Param("hospitalId") Long hospitalId); + + /** + * 查询出院时间 + * @param hospitalId 医院id + * @return 出院时间关键词信息 + */ + OcrKeyword queryDischargeTime(@Param("hospitalId") Long hospitalId); +} diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordOptionDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordOptionDao.java new file mode 100644 index 0000000..2628878 --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/persist/dao/OcrKeywordOptionDao.java @@ -0,0 +1,18 @@ +package com.ccsens.carbasics.persist.dao; + +import com.ccsens.carbasics.bean.po.OcrKeywordOption; +import com.ccsens.carbasics.persist.mapper.OcrKeywordOptionMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface OcrKeywordOptionDao extends OcrKeywordOptionMapper { + + /** + * 根据关键字id查询选项 + * @param keyId 关键字id + * @return 选项列表 + */ + List queryByKeyId(Long keyId); +} diff --git a/src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordMapper.java b/src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordMapper.java new file mode 100644 index 0000000..1de48e2 --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.carbasics.persist.mapper; + +import com.ccsens.carbasics.bean.po.OcrKeyword; +import com.ccsens.carbasics.bean.po.OcrKeywordExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface OcrKeywordMapper { + long countByExample(OcrKeywordExample example); + + int deleteByExample(OcrKeywordExample example); + + int deleteByPrimaryKey(Long id); + + int insert(OcrKeyword record); + + int insertSelective(OcrKeyword record); + + List selectByExample(OcrKeywordExample example); + + OcrKeyword selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") OcrKeyword record, @Param("example") OcrKeywordExample example); + + int updateByExample(@Param("record") OcrKeyword record, @Param("example") OcrKeywordExample example); + + int updateByPrimaryKeySelective(OcrKeyword record); + + int updateByPrimaryKey(OcrKeyword record); +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordOptionMapper.java b/src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordOptionMapper.java new file mode 100644 index 0000000..9ae9bde --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/persist/mapper/OcrKeywordOptionMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.carbasics.persist.mapper; + +import com.ccsens.carbasics.bean.po.OcrKeywordOption; +import com.ccsens.carbasics.bean.po.OcrKeywordOptionExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface OcrKeywordOptionMapper { + long countByExample(OcrKeywordOptionExample example); + + int deleteByExample(OcrKeywordOptionExample example); + + int deleteByPrimaryKey(Long id); + + int insert(OcrKeywordOption record); + + int insertSelective(OcrKeywordOption record); + + List selectByExample(OcrKeywordOptionExample example); + + OcrKeywordOption selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") OcrKeywordOption record, @Param("example") OcrKeywordOptionExample example); + + int updateByExample(@Param("record") OcrKeywordOption record, @Param("example") OcrKeywordOptionExample example); + + int updateByPrimaryKeySelective(OcrKeywordOption record); + + int updateByPrimaryKey(OcrKeywordOption record); +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/carbasics/service/IOcrService.java b/src/main/java/com/ccsens/carbasics/service/IOcrService.java index 24297ca..b8f2528 100644 --- a/src/main/java/com/ccsens/carbasics/service/IOcrService.java +++ b/src/main/java/com/ccsens/carbasics/service/IOcrService.java @@ -3,8 +3,11 @@ package com.ccsens.carbasics.service; import com.ccsens.carbasics.bean.dto.OcrDto; import com.ccsens.carbasics.bean.vo.OcrVo; import com.ccsens.carbasics.bean.vo.QuestionOcrVo; +import org.springframework.web.multipart.MultipartFile; + import java.io.IOException; +import java.text.ParseException; import java.util.List; /** @@ -19,4 +22,14 @@ public interface IOcrService { * @return 文字列表 */ List identifyWords(OcrDto.GeneralBasic param, Long userId) throws IOException; + + + /** + * + * @param param 图片地址 + * @param userId 用户id + * @return 文字列表 + * @throws IOException 异常 + */ + List discernWords(List param, Long userId, Long firstAidId) throws IOException, ParseException; } diff --git a/src/main/java/com/ccsens/carbasics/service/OcrService.java b/src/main/java/com/ccsens/carbasics/service/OcrService.java index 280c695..2e557a3 100644 --- a/src/main/java/com/ccsens/carbasics/service/OcrService.java +++ b/src/main/java/com/ccsens/carbasics/service/OcrService.java @@ -2,23 +2,35 @@ package com.ccsens.carbasics.service; import cn.hutool.core.codec.Base64; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ImageUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.cloudapi.sdk.model.ApiResponse; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ccsens.carbasics.bean.dto.OcrDto; +import com.ccsens.carbasics.bean.po.FirstAid; +import com.ccsens.carbasics.bean.po.FirstAidRecord; +import com.ccsens.carbasics.bean.po.OcrKeyword; +import com.ccsens.carbasics.bean.po.OcrKeywordOption; import com.ccsens.carbasics.bean.vo.OcrVo; import com.ccsens.carbasics.bean.vo.QuestionOcrVo; -import com.ccsens.carbasics.persist.dao.QuestionOcrDao; +import com.ccsens.carbasics.persist.dao.*; import com.ccsens.carbasics.util.Constant; import com.ccsens.util.CodeEnum; +import com.ccsens.util.PoiUtil; +import com.ccsens.util.PropUtil; +import com.ccsens.util.WebConstant; import com.ccsens.util.ali.AliInstanceUtil; import com.ccsens.util.baidu.BaiDuDto; import com.ccsens.util.baidu.BaiDuUtil; import com.ccsens.util.baidu.BaiDuVo; import com.ccsens.util.exception.BaseException; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -26,13 +38,13 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.imageio.ImageIO; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.io.*; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; @Slf4j @Service @@ -41,101 +53,109 @@ public class OcrService implements IOcrService { @Resource private QuestionOcrDao questionOcrDao; + @Resource + private OcrKeywordDao ocrKeywordDao; + @Resource + private FirstAidDao firstAidDao; + @Resource + private FirstAidRecordDao firstAidRecordDao; + @Resource + private OcrKeywordOptionDao keywordOptionDao; @Override public List identifyWords(OcrDto.GeneralBasic generalBasic, Long userId) throws IOException { - long time1 = System.currentTimeMillis(); - List vos = new ArrayList<>(); - // 类型测评规则 - List rules = questionOcrDao.queryRules(generalBasic.getPatientId(), generalBasic.getCode()); - log.info("规则:{}", rules); - if (CollectionUtil.isEmpty(rules)) { - return vos; - } - long time2 = System.currentTimeMillis(); - log.info("查询规则时间:{}", time2 - time1); -// ReportOcrExample ocrExample = new ReportOcrExample(); -// ocrExample.createCriteria().andCodeEqualTo(generalBasic.getCode()); -// List reportOcrList = reportOcrMapper.selectByExample(ocrExample); - long time3 = System.currentTimeMillis(); - log.info("查询reportOrc:{}", time3 - time2); - -// boolean baidu = CollectionUtil.isEmpty(reportOcrList) || reportOcrList.get(0).getOcrChannel() != 1; - - // 识别字符串 - List contents = new ArrayList<>(); - long time4 = 0; - - //图片 -// CommonFile commonFile = commonFileMapper.selectByPrimaryKey(generalBasic.getFileId()); -// if (commonFile == null) { -// throw new BaseException(CodeEnum.PARAM_ERROR); +// long time1 = System.currentTimeMillis(); +// List vos = new ArrayList<>(); +// // 类型测评规则 +// List rules = questionOcrDao.queryRules(generalBasic.getPatientId(), generalBasic.getCode()); +// log.info("规则:{}", rules); +// if (CollectionUtil.isEmpty(rules)) { +// return vos; // } -// File file = new File(commonFile.getLocation()); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ImageUtil.scale(ImageIO.read((File)generalBasic.getFile()), out, 0.5f); -// Img.from(new URL(generalBasic.getUrl())).scale(0.5f).write(out); - String img = Base64.encode(out.toByteArray()); - -// if (baidu) { - BaiDuDto.GeneralBasic basic = new BaiDuDto.GeneralBasic(); -// basic.setUrl(generalBasic.getUrl()); - basic.setImage(img); - BaiDuVo.GeneralBasic words = BaiDuUtil.accurateBasic(Constant.BaiDu.APP_KEY, Constant.BaiDu.SECRET_KEY, basic); - log.info("文字识别:{}", words); - if (words == null || CollectionUtil.isEmpty(words.getWordsResult())) { - return vos; - } - words.getWordsResult().forEach(word -> contents.add(word.getWords())); -// } else { - // 阿里 -// String body = "{\"img\":\"\",\"url\":\""+generalBasic.getUrl()+"\",\"prob\":false,\"charInfo\":false,\"rotate\":false,\"table\":false}"; -// String body = "{\"img\":\""+img+"\",\"url\":\"\",\"prob\":false,\"charInfo\":false,\"rotate\":false,\"table\":false}"; -// ApiResponse response = AliInstanceUtil.getGeneralAdvancedHttps().ocrAdvancedSyncMode(body.getBytes()); -// time4 = System.currentTimeMillis(); -// log.info("阿里接口调用:{}", time4 -time3); -// log.info("调用阿里的通用识别接口,请求:{}, 返回:{}", body, response); -// int code = response.getCode(); -// int curCode = 200; -// if (code != curCode) { -// CodeEnum thirdError = CodeEnum.THIRD_ERROR; -// thirdError.setMsg(response.getMessage()); -// throw new BaseException(thirdError); -// } -// String result = new String(response.getBody()); -// log.info("result:{}", result); -// JSONObject json = JSONObject.parseObject(result); -// JSONArray infos = json.getJSONArray("prism_wordsInfo"); -// for (Object obj: infos) { -// JSONObject info = (JSONObject)obj; -// contents.add(info.getString("word").replaceAll("\\s+","")); +// long time2 = System.currentTimeMillis(); +// log.info("查询规则时间:{}", time2 - time1); +//// ReportOcrExample ocrExample = new ReportOcrExample(); +//// ocrExample.createCriteria().andCodeEqualTo(generalBasic.getCode()); +//// List reportOcrList = reportOcrMapper.selectByExample(ocrExample); +// long time3 = System.currentTimeMillis(); +// log.info("查询reportOrc:{}", time3 - time2); +// +//// boolean baidu = CollectionUtil.isEmpty(reportOcrList) || reportOcrList.get(0).getOcrChannel() != 1; +// +// // 识别字符串 +// List contents = new ArrayList<>(); +// long time4 = 0; +// +// //图片 +//// CommonFile commonFile = commonFileMapper.selectByPrimaryKey(generalBasic.getFileId()); +//// if (commonFile == null) { +//// throw new BaseException(CodeEnum.PARAM_ERROR); +//// } +//// File file = new File(commonFile.getLocation()); +// ByteArrayOutputStream out = new ByteArrayOutputStream(); +// ImageUtil.scale(ImageIO.read((File)generalBasic.getFile()), out, 0.5f); +//// Img.from(new URL(generalBasic.getUrl())).scale(0.5f).write(out); +// String img = Base64.encode(out.toByteArray()); +// +//// if (baidu) { +// BaiDuDto.GeneralBasic basic = new BaiDuDto.GeneralBasic(); +//// basic.setUrl(generalBasic.getUrl()); +// basic.setImage(img); +// BaiDuVo.GeneralBasic words = BaiDuUtil.accurateBasic(Constant.BaiDu.APP_KEY, Constant.BaiDu.SECRET_KEY, basic); +// log.info("文字识别:{}", words); +// if (words == null || CollectionUtil.isEmpty(words.getWordsResult())) { +// return vos; +// } +// words.getWordsResult().forEach(word -> contents.add(word.getWords())); +//// } else { +// // 阿里 +//// String body = "{\"img\":\"\",\"url\":\""+generalBasic.getUrl()+"\",\"prob\":false,\"charInfo\":false,\"rotate\":false,\"table\":false}"; +//// String body = "{\"img\":\""+img+"\",\"url\":\"\",\"prob\":false,\"charInfo\":false,\"rotate\":false,\"table\":false}"; +//// ApiResponse response = AliInstanceUtil.getGeneralAdvancedHttps().ocrAdvancedSyncMode(body.getBytes()); +//// time4 = System.currentTimeMillis(); +//// log.info("阿里接口调用:{}", time4 -time3); +//// log.info("调用阿里的通用识别接口,请求:{}, 返回:{}", body, response); +//// int code = response.getCode(); +//// int curCode = 200; +//// if (code != curCode) { +//// CodeEnum thirdError = CodeEnum.THIRD_ERROR; +//// thirdError.setMsg(response.getMessage()); +//// throw new BaseException(thirdError); +//// } +//// String result = new String(response.getBody()); +//// log.info("result:{}", result); +//// JSONObject json = JSONObject.parseObject(result); +//// JSONArray infos = json.getJSONArray("prism_wordsInfo"); +//// for (Object obj: infos) { +//// JSONObject info = (JSONObject)obj; +//// contents.add(info.getString("word").replaceAll("\\s+","")); +//// } +// Map keyMap = new HashMap<>(16); +// rules.forEach(rule -> { +// JSONObject start = StrUtil.isEmpty(rule.getStart()) ? null : JSONObject.parseObject(rule.getStart()); +// JSONObject end = StrUtil.isEmpty(rule.getEnd()) ? null : JSONObject.parseObject(rule.getEnd()); +// StringBuilder builder; +// +// if (start == null) { +// // 不知道这种场景 +// return; +// } else if (start.containsKey(Constant.BaiDu.NUM)) { +// // 包含读取第几个 +// builder = getContent(contents, keyMap, start); +// } else { +// builder = getContent(contents, start, end); // } - Map keyMap = new HashMap<>(16); - rules.forEach(rule -> { - JSONObject start = StrUtil.isEmpty(rule.getStart()) ? null : JSONObject.parseObject(rule.getStart()); - JSONObject end = StrUtil.isEmpty(rule.getEnd()) ? null : JSONObject.parseObject(rule.getEnd()); - StringBuilder builder; - - if (start == null) { - // 不知道这种场景 - return; - } else if (start.containsKey(Constant.BaiDu.NUM)) { - // 包含读取第几个 - builder = getContent(contents, keyMap, start); - } else { - builder = getContent(contents, start, end); - } - - QuestionOcrVo.GeneralBasic vo = new QuestionOcrVo.GeneralBasic(); - vo.setQuestionId(rule.getQuestionId()); - vo.setCode(rule.getCode()); - vo.setSort(rule.getSort()); - vo.setContent(builder.toString()); - vos.add(vo); - }); - long time5 = System.currentTimeMillis(); - log.info("数据处理时间:{}", time5 - time4); - return vos; +// +// QuestionOcrVo.GeneralBasic vo = new QuestionOcrVo.GeneralBasic(); +// vo.setQuestionId(rule.getQuestionId()); +// vo.setCode(rule.getCode()); +// vo.setSort(rule.getSort()); +// vo.setContent(builder.toString()); +// vos.add(vo); +// }); +// long time5 = System.currentTimeMillis(); +// log.info("数据处理时间:{}", time5 - time4); + return null; } private StringBuilder getContent(List contents, Map keyMap, JSONObject start) { @@ -174,6 +194,252 @@ public class OcrService implements IOcrService { return builder; } + + + @Override + public List discernWords(List param, Long userId,Long firstAidId) throws IOException, ParseException { + FirstAid firstAidInfo = firstAidDao.selectByPrimaryKey(firstAidId); + if (ObjectUtil.isNull(firstAidInfo)) { + throw new BaseException("急救信息错误"); + } + List resultList = new ArrayList<>(); + // TODO 查询关键字规则 (暂时没有根据医院id查询) + List ocrKeywordList = ocrKeywordDao.queryByHospital(firstAidInfo.getHospitalId()); + log.info("规则:{}", ocrKeywordList); + if (ObjectUtil.isNull(ocrKeywordList)) { + return resultList; + } + SimpleDateFormat frontTime = new SimpleDateFormat("yy-MM-ddHH:mm"); + String frontReg = "\\d{1,2}-\\d{1,2}-\\d{2,4}:\\d{1,2}"; + Pattern frontPat = Pattern.compile(frontReg); + SimpleDateFormat backTime = new SimpleDateFormat("yyyyMMddHH"); + String backReg = "\\d{1,6}:\\d{1,2}"; + Pattern backPat = Pattern.compile(backReg); + Calendar instance = Calendar.getInstance(); + int year = instance.get(Calendar.YEAR); + + //查询发病时间 + Long time = firstAidRecordDao.queryDiseaseTime(firstAidId); + + //识别图片,放入文字集合 + List strList = new ArrayList<>(); + Long startOcr = System.currentTimeMillis(); + for (MultipartFile file : param) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ImageUtil.scale(ImageIO.read(file.getInputStream()), out, 1); + String img = Base64.encode(out.toByteArray()); + BaiDuDto.GeneralBasic basic = new BaiDuDto.GeneralBasic(); + basic.setImage(img); + BaiDuVo.GeneralBasic words = BaiDuUtil.accurateBasic(Constant.BaiDu.APP_KEY, Constant.BaiDu.SECRET_KEY, basic); + log.info("文字识别:{}", words); + for (BaiDuVo.GeneralWord generalWord : words.getWordsResult()) { + strList.add(generalWord.getWords()); + } + + //保存图片 + String extName = FileUtil.extName(file.getOriginalFilename()); + String dir = PropUtil.path + File.separator + Constant.OrcImg.FILE_DIR; + String extraPath = DateUtil.format(new Date(), "yyyyMMdd"); + String path = extraPath + File.separator+firstAidId+firstAidInfo.getName()+File.separator+ IdUtil.simpleUUID() + "." + extName; + //转成file + File saveFile = new File(dir + extraPath); + if (!saveFile.exists()) { + saveFile.mkdirs(); + } + String fullPath = dir + File.separator + path; + FileUtil.writeFromStream(file.getInputStream(), fullPath); + + } + Long ocrEnd = System.currentTimeMillis(); + log.info("识图+保存文件花费时间{}",ocrEnd-startOcr); + if (CollectionUtil.isEmpty(strList)) { + return resultList; + } + //TODO 查询出院时间 (暂时没有根据医院id查询) + OcrKeyword dischargeTime = ocrKeywordDao.queryDischargeTime(firstAidInfo.getHospitalId()); + long timeOfDischarge = 0L; + if (ObjectUtil.isNotNull(dischargeTime)) { + for (String str : strList) { + if (str.contains(dischargeTime.getKeyword())) { + JSONObject jsonObject = JSONObject.parseObject(dischargeTime.getQueryRule()); + String start = jsonObject.getString("start"); + String end = jsonObject.getString("end"); + String substring = str.substring(str.indexOf(start), str.lastIndexOf(end)); + StringBuilder str2 = new StringBuilder(); + for(int i=0;i= 48 && str.charAt(i) <= 57) { + str2.append(str.charAt(i)); + } + } + SimpleDateFormat dischargeSdf = new SimpleDateFormat("yyyyMMddHH"); + timeOfDischarge = dischargeSdf.parse(str2.toString()).getTime(); + //将code与答案保存到结果集合 + giveCodeAndAnswer(resultList,dischargeTime.getId(),(byte)0,Long.toString(timeOfDischarge),str2.toString(),0L,timeOfDischarge); + } + } + } + + //循环关键字 + for (OcrKeyword ocrKeyword : ocrKeywordList) { + for (int i = 0; i < strList.size(); i++) { + String regKey = ".*("+ocrKeyword.getKeyword()+").*"; + if (strList.get(i).matches(regKey)){ + //校验 + if (0 != ocrKeyword.getVerifyType()){ + if (1 == ocrKeyword.getVerifyType()) { + + //验证发病时间 + if (ObjectUtil.isNull(time) || 0 == time) { + //是否出院带药 + Matcher backMatcher = backPat.matcher(strList.get(i + 1)); + long endTimestamp = 0L; + if (backMatcher.find()) { + String endTime = backMatcher.group(); + endTimestamp = backTime.parse(year + endTime).getTime(); + } + //将code与答案保存到结果集合 + giveCodeAndAnswer(resultList,ocrKeyword.getId(),(byte)0,"",strList.get(i),endTimestamp,timeOfDischarge); + }else { + Matcher frontMatcher = frontPat.matcher(strList.get(i)); + if (frontMatcher.find()){ + Matcher backMatcher = backPat.matcher(strList.get(i + 1)); + long endTimestamp = 0L; + if (backMatcher.find()) { + String endTime = backMatcher.group(); + endTimestamp = backTime.parse(year + endTime).getTime(); + } + String startTime = frontMatcher.group(); + if (frontTime.parse(startTime).getTime()-time <= Constant.OrcImg.HOVER_48){ + //将code与答案保存到结果集合 + giveCodeAndAnswer(resultList,ocrKeyword.getId(),(byte)1,"",strList.get(i),endTimestamp,timeOfDischarge); + }else{ + //将code与答案保存到结果集合 + giveCodeAndAnswer(resultList,ocrKeyword.getId(),(byte)0,"",strList.get(i),endTimestamp,timeOfDischarge); + } + + } + } + + } + } + + //关键字排除 + if (StrUtil.isNotBlank(ocrKeyword.getKeywordExclude())){ + String[] split = ocrKeyword.getKeywordExclude().split("\\|"); + for (String exclude : split) { + for (int j = 0; j < resultList.size(); j++) { + if (resultList.get(j).getMatchStr().contains(exclude)){ + resultList.remove(j); + } + } + } + + String regExclude = ".*("+ocrKeyword.getKeywordExclude()+").*"; + if (strList.get(i).contains(ocrKeyword.getKeyword()) && !strList.get(i).matches(regExclude)) { + //查询结束的时间 + Matcher backMatcher = backPat.matcher(strList.get(i + 1)); + long endTimestamp = 0L; + if (backMatcher.find()) { + String endTime = backMatcher.group(); + endTimestamp = backTime.parse(year + endTime).getTime(); + } + //将code与答案保存到结果集合 + giveCodeAndAnswer(resultList,ocrKeyword.getId(),(byte)0,"无",strList.get(i),endTimestamp,timeOfDischarge); + } + } + + //查询规则 + if (StrUtil.isNotBlank(ocrKeyword.getQueryRule())){ + if (ocrKeyword.getKeyword().equals(dischargeTime.getKeyword())){ + continue; + } + JSONObject jsonObject = JSONObject.parseObject(ocrKeyword.getQueryRule()); + String start = jsonObject.getString("start"); + String end = jsonObject.getString("end"); + if (strList.get(i).contains(start) && strList.get(i).contains(end)) { + log.info("字符串:{}",strList.get(i)); + String substring = strList.get(i).substring(strList.get(i).indexOf(start) + start.length(), strList.get(i).lastIndexOf(end)); + String newStr = substring.replaceAll("[^\u4E00-\u9FA5]", ""); + //查询结束的时间 + Matcher backMatcher = backPat.matcher(strList.get(i + 1)); + long endTimestamp = 0L; + if (backMatcher.find()) { + String endTime = backMatcher.group(); + endTimestamp = backTime.parse(year + endTime).getTime(); + } + //将code与答案保存到结果集合 + giveCodeAndAnswer(resultList,ocrKeyword.getId(),(byte)0,newStr,strList.get(i),endTimestamp,timeOfDischarge); + } + } + + + if (0 == ocrKeyword.getVerifyType() && StrUtil.isBlank(ocrKeyword.getKeywordExclude()) && StrUtil.isBlank(ocrKeyword.getQueryRule())) { + //查询结束的时间 + Matcher backMatcher = backPat.matcher(strList.get(i + 1)); + long endTimestamp = 0L; + if (backMatcher.find()) { + String endTime = backMatcher.group(); + endTimestamp = backTime.parse(year + endTime).getTime(); + } + //将code与答案保存到结果集合 + giveCodeAndAnswer(resultList,ocrKeyword.getId(),(byte)0,"",strList.get(i),endTimestamp,timeOfDischarge); + } + } + } + } + ArrayList newList = resultList.stream().collect(Collectors + .collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(QuestionOcrVo.CodeAndAnswer::getAnswer))), ArrayList::new)); + return newList; + } + + /** + * 保存code与答案 + * @param resultList 保存结果的集合 + * @param keyId 关键词id + * @param isOk 是否验证(0-否,1-是) + * @param answer 答案(选项是无,使用此答案) + * @param matchStr 匹配到的字符串 + * @param endTime 结束时间 + * @param timeOfDischarge 出院时间 + */ + public void giveCodeAndAnswer(List resultList,Long keyId,Byte isOk,String answer,String matchStr,Long endTime,Long timeOfDischarge) { + List keywordOptionList = keywordOptionDao.queryByKeyId(keyId); + if (CollectionUtil.isNotEmpty(keywordOptionList)) { + for (OcrKeywordOption ocrKeywordOption : keywordOptionList) { + // TODO 出院带药 code: CYQK-CYDY + if ("CYQK-CYDY".equals(ocrKeywordOption.getCode())){ + //出院带药 校验时间 + QuestionOcrVo.CodeAndAnswer result = new QuestionOcrVo.CodeAndAnswer(); + result.setCode(ocrKeywordOption.getCode()); + result.setAnswer(ocrKeywordOption.getAnswer()); + if (0 != endTime && 0 != timeOfDischarge) { + if (endTime > timeOfDischarge) { + result.setIsOk((byte)1); + }else{ + result.setIsOk((byte)0); + } + }else{ + result.setIsOk((byte)0); + } + result.setMatchStr(matchStr); + resultList.add(result); + }else { + QuestionOcrVo.CodeAndAnswer result = new QuestionOcrVo.CodeAndAnswer(); + result.setCode(ocrKeywordOption.getCode()); + if ("无".equals(ocrKeywordOption.getAnswer())) { + result.setAnswer(answer); + }else { + result.setAnswer(ocrKeywordOption.getAnswer()); + } + result.setIsOk(isOk); + result.setMatchStr(matchStr); + resultList.add(result); + } + + } + } + } + } diff --git a/src/main/java/com/ccsens/carbasics/util/Constant.java b/src/main/java/com/ccsens/carbasics/util/Constant.java index e55dfaa..d1fcc17 100644 --- a/src/main/java/com/ccsens/carbasics/util/Constant.java +++ b/src/main/java/com/ccsens/carbasics/util/Constant.java @@ -1,5 +1,6 @@ package com.ccsens.carbasics.util; +import java.io.File; import java.util.HashMap; import java.util.Map; @@ -320,4 +321,14 @@ public class Constant { } } } + + /** + * orc相关 + */ + public final static class OrcImg { + //48小时 + public static final Long HOVER_48 = 172800000L; + + public static final String FILE_DIR = "orcImage" + File.separator; + } } diff --git a/src/main/resources/mapper_dao/FirstAidRecordDao.xml b/src/main/resources/mapper_dao/FirstAidRecordDao.xml index 79af753..652a62e 100644 --- a/src/main/resources/mapper_dao/FirstAidRecordDao.xml +++ b/src/main/resources/mapper_dao/FirstAidRecordDao.xml @@ -605,4 +605,15 @@ AND p.rec_status = 0 AND o.rec_status = 0 + + diff --git a/src/main/resources/mapper_dao/OcrKeywordDao.xml b/src/main/resources/mapper_dao/OcrKeywordDao.xml new file mode 100644 index 0000000..ddeffc8 --- /dev/null +++ b/src/main/resources/mapper_dao/OcrKeywordDao.xml @@ -0,0 +1,41 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper_dao/OcrKeywordOptionDao.xml b/src/main/resources/mapper_dao/OcrKeywordOptionDao.xml new file mode 100644 index 0000000..87f8063 --- /dev/null +++ b/src/main/resources/mapper_dao/OcrKeywordOptionDao.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper_raw/OcrKeywordMapper.xml b/src/main/resources/mapper_raw/OcrKeywordMapper.xml new file mode 100644 index 0000000..3a8ed90 --- /dev/null +++ b/src/main/resources/mapper_raw/OcrKeywordMapper.xml @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, code, option, keyword, keyword_exclude, verify_type, query_rule, organization_id, + created_at, updated_at, rec_status + + + + + delete from t_qcp_ocr_keyword + where id = #{id,jdbcType=BIGINT} + + + delete from t_qcp_ocr_keyword + + + + + + insert into t_qcp_ocr_keyword (id, code, option, + keyword, keyword_exclude, verify_type, + query_rule, organization_id, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{option,jdbcType=VARCHAR}, + #{keyword,jdbcType=VARCHAR}, #{keywordExclude,jdbcType=VARCHAR}, #{verifyType,jdbcType=TINYINT}, + #{queryRule,jdbcType=VARCHAR}, #{organizationId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_qcp_ocr_keyword + + + id, + + + code, + + + option, + + + keyword, + + + keyword_exclude, + + + verify_type, + + + query_rule, + + + organization_id, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{code,jdbcType=VARCHAR}, + + + #{option,jdbcType=VARCHAR}, + + + #{keyword,jdbcType=VARCHAR}, + + + #{keywordExclude,jdbcType=VARCHAR}, + + + #{verifyType,jdbcType=TINYINT}, + + + #{queryRule,jdbcType=VARCHAR}, + + + #{organizationId,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_qcp_ocr_keyword + + + id = #{record.id,jdbcType=BIGINT}, + + + code = #{record.code,jdbcType=VARCHAR}, + + + option = #{record.option,jdbcType=VARCHAR}, + + + keyword = #{record.keyword,jdbcType=VARCHAR}, + + + keyword_exclude = #{record.keywordExclude,jdbcType=VARCHAR}, + + + verify_type = #{record.verifyType,jdbcType=TINYINT}, + + + query_rule = #{record.queryRule,jdbcType=VARCHAR}, + + + organization_id = #{record.organizationId,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_qcp_ocr_keyword + set id = #{record.id,jdbcType=BIGINT}, + code = #{record.code,jdbcType=VARCHAR}, + option = #{record.option,jdbcType=VARCHAR}, + keyword = #{record.keyword,jdbcType=VARCHAR}, + keyword_exclude = #{record.keywordExclude,jdbcType=VARCHAR}, + verify_type = #{record.verifyType,jdbcType=TINYINT}, + query_rule = #{record.queryRule,jdbcType=VARCHAR}, + organization_id = #{record.organizationId,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_qcp_ocr_keyword + + + code = #{code,jdbcType=VARCHAR}, + + + option = #{option,jdbcType=VARCHAR}, + + + keyword = #{keyword,jdbcType=VARCHAR}, + + + keyword_exclude = #{keywordExclude,jdbcType=VARCHAR}, + + + verify_type = #{verifyType,jdbcType=TINYINT}, + + + query_rule = #{queryRule,jdbcType=VARCHAR}, + + + organization_id = #{organizationId,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_qcp_ocr_keyword + set code = #{code,jdbcType=VARCHAR}, + option = #{option,jdbcType=VARCHAR}, + keyword = #{keyword,jdbcType=VARCHAR}, + keyword_exclude = #{keywordExclude,jdbcType=VARCHAR}, + verify_type = #{verifyType,jdbcType=TINYINT}, + query_rule = #{queryRule,jdbcType=VARCHAR}, + organization_id = #{organizationId,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/src/main/resources/mapper_raw/OcrKeywordOptionMapper.xml b/src/main/resources/mapper_raw/OcrKeywordOptionMapper.xml new file mode 100644 index 0000000..a25680e --- /dev/null +++ b/src/main/resources/mapper_raw/OcrKeywordOptionMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, code, answer, keyword_id, created_at, updated_at, rec_status + + + + + delete from t_qcp_ocr_keyword_option + where id = #{id,jdbcType=BIGINT} + + + delete from t_qcp_ocr_keyword_option + + + + + + insert into t_qcp_ocr_keyword_option (id, code, answer, + keyword_id, created_at, updated_at, + rec_status) + values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR}, + #{keywordId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}) + + + insert into t_qcp_ocr_keyword_option + + + id, + + + code, + + + answer, + + + keyword_id, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{code,jdbcType=VARCHAR}, + + + #{answer,jdbcType=VARCHAR}, + + + #{keywordId,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_qcp_ocr_keyword_option + + + id = #{record.id,jdbcType=BIGINT}, + + + code = #{record.code,jdbcType=VARCHAR}, + + + answer = #{record.answer,jdbcType=VARCHAR}, + + + keyword_id = #{record.keywordId,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_qcp_ocr_keyword_option + set id = #{record.id,jdbcType=BIGINT}, + code = #{record.code,jdbcType=VARCHAR}, + answer = #{record.answer,jdbcType=VARCHAR}, + keyword_id = #{record.keywordId,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_qcp_ocr_keyword_option + + + code = #{code,jdbcType=VARCHAR}, + + + answer = #{answer,jdbcType=VARCHAR}, + + + keyword_id = #{keywordId,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_qcp_ocr_keyword_option + set code = #{code,jdbcType=VARCHAR}, + answer = #{answer,jdbcType=VARCHAR}, + keyword_id = #{keywordId,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/src/main/resources/mbg.xml b/src/main/resources/mbg.xml index dc697de..ee3b1f7 100644 --- a/src/main/resources/mbg.xml +++ b/src/main/resources/mbg.xml @@ -56,7 +56,9 @@ -
+ + +
From 2dbec89e118aa8386f060cf7fef371f6b209bb17 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Sat, 18 Sep 2021 15:37:03 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E6=BC=94=E7=A4=BA=E6=82=A3=E8=80=85?= =?UTF-8?q?=E4=B8=8D=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper_dao/FirstAidDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index 55c3fdd..4dfc8d2 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -80,7 +80,8 @@ FROM t_qcp_first_aid WHERE - 1=1 + hospital_id = #{hospitalId} + AND value_type = 0 and data_status = #{param.dataStatus} AND `name` LIKE concat('%',#{param.name},'%') @@ -89,7 +90,6 @@ AND idcard LIKE concat('%',#{param.idcard},'%') AND rec_status = 0 - AND hospital_id = #{hospitalId} #{id} From 44df3a6f2423828724fa7a9794366df245231a27 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Sat, 18 Sep 2021 15:41:22 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E6=BC=94=E7=A4=BA=E6=82=A3=E8=80=85?= =?UTF-8?q?=E4=B8=8D=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper_dao/FirstAidDao.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index 4dfc8d2..6b6313a 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -147,6 +147,7 @@ t_qcp_first_aid WHERE data_status in (1,3,5,6) + AND value_type = 0 AND `name` LIKE concat('%',#{param.name},'%') From a11a99b8029c2d957b970f5ef3db07478d488833 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Wed, 22 Sep 2021 15:10:31 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9ocr=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=85=A5=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccsens/carbasics/api/OcrController.java | 4 ++-- .../carbasics/persist/dao/FirstAidDao.java | 6 +++++ .../ccsens/carbasics/service/OcrService.java | 9 ++++---- src/main/resources/mapper_dao/FirstAidDao.xml | 23 +++++++++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/api/OcrController.java b/src/main/java/com/ccsens/carbasics/api/OcrController.java index 66ac670..7775e9f 100644 --- a/src/main/java/com/ccsens/carbasics/api/OcrController.java +++ b/src/main/java/com/ccsens/carbasics/api/OcrController.java @@ -67,9 +67,9 @@ public class OcrController { @MustLogin @ApiOperation(value = "图片文字识别",notes = "") @RequestMapping(value="/general/basic",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) - public JsonResponse> queryInpatient(QueryDto> params, Long firstAidId) throws Exception { + public JsonResponse> queryInpatient(QueryDto> params, Long projectId) throws Exception { log.info("图片文字识别请求:{}", params); - List words = ocrService.discernWords(params.getParam(), params.getUserId(),firstAidId); + List words = ocrService.discernWords(params.getParam(), params.getUserId(),projectId); log.info("图片文字识别结束:{}", words); return JsonResponse.newInstance().ok(words); } diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java index c7c4038..1d5c33c 100644 --- a/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java +++ b/src/main/java/com/ccsens/carbasics/persist/dao/FirstAidDao.java @@ -49,4 +49,10 @@ public interface FirstAidDao extends FirstAidMapper { */ List querySelf(@Param("param") PatientDto.QueryPatient param, @Param("userId") Long userId); + /** + * 根据项目id查询急救信息 + * @param projectId 项目id + * @return 急救信息 + */ + FirstAid queryByProjectId(@Param("projectId") Long projectId); } diff --git a/src/main/java/com/ccsens/carbasics/service/OcrService.java b/src/main/java/com/ccsens/carbasics/service/OcrService.java index 2e557a3..1f07597 100644 --- a/src/main/java/com/ccsens/carbasics/service/OcrService.java +++ b/src/main/java/com/ccsens/carbasics/service/OcrService.java @@ -197,8 +197,9 @@ public class OcrService implements IOcrService { @Override - public List discernWords(List param, Long userId,Long firstAidId) throws IOException, ParseException { - FirstAid firstAidInfo = firstAidDao.selectByPrimaryKey(firstAidId); + public List discernWords(List param, Long userId,Long projectId) throws IOException, ParseException { +// FirstAid firstAidInfo = firstAidDao.selectByPrimaryKey(firstAidId); + FirstAid firstAidInfo = firstAidDao.queryByProjectId(projectId); if (ObjectUtil.isNull(firstAidInfo)) { throw new BaseException("急救信息错误"); } @@ -219,7 +220,7 @@ public class OcrService implements IOcrService { int year = instance.get(Calendar.YEAR); //查询发病时间 - Long time = firstAidRecordDao.queryDiseaseTime(firstAidId); + Long time = firstAidRecordDao.queryDiseaseTime(firstAidInfo.getId()); //识别图片,放入文字集合 List strList = new ArrayList<>(); @@ -240,7 +241,7 @@ public class OcrService implements IOcrService { String extName = FileUtil.extName(file.getOriginalFilename()); String dir = PropUtil.path + File.separator + Constant.OrcImg.FILE_DIR; String extraPath = DateUtil.format(new Date(), "yyyyMMdd"); - String path = extraPath + File.separator+firstAidId+firstAidInfo.getName()+File.separator+ IdUtil.simpleUUID() + "." + extName; + String path = extraPath + File.separator+firstAidInfo.getId()+firstAidInfo.getName()+File.separator+ IdUtil.simpleUUID() + "." + extName; //转成file File saveFile = new File(dir + extraPath); if (!saveFile.exists()) { diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index 6b6313a..1ee5503 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -183,4 +183,27 @@ GROUP BY t.firstAidId ORDER BY t.updated_at DESC + + From 7db5768f7107efb8da7c2059786df50245beb068 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Wed, 22 Sep 2021 17:53:35 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E5=8C=BB=E9=99=A2=E6=8E=92=E5=90=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../carbasics/api/StatisticalController.java | 4 +-- .../resources/mapper_dao/OrganizationDao.xml | 25 ++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/api/StatisticalController.java b/src/main/java/com/ccsens/carbasics/api/StatisticalController.java index 203964b..6a7f94c 100644 --- a/src/main/java/com/ccsens/carbasics/api/StatisticalController.java +++ b/src/main/java/com/ccsens/carbasics/api/StatisticalController.java @@ -161,9 +161,9 @@ public class StatisticalController { @ApiOperation(value = "山西省地市查询", notes = "山西省地市查询") @RequestMapping(value = "/provinceCity", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse> provinceCityStatistical(@ApiParam @Validated @RequestBody QueryDto params) { - log.info("各地-溶栓患者/机械再通/脑出血:{}", params); + log.info("山西省地市查询:{}", params); List provinceCity = statisticalService.provinceCityStatistical(params.getParam(), params.getUserId()); - log.info("各地-溶栓患者/机械再通/脑出血结果:{}", provinceCity); + log.info("山西省地市查询结果:{}", provinceCity); return JsonResponse.newInstance().ok(provinceCity); } } diff --git a/src/main/resources/mapper_dao/OrganizationDao.xml b/src/main/resources/mapper_dao/OrganizationDao.xml index 5aebc55..5af62a5 100644 --- a/src/main/resources/mapper_dao/OrganizationDao.xml +++ b/src/main/resources/mapper_dao/OrganizationDao.xml @@ -135,14 +135,19 @@ IF( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild FROM ( SELECT t.*, p.parent_id FROM t_organization t, t_organization_parent p WHERE t.id = p.organization_id ORDER BY parent_id, id ) t1, - ( SELECT @pids := 2 ) t2 + + ( SELECT @pids := 0 ) t2 + ( SELECT @pids := #{areaId} ) t2 + ) t3 WHERE - ischild != 0 + organizationType = 3 + + and ischild != 0 + AND level = #{level} - AND organizationType = 3
) h @@ -230,14 +235,22 @@ IF( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild FROM ( SELECT t.*, p.parent_id FROM t_organization t, t_organization_parent p WHERE t.id = p.organization_id ORDER BY parent_id, id ) t1, - ( SELECT @pids := 2 ) t2 + + ( SELECT @pids := 0 ) t2 + ( SELECT @pids := #{areaId} ) t2 + + ) t3 WHERE - ischild != 0 + organizationType = 3 + + and ischild != 0 + + AND level = #{level} - AND organizationType = 3 + ) h From c16bbcb33986c4707ce26b60379b4c69732668f3 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 23 Sep 2021 11:08:30 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E6=BA=B6=E6=A0=93=E7=8E=87=E5=8E=BB?= =?UTF-8?q?=E6=8E=89%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ccsens/carbasics/service/StatisticalService.java | 2 +- src/main/resources/mapper_dao/FirstAidRecordDao.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/service/StatisticalService.java b/src/main/java/com/ccsens/carbasics/service/StatisticalService.java index 3d3a23e..0422847 100644 --- a/src/main/java/com/ccsens/carbasics/service/StatisticalService.java +++ b/src/main/java/com/ccsens/carbasics/service/StatisticalService.java @@ -157,7 +157,7 @@ public class StatisticalService implements IStatisticalService { hospitalIds, param.getStartTime(), param.getEndTime()); // 溶栓率 四舍五入,保留两位 52.33% String rate = timeWindowPatient == null || timeWindowPatient == 0 ? "" : - new BigDecimal(thrombosis*100.00).divide(new BigDecimal(timeWindowPatient), 2, BigDecimal.ROUND_HALF_UP) + "%"; + new BigDecimal(thrombosis*100.00).divide(new BigDecimal(timeWindowPatient), 2, BigDecimal.ROUND_HALF_UP) + ""; common.setTotal(rate); List newItems = fillItems(items, param.getStartTime(), param.getEndTime(), param.getCountType()); common.setList(newItems); diff --git a/src/main/resources/mapper_dao/FirstAidRecordDao.xml b/src/main/resources/mapper_dao/FirstAidRecordDao.xml index 652a62e..82945ab 100644 --- a/src/main/resources/mapper_dao/FirstAidRecordDao.xml +++ b/src/main/resources/mapper_dao/FirstAidRecordDao.xml @@ -92,7 +92,7 @@ and unix_timestamp(created_at)*1000 >= #{startTime} and unix_timestamp(created_at)*1000 <= #{endTime} and rec_status = 0 + SELECT + id, + area_name AS `name` + FROM + t_area + WHERE + rec_status = 0 + AND area_type = 0 + AND area_parent_id = #{id} + + + diff --git a/src/main/resources/mapper_dao/QuestionnaireDao.xml b/src/main/resources/mapper_dao/QuestionnaireDao.xml new file mode 100644 index 0000000..57a017b --- /dev/null +++ b/src/main/resources/mapper_dao/QuestionnaireDao.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper_dao/QuestionnaireDetailDao.xml b/src/main/resources/mapper_dao/QuestionnaireDetailDao.xml new file mode 100644 index 0000000..7766441 --- /dev/null +++ b/src/main/resources/mapper_dao/QuestionnaireDetailDao.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/main/resources/mapper_raw/AreaMapper.xml b/src/main/resources/mapper_raw/AreaMapper.xml new file mode 100644 index 0000000..9a940ff --- /dev/null +++ b/src/main/resources/mapper_raw/AreaMapper.xml @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, area_name, area_code, area_short, area_status, area_parent_id, init_date, init_addr, + area_type, created_at, updated_at, rec_status + + + + + delete from t_area + where id = #{id,jdbcType=INTEGER} + + + delete from t_area + + + + + + insert into t_area (id, area_name, area_code, + area_short, area_status, area_parent_id, + init_date, init_addr, area_type, + created_at, updated_at, rec_status + ) + values (#{id,jdbcType=INTEGER}, #{areaName,jdbcType=VARCHAR}, #{areaCode,jdbcType=VARCHAR}, + #{areaShort,jdbcType=VARCHAR}, #{areaStatus,jdbcType=TINYINT}, #{areaParentId,jdbcType=INTEGER}, + #{initDate,jdbcType=TIMESTAMP}, #{initAddr,jdbcType=VARCHAR}, #{areaType,jdbcType=TINYINT}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} + ) + + + insert into t_area + + + id, + + + area_name, + + + area_code, + + + area_short, + + + area_status, + + + area_parent_id, + + + init_date, + + + init_addr, + + + area_type, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=INTEGER}, + + + #{areaName,jdbcType=VARCHAR}, + + + #{areaCode,jdbcType=VARCHAR}, + + + #{areaShort,jdbcType=VARCHAR}, + + + #{areaStatus,jdbcType=TINYINT}, + + + #{areaParentId,jdbcType=INTEGER}, + + + #{initDate,jdbcType=TIMESTAMP}, + + + #{initAddr,jdbcType=VARCHAR}, + + + #{areaType,jdbcType=TINYINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_area + + + id = #{record.id,jdbcType=INTEGER}, + + + area_name = #{record.areaName,jdbcType=VARCHAR}, + + + area_code = #{record.areaCode,jdbcType=VARCHAR}, + + + area_short = #{record.areaShort,jdbcType=VARCHAR}, + + + area_status = #{record.areaStatus,jdbcType=TINYINT}, + + + area_parent_id = #{record.areaParentId,jdbcType=INTEGER}, + + + init_date = #{record.initDate,jdbcType=TIMESTAMP}, + + + init_addr = #{record.initAddr,jdbcType=VARCHAR}, + + + area_type = #{record.areaType,jdbcType=TINYINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_area + set id = #{record.id,jdbcType=INTEGER}, + area_name = #{record.areaName,jdbcType=VARCHAR}, + area_code = #{record.areaCode,jdbcType=VARCHAR}, + area_short = #{record.areaShort,jdbcType=VARCHAR}, + area_status = #{record.areaStatus,jdbcType=TINYINT}, + area_parent_id = #{record.areaParentId,jdbcType=INTEGER}, + init_date = #{record.initDate,jdbcType=TIMESTAMP}, + init_addr = #{record.initAddr,jdbcType=VARCHAR}, + area_type = #{record.areaType,jdbcType=TINYINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_area + + + area_name = #{areaName,jdbcType=VARCHAR}, + + + area_code = #{areaCode,jdbcType=VARCHAR}, + + + area_short = #{areaShort,jdbcType=VARCHAR}, + + + area_status = #{areaStatus,jdbcType=TINYINT}, + + + area_parent_id = #{areaParentId,jdbcType=INTEGER}, + + + init_date = #{initDate,jdbcType=TIMESTAMP}, + + + init_addr = #{initAddr,jdbcType=VARCHAR}, + + + area_type = #{areaType,jdbcType=TINYINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=INTEGER} + + + update t_area + set area_name = #{areaName,jdbcType=VARCHAR}, + area_code = #{areaCode,jdbcType=VARCHAR}, + area_short = #{areaShort,jdbcType=VARCHAR}, + area_status = #{areaStatus,jdbcType=TINYINT}, + area_parent_id = #{areaParentId,jdbcType=INTEGER}, + init_date = #{initDate,jdbcType=TIMESTAMP}, + init_addr = #{initAddr,jdbcType=VARCHAR}, + area_type = #{areaType,jdbcType=TINYINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mapper_raw/QuestionnaireDetailMapper.xml b/src/main/resources/mapper_raw/QuestionnaireDetailMapper.xml new file mode 100644 index 0000000..846d2ac --- /dev/null +++ b/src/main/resources/mapper_raw/QuestionnaireDetailMapper.xml @@ -0,0 +1,623 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, city, county, hospital_level, hospital_name, departments, name, phone, advanced_stroke_center, + stroke_center, map_hospital, stroke_number, ais_number_four, jmrs_number_four, rtpa_number, + dnt_number, dnt_number_four, dnt_number_six, sich_number, jmrs_number_one, ais_number_six, + should_directly, dpt_median_number, prt_median_number, jmrs_number_two, death_number, + user_id, questionnaire_id, created_at, updated_at, rec_status + + + + + delete from t_qcp_questionnaire_detail + where id = #{id,jdbcType=BIGINT} + + + delete from t_qcp_questionnaire_detail + + + + + + insert into t_qcp_questionnaire_detail (id, city, county, + hospital_level, hospital_name, departments, + name, phone, advanced_stroke_center, + stroke_center, map_hospital, stroke_number, + ais_number_four, jmrs_number_four, rtpa_number, + dnt_number, dnt_number_four, dnt_number_six, + sich_number, jmrs_number_one, ais_number_six, + should_directly, dpt_median_number, prt_median_number, + jmrs_number_two, death_number, user_id, + questionnaire_id, created_at, updated_at, + rec_status) + values (#{id,jdbcType=BIGINT}, #{city,jdbcType=VARCHAR}, #{county,jdbcType=VARCHAR}, + #{hospitalLevel,jdbcType=TINYINT}, #{hospitalName,jdbcType=VARCHAR}, #{departments,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{advancedStrokeCenter,jdbcType=TINYINT}, + #{strokeCenter,jdbcType=TINYINT}, #{mapHospital,jdbcType=TINYINT}, #{strokeNumber,jdbcType=INTEGER}, + #{aisNumberFour,jdbcType=INTEGER}, #{jmrsNumberFour,jdbcType=INTEGER}, #{rtpaNumber,jdbcType=INTEGER}, + #{dntNumber,jdbcType=INTEGER}, #{dntNumberFour,jdbcType=INTEGER}, #{dntNumberSix,jdbcType=INTEGER}, + #{sichNumber,jdbcType=INTEGER}, #{jmrsNumberOne,jdbcType=INTEGER}, #{aisNumberSix,jdbcType=INTEGER}, + #{shouldDirectly,jdbcType=INTEGER}, #{dptMedianNumber,jdbcType=INTEGER}, #{prtMedianNumber,jdbcType=INTEGER}, + #{jmrsNumberTwo,jdbcType=INTEGER}, #{deathNumber,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, + #{questionnaireId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}) + + + insert into t_qcp_questionnaire_detail + + + id, + + + city, + + + county, + + + hospital_level, + + + hospital_name, + + + departments, + + + name, + + + phone, + + + advanced_stroke_center, + + + stroke_center, + + + map_hospital, + + + stroke_number, + + + ais_number_four, + + + jmrs_number_four, + + + rtpa_number, + + + dnt_number, + + + dnt_number_four, + + + dnt_number_six, + + + sich_number, + + + jmrs_number_one, + + + ais_number_six, + + + should_directly, + + + dpt_median_number, + + + prt_median_number, + + + jmrs_number_two, + + + death_number, + + + user_id, + + + questionnaire_id, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{city,jdbcType=VARCHAR}, + + + #{county,jdbcType=VARCHAR}, + + + #{hospitalLevel,jdbcType=TINYINT}, + + + #{hospitalName,jdbcType=VARCHAR}, + + + #{departments,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{phone,jdbcType=VARCHAR}, + + + #{advancedStrokeCenter,jdbcType=TINYINT}, + + + #{strokeCenter,jdbcType=TINYINT}, + + + #{mapHospital,jdbcType=TINYINT}, + + + #{strokeNumber,jdbcType=INTEGER}, + + + #{aisNumberFour,jdbcType=INTEGER}, + + + #{jmrsNumberFour,jdbcType=INTEGER}, + + + #{rtpaNumber,jdbcType=INTEGER}, + + + #{dntNumber,jdbcType=INTEGER}, + + + #{dntNumberFour,jdbcType=INTEGER}, + + + #{dntNumberSix,jdbcType=INTEGER}, + + + #{sichNumber,jdbcType=INTEGER}, + + + #{jmrsNumberOne,jdbcType=INTEGER}, + + + #{aisNumberSix,jdbcType=INTEGER}, + + + #{shouldDirectly,jdbcType=INTEGER}, + + + #{dptMedianNumber,jdbcType=INTEGER}, + + + #{prtMedianNumber,jdbcType=INTEGER}, + + + #{jmrsNumberTwo,jdbcType=INTEGER}, + + + #{deathNumber,jdbcType=INTEGER}, + + + #{userId,jdbcType=BIGINT}, + + + #{questionnaireId,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_qcp_questionnaire_detail + + + id = #{record.id,jdbcType=BIGINT}, + + + city = #{record.city,jdbcType=VARCHAR}, + + + county = #{record.county,jdbcType=VARCHAR}, + + + hospital_level = #{record.hospitalLevel,jdbcType=TINYINT}, + + + hospital_name = #{record.hospitalName,jdbcType=VARCHAR}, + + + departments = #{record.departments,jdbcType=VARCHAR}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + phone = #{record.phone,jdbcType=VARCHAR}, + + + advanced_stroke_center = #{record.advancedStrokeCenter,jdbcType=TINYINT}, + + + stroke_center = #{record.strokeCenter,jdbcType=TINYINT}, + + + map_hospital = #{record.mapHospital,jdbcType=TINYINT}, + + + stroke_number = #{record.strokeNumber,jdbcType=INTEGER}, + + + ais_number_four = #{record.aisNumberFour,jdbcType=INTEGER}, + + + jmrs_number_four = #{record.jmrsNumberFour,jdbcType=INTEGER}, + + + rtpa_number = #{record.rtpaNumber,jdbcType=INTEGER}, + + + dnt_number = #{record.dntNumber,jdbcType=INTEGER}, + + + dnt_number_four = #{record.dntNumberFour,jdbcType=INTEGER}, + + + dnt_number_six = #{record.dntNumberSix,jdbcType=INTEGER}, + + + sich_number = #{record.sichNumber,jdbcType=INTEGER}, + + + jmrs_number_one = #{record.jmrsNumberOne,jdbcType=INTEGER}, + + + ais_number_six = #{record.aisNumberSix,jdbcType=INTEGER}, + + + should_directly = #{record.shouldDirectly,jdbcType=INTEGER}, + + + dpt_median_number = #{record.dptMedianNumber,jdbcType=INTEGER}, + + + prt_median_number = #{record.prtMedianNumber,jdbcType=INTEGER}, + + + jmrs_number_two = #{record.jmrsNumberTwo,jdbcType=INTEGER}, + + + death_number = #{record.deathNumber,jdbcType=INTEGER}, + + + user_id = #{record.userId,jdbcType=BIGINT}, + + + questionnaire_id = #{record.questionnaireId,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_qcp_questionnaire_detail + set id = #{record.id,jdbcType=BIGINT}, + city = #{record.city,jdbcType=VARCHAR}, + county = #{record.county,jdbcType=VARCHAR}, + hospital_level = #{record.hospitalLevel,jdbcType=TINYINT}, + hospital_name = #{record.hospitalName,jdbcType=VARCHAR}, + departments = #{record.departments,jdbcType=VARCHAR}, + name = #{record.name,jdbcType=VARCHAR}, + phone = #{record.phone,jdbcType=VARCHAR}, + advanced_stroke_center = #{record.advancedStrokeCenter,jdbcType=TINYINT}, + stroke_center = #{record.strokeCenter,jdbcType=TINYINT}, + map_hospital = #{record.mapHospital,jdbcType=TINYINT}, + stroke_number = #{record.strokeNumber,jdbcType=INTEGER}, + ais_number_four = #{record.aisNumberFour,jdbcType=INTEGER}, + jmrs_number_four = #{record.jmrsNumberFour,jdbcType=INTEGER}, + rtpa_number = #{record.rtpaNumber,jdbcType=INTEGER}, + dnt_number = #{record.dntNumber,jdbcType=INTEGER}, + dnt_number_four = #{record.dntNumberFour,jdbcType=INTEGER}, + dnt_number_six = #{record.dntNumberSix,jdbcType=INTEGER}, + sich_number = #{record.sichNumber,jdbcType=INTEGER}, + jmrs_number_one = #{record.jmrsNumberOne,jdbcType=INTEGER}, + ais_number_six = #{record.aisNumberSix,jdbcType=INTEGER}, + should_directly = #{record.shouldDirectly,jdbcType=INTEGER}, + dpt_median_number = #{record.dptMedianNumber,jdbcType=INTEGER}, + prt_median_number = #{record.prtMedianNumber,jdbcType=INTEGER}, + jmrs_number_two = #{record.jmrsNumberTwo,jdbcType=INTEGER}, + death_number = #{record.deathNumber,jdbcType=INTEGER}, + user_id = #{record.userId,jdbcType=BIGINT}, + questionnaire_id = #{record.questionnaireId,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_qcp_questionnaire_detail + + + city = #{city,jdbcType=VARCHAR}, + + + county = #{county,jdbcType=VARCHAR}, + + + hospital_level = #{hospitalLevel,jdbcType=TINYINT}, + + + hospital_name = #{hospitalName,jdbcType=VARCHAR}, + + + departments = #{departments,jdbcType=VARCHAR}, + + + name = #{name,jdbcType=VARCHAR}, + + + phone = #{phone,jdbcType=VARCHAR}, + + + advanced_stroke_center = #{advancedStrokeCenter,jdbcType=TINYINT}, + + + stroke_center = #{strokeCenter,jdbcType=TINYINT}, + + + map_hospital = #{mapHospital,jdbcType=TINYINT}, + + + stroke_number = #{strokeNumber,jdbcType=INTEGER}, + + + ais_number_four = #{aisNumberFour,jdbcType=INTEGER}, + + + jmrs_number_four = #{jmrsNumberFour,jdbcType=INTEGER}, + + + rtpa_number = #{rtpaNumber,jdbcType=INTEGER}, + + + dnt_number = #{dntNumber,jdbcType=INTEGER}, + + + dnt_number_four = #{dntNumberFour,jdbcType=INTEGER}, + + + dnt_number_six = #{dntNumberSix,jdbcType=INTEGER}, + + + sich_number = #{sichNumber,jdbcType=INTEGER}, + + + jmrs_number_one = #{jmrsNumberOne,jdbcType=INTEGER}, + + + ais_number_six = #{aisNumberSix,jdbcType=INTEGER}, + + + should_directly = #{shouldDirectly,jdbcType=INTEGER}, + + + dpt_median_number = #{dptMedianNumber,jdbcType=INTEGER}, + + + prt_median_number = #{prtMedianNumber,jdbcType=INTEGER}, + + + jmrs_number_two = #{jmrsNumberTwo,jdbcType=INTEGER}, + + + death_number = #{deathNumber,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=BIGINT}, + + + questionnaire_id = #{questionnaireId,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_qcp_questionnaire_detail + set city = #{city,jdbcType=VARCHAR}, + county = #{county,jdbcType=VARCHAR}, + hospital_level = #{hospitalLevel,jdbcType=TINYINT}, + hospital_name = #{hospitalName,jdbcType=VARCHAR}, + departments = #{departments,jdbcType=VARCHAR}, + name = #{name,jdbcType=VARCHAR}, + phone = #{phone,jdbcType=VARCHAR}, + advanced_stroke_center = #{advancedStrokeCenter,jdbcType=TINYINT}, + stroke_center = #{strokeCenter,jdbcType=TINYINT}, + map_hospital = #{mapHospital,jdbcType=TINYINT}, + stroke_number = #{strokeNumber,jdbcType=INTEGER}, + ais_number_four = #{aisNumberFour,jdbcType=INTEGER}, + jmrs_number_four = #{jmrsNumberFour,jdbcType=INTEGER}, + rtpa_number = #{rtpaNumber,jdbcType=INTEGER}, + dnt_number = #{dntNumber,jdbcType=INTEGER}, + dnt_number_four = #{dntNumberFour,jdbcType=INTEGER}, + dnt_number_six = #{dntNumberSix,jdbcType=INTEGER}, + sich_number = #{sichNumber,jdbcType=INTEGER}, + jmrs_number_one = #{jmrsNumberOne,jdbcType=INTEGER}, + ais_number_six = #{aisNumberSix,jdbcType=INTEGER}, + should_directly = #{shouldDirectly,jdbcType=INTEGER}, + dpt_median_number = #{dptMedianNumber,jdbcType=INTEGER}, + prt_median_number = #{prtMedianNumber,jdbcType=INTEGER}, + jmrs_number_two = #{jmrsNumberTwo,jdbcType=INTEGER}, + death_number = #{deathNumber,jdbcType=INTEGER}, + user_id = #{userId,jdbcType=BIGINT}, + questionnaire_id = #{questionnaireId,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/src/main/resources/mapper_raw/QuestionnaireMapper.xml b/src/main/resources/mapper_raw/QuestionnaireMapper.xml new file mode 100644 index 0000000..a24578f --- /dev/null +++ b/src/main/resources/mapper_raw/QuestionnaireMapper.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, questionnaire_name, start_time, end_time, type, created_at, updated_at, rec_status, + write_start_time, write_end_time + + + + + delete from t_qcp_questionnaire + where id = #{id,jdbcType=BIGINT} + + + delete from t_qcp_questionnaire + + + + + + insert into t_qcp_questionnaire (id, questionnaire_name, start_time, + end_time, type, created_at, + updated_at, rec_status, write_start_time, + write_end_time) + values (#{id,jdbcType=BIGINT}, #{questionnaireName,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, + #{endTime,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}, #{writeStartTime,jdbcType=BIGINT}, + #{writeEndTime,jdbcType=BIGINT}) + + + insert into t_qcp_questionnaire + + + id, + + + questionnaire_name, + + + start_time, + + + end_time, + + + type, + + + created_at, + + + updated_at, + + + rec_status, + + + write_start_time, + + + write_end_time, + + + + + #{id,jdbcType=BIGINT}, + + + #{questionnaireName,jdbcType=VARCHAR}, + + + #{startTime,jdbcType=BIGINT}, + + + #{endTime,jdbcType=BIGINT}, + + + #{type,jdbcType=TINYINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + #{writeStartTime,jdbcType=BIGINT}, + + + #{writeEndTime,jdbcType=BIGINT}, + + + + + + update t_qcp_questionnaire + + + id = #{record.id,jdbcType=BIGINT}, + + + questionnaire_name = #{record.questionnaireName,jdbcType=VARCHAR}, + + + start_time = #{record.startTime,jdbcType=BIGINT}, + + + end_time = #{record.endTime,jdbcType=BIGINT}, + + + type = #{record.type,jdbcType=TINYINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + write_start_time = #{record.writeStartTime,jdbcType=BIGINT}, + + + write_end_time = #{record.writeEndTime,jdbcType=BIGINT}, + + + + + + + + update t_qcp_questionnaire + set id = #{record.id,jdbcType=BIGINT}, + questionnaire_name = #{record.questionnaireName,jdbcType=VARCHAR}, + start_time = #{record.startTime,jdbcType=BIGINT}, + end_time = #{record.endTime,jdbcType=BIGINT}, + type = #{record.type,jdbcType=TINYINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT}, + write_start_time = #{record.writeStartTime,jdbcType=BIGINT}, + write_end_time = #{record.writeEndTime,jdbcType=BIGINT} + + + + + + update t_qcp_questionnaire + + + questionnaire_name = #{questionnaireName,jdbcType=VARCHAR}, + + + start_time = #{startTime,jdbcType=BIGINT}, + + + end_time = #{endTime,jdbcType=BIGINT}, + + + type = #{type,jdbcType=TINYINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + write_start_time = #{writeStartTime,jdbcType=BIGINT}, + + + write_end_time = #{writeEndTime,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_qcp_questionnaire + set questionnaire_name = #{questionnaireName,jdbcType=VARCHAR}, + start_time = #{startTime,jdbcType=BIGINT}, + end_time = #{endTime,jdbcType=BIGINT}, + type = #{type,jdbcType=TINYINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT}, + write_start_time = #{writeStartTime,jdbcType=BIGINT}, + write_end_time = #{writeEndTime,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/src/main/resources/mbg.xml b/src/main/resources/mbg.xml index ee3b1f7..753d7bb 100644 --- a/src/main/resources/mbg.xml +++ b/src/main/resources/mbg.xml @@ -58,7 +58,10 @@ -
+ +
+ + From 844de72aa94db64116b4c7ca4b557cb587bad6ee Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Thu, 23 Sep 2021 16:21:21 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=9C=B0=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ccsens/carbasics/service/QuestionnaireService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java b/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java index 3bd6b29..61b2da9 100644 --- a/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java +++ b/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java @@ -42,6 +42,9 @@ public class QuestionnaireService implements IQuestionnaireService{ @Override public List queryArea(QuestionnaireDto.QueryArea param, Long userId) { + if (ObjectUtil.isNull(param.getId())){ + param.setId(0L); + } return areaDao.queryByParentId(param); } From a61e9ab6b9f44e544e0855be24f35c12f5bc1c34 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Thu, 23 Sep 2021 17:48:45 +0800 Subject: [PATCH 20/21] =?UTF-8?q?=E8=B0=83=E6=9F=A5=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../carbasics/bean/dto/QuestionnaireDto.java | 4 -- .../carbasics/bean/vo/QuestionnaireVo.java | 3 ++ .../ccsens/carbasics/persist/dao/AreaDao.java | 5 ++- .../persist/dao/QuestionnaireDao.java | 15 ++++++- .../service/QuestionnaireService.java | 12 +++-- src/main/resources/mapper_dao/AreaDao.xml | 36 ++++++++++++--- .../resources/mapper_dao/QuestionnaireDao.xml | 45 ++++++++++++++++++- 7 files changed, 97 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/QuestionnaireDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/QuestionnaireDto.java index 31dac7a..661a9f1 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/QuestionnaireDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/QuestionnaireDto.java @@ -20,15 +20,11 @@ public class QuestionnaireDto { @Data @ApiModel("查询问卷信息") public static class QueryQuestionnaire { - @NotNull(message = "时间不能为空") @ApiModelProperty("当前时间") private Long time = System.currentTimeMillis(); @NotNull(message = "请选择类型") @ApiModelProperty("类型(0-卒中)") private Byte type; - @NotNull(message = "医院名称不能为空") - @ApiModelProperty("医院名称") - private String hospitalName; } @Data diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/QuestionnaireVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/QuestionnaireVo.java index 729595d..604cefc 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/QuestionnaireVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/QuestionnaireVo.java @@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; +import java.util.List; @Data public class QuestionnaireVo { @@ -17,6 +18,8 @@ public class QuestionnaireVo { private Long id; @ApiModelProperty("地区名称") private String name; + @ApiModelProperty("子地区") + private List child; } @Data diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/AreaDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/AreaDao.java index 7df1fe8..381a827 100644 --- a/src/main/java/com/ccsens/carbasics/persist/dao/AreaDao.java +++ b/src/main/java/com/ccsens/carbasics/persist/dao/AreaDao.java @@ -3,6 +3,7 @@ package com.ccsens.carbasics.persist.dao; import com.ccsens.carbasics.bean.dto.QuestionnaireDto; import com.ccsens.carbasics.bean.vo.QuestionnaireVo; import com.ccsens.carbasics.persist.mapper.AreaMapper; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -12,8 +13,8 @@ public interface AreaDao extends AreaMapper { /** * 根据父id查询地区信息 - * @param param 父id + * @param id 父id * @return 地区列表 */ - List queryByParentId(QuestionnaireDto.QueryArea param); + List queryByParentId(@Param("id") Long id); } diff --git a/src/main/java/com/ccsens/carbasics/persist/dao/QuestionnaireDao.java b/src/main/java/com/ccsens/carbasics/persist/dao/QuestionnaireDao.java index 73d4016..5a27a16 100644 --- a/src/main/java/com/ccsens/carbasics/persist/dao/QuestionnaireDao.java +++ b/src/main/java/com/ccsens/carbasics/persist/dao/QuestionnaireDao.java @@ -13,10 +13,12 @@ public interface QuestionnaireDao extends QuestionnaireMapper { /** * 查询问卷信息 - * @param param 时间/类型/医院名称 + * @param time 当前时间 + * @param type 问卷类型 + * @param userId 用户id * @return 问卷信息 */ - QuestionnaireVo.QuestionnaireInfo queryQuestionnaire(QuestionnaireDto.QueryQuestionnaire param); + QuestionnaireVo.QuestionnaireInfo queryQuestionnaire(@Param("time") Long time,@Param("type") Byte type,@Param("userId") Long userId); /** * 查询医院是否填写问卷调查 @@ -25,4 +27,13 @@ public interface QuestionnaireDao extends QuestionnaireMapper { * @return 问卷调查列表 */ List queryNotWrite(@Param("name") String name,@Param("time") Long time); + + /** + * 查询医院是否重复提交 + * @param hospitalName 医院名称 + * @param time 当前时间 + * @param type + * @return 数据 + */ + QuestionnaireVo.QuestionnaireInfo queryRepeat(@Param("name") String hospitalName,@Param("time") Long time,@Param("type") Byte type); } diff --git a/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java b/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java index 61b2da9..4b68c3d 100644 --- a/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java +++ b/src/main/java/com/ccsens/carbasics/service/QuestionnaireService.java @@ -1,6 +1,7 @@ package com.ccsens.carbasics.service; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.ObjectUtil; import com.ccsens.carbasics.bean.dto.QuestionnaireDto; @@ -45,23 +46,20 @@ public class QuestionnaireService implements IQuestionnaireService{ if (ObjectUtil.isNull(param.getId())){ param.setId(0L); } - return areaDao.queryByParentId(param); + return areaDao.queryByParentId(param.getId()); } @Override public QuestionnaireVo.QuestionnaireInfo queryQuestionnaire(QuestionnaireDto.QueryQuestionnaire param, Long userId) { - return questionnaireDao.queryQuestionnaire(param); + return questionnaireDao.queryQuestionnaire(param.getTime(),param.getType(),userId); } @Override public void saveQuestionnaire(QuestionnaireDto.SaveQuestionnaire param, Long userId) { //查询是否重复提交 - QuestionnaireDto.QueryQuestionnaire queryQuestionnaire = new QuestionnaireDto.QueryQuestionnaire(); - queryQuestionnaire.setHospitalName(param.getHospitalName()); - queryQuestionnaire.setTime(System.currentTimeMillis()); - queryQuestionnaire.setType(param.getType()); - QuestionnaireVo.QuestionnaireInfo questionnaireInfo = queryQuestionnaire(queryQuestionnaire, userId); + Long time = System.currentTimeMillis(); + QuestionnaireVo.QuestionnaireInfo questionnaireInfo = questionnaireDao.queryRepeat(param.getHospitalName(),time,param.getType()); if (ObjectUtil.isNotNull(questionnaireInfo.getDetail())) { throw new BaseException(DefaultCodeError.HOSPITAL_REPEAT_SUBMIT); } diff --git a/src/main/resources/mapper_dao/AreaDao.xml b/src/main/resources/mapper_dao/AreaDao.xml index ba236fb..a82f7d1 100644 --- a/src/main/resources/mapper_dao/AreaDao.xml +++ b/src/main/resources/mapper_dao/AreaDao.xml @@ -2,16 +2,38 @@ - SELECT - id, - area_name AS `name` + a.id AS shengid, + a.area_name AS sheng, + a1.id AS shiid, + a1.area_parent_id AS shif, + a1.area_name AS shiname, + a2.id AS quid, + a2.area_parent_id AS quf, + a2.area_name AS quname FROM - t_area + t_area AS a + LEFT JOIN t_area AS a1 ON a.id = a1.area_parent_id + LEFT JOIN t_area AS a2 ON a1.id = a2.area_parent_id WHERE - rec_status = 0 - AND area_type = 0 - AND area_parent_id = #{id} + a.area_parent_id = 0 + AND a.area_type = 0 + AND a1.area_type = 0 + AND a2.area_type = 0 diff --git a/src/main/resources/mapper_dao/QuestionnaireDao.xml b/src/main/resources/mapper_dao/QuestionnaireDao.xml index 57a017b..ce2d140 100644 --- a/src/main/resources/mapper_dao/QuestionnaireDao.xml +++ b/src/main/resources/mapper_dao/QuestionnaireDao.xml @@ -72,7 +72,7 @@ FROM t_qcp_questionnaire AS q LEFT JOIN t_qcp_questionnaire_detail AS qd ON q.id = qd.questionnaire_id - AND qd.hospital_name = #{hospitalName} AND qd.rec_status = 0 + AND qd.user_id = #{userId} AND qd.rec_status = 0 WHERE q.write_start_time < #{time} AND q.write_end_time > #{time} @@ -100,5 +100,48 @@ AND q.rec_status = 0 + + \ No newline at end of file From 03292ad4e78e3b9c3c1cc9331f898e0ce1d62633 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 23 Sep 2021 18:23:58 +0800 Subject: [PATCH 21/21] =?UTF-8?q?=E7=97=85=E4=BE=8B=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../carbasics/api/PatientController.java | 12 ++++ .../ccsens/carbasics/api/UserController.java | 49 +++++++++++++++ .../ccsens/carbasics/bean/dto/PatientDto.java | 13 ++++ .../ccsens/carbasics/bean/po/FirstAid.java | 11 ++++ .../carbasics/bean/po/FirstAidExample.java | 60 +++++++++++++++++++ .../ccsens/carbasics/bean/vo/PatientVo.java | 3 +- .../carbasics/service/FirstAidService.java | 30 ++++++++++ .../carbasics/service/IFirstAidService.java | 9 +++ .../com/ccsens/carbasics/util/Constant.java | 1 + src/main/resources/mapper_dao/FirstAidDao.xml | 2 + .../resources/mapper_raw/FirstAidMapper.xml | 27 +++++++-- src/main/resources/mbg.xml | 6 +- 12 files changed, 214 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/ccsens/carbasics/api/UserController.java diff --git a/src/main/java/com/ccsens/carbasics/api/PatientController.java b/src/main/java/com/ccsens/carbasics/api/PatientController.java index 6549b3e..fa6986e 100644 --- a/src/main/java/com/ccsens/carbasics/api/PatientController.java +++ b/src/main/java/com/ccsens/carbasics/api/PatientController.java @@ -4,6 +4,7 @@ import com.ccsens.carbasics.bean.dto.PatientDto; import com.ccsens.carbasics.bean.vo.PatientVo; import com.ccsens.carbasics.service.IFirstAidService; import com.ccsens.cloudutil.annotation.MustLogin; +import com.ccsens.util.CodeError; import com.ccsens.util.JsonResponse; import com.ccsens.util.bean.dto.QueryDto; import com.github.pagehelper.PageInfo; @@ -83,6 +84,17 @@ public class PatientController { return JsonResponse.newInstance().ok(list); } + @MustLogin + @ApiOperation(value = "质检员上报数据状态", notes = "whj") + @RequestMapping(value = "/report", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse report(@ApiParam @Validated @RequestBody QueryDto params) throws Exception{ + log.info("质检员上报数据状态:{}", params); + CodeError.Code code = firstAidService.report(params.getParam(), params.getUserId()); + log.info("质检员上报数据状态成功"); + return JsonResponse.newInstance().ok(code); + } + + @MustLogin @ApiOperation(value = "秘书查看审核列表", notes = "zy") @RequestMapping(value = "/listBySecretary", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) diff --git a/src/main/java/com/ccsens/carbasics/api/UserController.java b/src/main/java/com/ccsens/carbasics/api/UserController.java new file mode 100644 index 0000000..0c60dca --- /dev/null +++ b/src/main/java/com/ccsens/carbasics/api/UserController.java @@ -0,0 +1,49 @@ +package com.ccsens.carbasics.api; + +import com.ccsens.common.bean.dto.CMemberDto; +import com.ccsens.common.service.IMemberService; +import com.ccsens.util.JsonResponse; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * @author zy + */ +@Api(tags = "用户") +@RestController +@RequestMapping("/user") +@Slf4j +public class UserController { + @Resource + private IMemberService memberService; + + @ApiOperation(value = "根据手机号更新成员的userId",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value="/memberWithPhone",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) + public JsonResponse memberWithPhone(@ApiParam @Validated @RequestBody CMemberDto.PhoneAndUserId params) throws Exception { + log.info("根据手机号更新成员userId"); + memberService.relevancePhone(params); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "合并用户后修改userId",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value="/mergeUser",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) + public JsonResponse mergeUser(@ApiParam @Validated @RequestBody CMemberDto.MergeUser params) throws Exception { + log.info("合并用户后修改userId"); + memberService.mergeUser(params); + return JsonResponse.newInstance().ok(); + } +} diff --git a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java index a0e1efa..e5a9315 100644 --- a/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java +++ b/src/main/java/com/ccsens/carbasics/bean/dto/PatientDto.java @@ -187,6 +187,8 @@ public class PatientDto { private String idcard; @ApiModelProperty("查询类型,0:急救 1:出院") private Byte queryType = 0; + @ApiModelProperty("上报情况 0:未上报 1:上报成功") + private Byte reported; @ApiModelProperty("第几页") @Min(value = 1) @@ -207,4 +209,15 @@ public class PatientDto { private byte dataStatus; } + @Data + @ApiModel("质检员上报数据") + public static class Report{ + @NotNull + @ApiModelProperty("急救id") + private Long firstAidId; + @NotNull + @ApiModelProperty("上报情况 0:未上报 1:上报成功") + private Byte reported; + } + } diff --git a/src/main/java/com/ccsens/carbasics/bean/po/FirstAid.java b/src/main/java/com/ccsens/carbasics/bean/po/FirstAid.java index 2c56e42..e86d744 100644 --- a/src/main/java/com/ccsens/carbasics/bean/po/FirstAid.java +++ b/src/main/java/com/ccsens/carbasics/bean/po/FirstAid.java @@ -30,6 +30,8 @@ public class FirstAid implements Serializable { private Long hospitalId; + private Byte reported; + private Long operator; private Date createdAt; @@ -144,6 +146,14 @@ public class FirstAid implements Serializable { this.hospitalId = hospitalId; } + public Byte getReported() { + return reported; + } + + public void setReported(Byte reported) { + this.reported = reported; + } + public Long getOperator() { return operator; } @@ -195,6 +205,7 @@ public class FirstAid implements Serializable { sb.append(", dataStatus=").append(dataStatus); sb.append(", projectId=").append(projectId); sb.append(", hospitalId=").append(hospitalId); + sb.append(", reported=").append(reported); sb.append(", operator=").append(operator); sb.append(", createdAt=").append(createdAt); sb.append(", updatedAt=").append(updatedAt); diff --git a/src/main/java/com/ccsens/carbasics/bean/po/FirstAidExample.java b/src/main/java/com/ccsens/carbasics/bean/po/FirstAidExample.java index f2698fc..5ec44e4 100644 --- a/src/main/java/com/ccsens/carbasics/bean/po/FirstAidExample.java +++ b/src/main/java/com/ccsens/carbasics/bean/po/FirstAidExample.java @@ -925,6 +925,66 @@ public class FirstAidExample { return (Criteria) this; } + public Criteria andReportedIsNull() { + addCriterion("reported is null"); + return (Criteria) this; + } + + public Criteria andReportedIsNotNull() { + addCriterion("reported is not null"); + return (Criteria) this; + } + + public Criteria andReportedEqualTo(Byte value) { + addCriterion("reported =", value, "reported"); + return (Criteria) this; + } + + public Criteria andReportedNotEqualTo(Byte value) { + addCriterion("reported <>", value, "reported"); + return (Criteria) this; + } + + public Criteria andReportedGreaterThan(Byte value) { + addCriterion("reported >", value, "reported"); + return (Criteria) this; + } + + public Criteria andReportedGreaterThanOrEqualTo(Byte value) { + addCriterion("reported >=", value, "reported"); + return (Criteria) this; + } + + public Criteria andReportedLessThan(Byte value) { + addCriterion("reported <", value, "reported"); + return (Criteria) this; + } + + public Criteria andReportedLessThanOrEqualTo(Byte value) { + addCriterion("reported <=", value, "reported"); + return (Criteria) this; + } + + public Criteria andReportedIn(List values) { + addCriterion("reported in", values, "reported"); + return (Criteria) this; + } + + public Criteria andReportedNotIn(List values) { + addCriterion("reported not in", values, "reported"); + return (Criteria) this; + } + + public Criteria andReportedBetween(Byte value1, Byte value2) { + addCriterion("reported between", value1, value2, "reported"); + return (Criteria) this; + } + + public Criteria andReportedNotBetween(Byte value1, Byte value2) { + addCriterion("reported not between", value1, value2, "reported"); + return (Criteria) this; + } + public Criteria andOperatorIsNull() { addCriterion("operator is null"); return (Criteria) this; diff --git a/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java b/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java index 57435d4..c95a6d7 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java @@ -168,7 +168,8 @@ public class PatientVo { private Integer times; @ApiModelProperty("项目ID") private Long projectId; - + @ApiModelProperty("上报情况 0:未上报 1:上报成功") + private Byte reported; public int getDataStatus() { if(dataStatus == Constant.DataStatus.FirstAidPass.status && times >= Constant.MAX_UPDATE_NUMBER){ return 100; diff --git a/src/main/java/com/ccsens/carbasics/service/FirstAidService.java b/src/main/java/com/ccsens/carbasics/service/FirstAidService.java index d62aa92..fd01653 100644 --- a/src/main/java/com/ccsens/carbasics/service/FirstAidService.java +++ b/src/main/java/com/ccsens/carbasics/service/FirstAidService.java @@ -21,11 +21,13 @@ import com.ccsens.carbasics.util.DefaultCodeError; import com.ccsens.common.bean.dto.CProjectDto; import com.ccsens.common.bean.vo.CProjectVo; import com.ccsens.common.service.IProjectService; +import com.ccsens.util.CodeError; import com.ccsens.util.RedisUtil; import com.ccsens.util.exception.BaseException; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -601,4 +603,32 @@ public class FirstAidService implements IFirstAidService{ detail.setValueType(firstAid.getValueType()); return detail; } + + @Override + public CodeError.Code report(PatientDto.Report param, Long userId) { + + FirstAid firstAid = firstAidDao.selectByPrimaryKey(param.getFirstAidId()); + log.info("急救:{}", firstAid); + if (firstAid == null) { + return DefaultCodeError.NOT_FIRST_AID_ID; + } + if (firstAid.getReported() != null && firstAid.getReported().byteValue() == param.getReported()) { + return DefaultCodeError.DATA_STATUS_SAME; + } + // 修改上报状态 + FirstAid newFirstAid = new FirstAid(); + newFirstAid.setId(param.getFirstAidId()); + newFirstAid.setReported(param.getReported()); + firstAidDao.updateByPrimaryKeySelective(newFirstAid); + // 添加日志 + FirstAidLog log = new FirstAidLog(); + log.setId(snowflake.nextId()); + log.setFirstAidId(param.getFirstAidId()); + log.setOperationTime(System.currentTimeMillis()); + log.setOperationUserId(userId); + log.setOperationType(Constant.FirstAidLogType.ReportedSuccess.status); + log.setOperationRole((byte)3); + firstAidLogDao.insertSelective(log); + return DefaultCodeError.SUCCESS; + } } diff --git a/src/main/java/com/ccsens/carbasics/service/IFirstAidService.java b/src/main/java/com/ccsens/carbasics/service/IFirstAidService.java index 6fa1ae6..addd575 100644 --- a/src/main/java/com/ccsens/carbasics/service/IFirstAidService.java +++ b/src/main/java/com/ccsens/carbasics/service/IFirstAidService.java @@ -5,6 +5,7 @@ import com.ccsens.carbasics.bean.dto.FirstAidDto; import com.ccsens.carbasics.bean.dto.PatientDto; import com.ccsens.carbasics.bean.vo.FirstAidVo; import com.ccsens.carbasics.bean.vo.PatientVo; +import com.ccsens.util.CodeError; import com.github.pagehelper.PageInfo; public interface IFirstAidService { @@ -92,4 +93,12 @@ public interface IFirstAidService { * @return 病例信息 */ FirstAidVo.FirstAidBase getDetail(FirstAidDto.Project param, Long userId); + + /** + * 修改急救上报状态 + * @param param 上报信息 + * @param userId 操作者ID + * @return 成功与否 + */ + CodeError.Code report(PatientDto.Report param, Long userId); } diff --git a/src/main/java/com/ccsens/carbasics/util/Constant.java b/src/main/java/com/ccsens/carbasics/util/Constant.java index d1fcc17..f48df45 100644 --- a/src/main/java/com/ccsens/carbasics/util/Constant.java +++ b/src/main/java/com/ccsens/carbasics/util/Constant.java @@ -287,6 +287,7 @@ public class Constant { ApplyForRefuse((byte) 7,"申请拒绝"), join((byte) 8,"加入"), quit((byte) 9,"退出"), + ReportedSuccess((byte)10,"上报成功"), ; public byte status; public String message; diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index 1ee5503..93b0f7f 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -74,6 +74,7 @@ `type`, nation, idcard, + reported, data_status AS dataStatus, project_id as projectId, updated_at @@ -83,6 +84,7 @@ hospital_id = #{hospitalId} AND value_type = 0 and data_status = #{param.dataStatus} + and reported = #{param.reported} AND `name` LIKE concat('%',#{param.name},'%') diff --git a/src/main/resources/mapper_raw/FirstAidMapper.xml b/src/main/resources/mapper_raw/FirstAidMapper.xml index 8379ff0..aa6ab9f 100644 --- a/src/main/resources/mapper_raw/FirstAidMapper.xml +++ b/src/main/resources/mapper_raw/FirstAidMapper.xml @@ -15,6 +15,7 @@ + @@ -80,7 +81,7 @@ id, name, gender, age, nation, idcard, phone, type, value_type, save_type, data_status, - project_id, hospital_id, operator, created_at, updated_at, rec_status + project_id, hospital_id, reported, operator, created_at, updated_at, rec_status