From 4e58ebee00fc4b9c738416d811496053938e7886 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Wed, 9 Mar 2022 17:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E6=8E=A7/=E7=A7=98=E4=B9=A6=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E7=97=85=E4=BE=8B=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=87=BA=E9=99=A2=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../carbasics/api/PatientController.java | 2 +- .../com/ccsens/carbasics/bean/vo/OcrVo.java | 32 +++++++++++++++++-- .../ccsens/carbasics/bean/vo/PatientVo.java | 2 ++ src/main/resources/mapper_dao/FirstAidDao.xml | 12 +++++-- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ccsens/carbasics/api/PatientController.java b/src/main/java/com/ccsens/carbasics/api/PatientController.java index fa6986e..317424d 100644 --- a/src/main/java/com/ccsens/carbasics/api/PatientController.java +++ b/src/main/java/com/ccsens/carbasics/api/PatientController.java @@ -40,7 +40,7 @@ public class PatientController { public JsonResponse querySelf(@ApiParam @Validated @RequestBody QueryDto params) throws Exception{ log.info("查询自己相关的病例列表:{}", params); PatientVo.SelfPatient data = firstAidService.querySelf(params.getParam(), params.getUserId()); - log.info("查询自己相关的病例列表成功"); + log.info("查询自己相关的病例列表成功:{}", data); return JsonResponse.newInstance().ok(data); } 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 8be311e..97366d4 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/OcrVo.java @@ -35,22 +35,39 @@ public class OcrVo { String idCardName = "姓名"; String idCardSex = "性别"; String idCardNo = "公民身份号码"; - words.forEach(wordNode ->{ + String nation = "民族"; + for (int i = 0; i < words.size(); i++) { + BaiDuVo.GeneralWord wordNode = words.get(i); String word = wordNode.getWords(); if (word.startsWith(idCardName)) { - this.name = word.substring(idCardName.length()); + this.name = word.length() != idCardName.length() ? + word.substring(idCardName.length()) : + i + 1 < words.size() ? words.get(i + 1).getWords() : null; } else if (word.startsWith(idCardSex)) { int sexIndex = 2; if (word.length() > sexIndex) { String sexWord = word.substring(sexIndex,sexIndex +1); this.sex = "女".equals(sexWord) ? (byte)0 : (byte)1; + } else { + String sexWord = i + 1 < words.size() ? words.get(i + 1).getWords() : null; + this.sex = "女".equals(sexWord) ? (byte)0 : "男".equals(sexWord) ? (byte)1 : null; } + int nationIndex = 5; if (word.length() > nationIndex) { this.nation = word.substring(nationIndex); } + } else if (word.contains(nation)) { + int nationIndex = word.indexOf(nation) + nation.length() + 1; + if (nationIndex < word.length() ) { + this.nation = word.substring(nationIndex); + } else { + this.nation = i + 1 < words.size() ? words.get(i + 1).getWords() : null; + } } 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) { @@ -60,7 +77,16 @@ public class OcrVo { this.age = IdcardUtil.getAgeByIdCard(this.idCardNo); } } - }); + } + + if (StrUtil.isEmpty(this.idCardNo)) { + String lastWord = words.get(words.size() - 1).getWords(); + this.idCardNo = lastWord.replaceAll("\\D", ""); + int idCardMinLength = 15; + 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 e7532ac..1757920 100644 --- a/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java +++ b/src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java @@ -170,6 +170,8 @@ public class PatientVo { private String hospitalNumber; @ApiModelProperty("到院时间") private Long arriveHospitalTime; + @ApiModelProperty("出院时间") + private Long leaveHospitalTime; //修改次数 @JsonIgnore private Integer times; diff --git a/src/main/resources/mapper_dao/FirstAidDao.xml b/src/main/resources/mapper_dao/FirstAidDao.xml index 41dcb7c..748971e 100644 --- a/src/main/resources/mapper_dao/FirstAidDao.xml +++ b/src/main/resources/mapper_dao/FirstAidDao.xml @@ -52,7 +52,7 @@ and a.name like concat('%', #{param.name}, '%') - order by r2.answer IS NOT NULL,r2.answer DESC,a.created_at DESC + order by r2.answer DESC,a.created_at DESC @@ -74,6 +74,7 @@ t.*, t1.answer AS hospitalNumber, t2.answer AS arriveHospitalTime, + t4.answer AS leaveHospitalTime, count( t3.id ) AS times FROM ( @@ -116,6 +117,9 @@ LEFT JOIN t_qcp_first_aid_log t3 ON t.firstAidId = t3.first_aid_id AND t3.operation_type = 5 AND t3.rec_status = 0 + LEFT JOIN t_qcp_first_aid_record t4 ON t.id = t4.first_aid_id + AND t4.question_code = 'CYQK-CYSJ' + AND t4.rec_status = 0 WHERE 1=1 @@ -136,6 +140,7 @@ t.*, t1.answer AS hospitalNumber, t2.answer AS arriveHospitalTime, + t4.answer AS leaveHospitalTime, count( t3.id ) AS times FROM ( @@ -179,6 +184,9 @@ LEFT JOIN t_qcp_first_aid_log t3 ON t.firstAidId = t3.first_aid_id AND t3.operation_type = 3 AND t3.rec_status = 0 + LEFT JOIN t_qcp_first_aid_record t4 ON t.id = t4.first_aid_id + AND t4.question_code = 'CYQK-CYSJ' + AND t4.rec_status = 0 AND t1.answer LIKE concat('%',#{param.hospitalNumber},'%') @@ -371,6 +379,6 @@ ) ) ) - ORDER BY leaveHospitalTime DESC + ORDER BY leaveHospitalTime DESC, firstAidId DESC