Kaynağa Gözat

通过诊疗卡绑卡前先检验身份证是否合法

lighter 3 yıl önce
ebeveyn
işleme
7d1aff6394

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>wxservice-server</artifactId>
-    <version>7.7</version>
+    <version>7.8</version>
     <name>wxservice-server</name>
     <description>server for wxservice-web</description>
 

+ 5 - 0
src/main/java/thyyxxk/wxservice_server/controller/PatientCardsController.java

@@ -37,6 +37,11 @@ public class PatientCardsController {
         return service.getPatientIdByOpenId(openId);
     }
 
+    @PostMapping("/hasValidIdCard")
+    public ResultVo<String> hasValidIdCard(@RequestBody BindPatientIdParam card) {
+        return service.hasValidIdCard(card);
+    }
+
     @PostMapping("/bindPatientId")
     public ResultVo<HashMap<String, Object>> bindPatientId(@RequestBody BindPatientIdParam param) {
         return service.bindPatientId(param);

+ 6 - 0
src/main/java/thyyxxk/wxservice_server/dao/PatientCardsDao.java

@@ -15,6 +15,12 @@ public interface PatientCardsDao {
             "t_wechat_patient_bind with(nolock) where open_id=#{openId} and del_flag=0")
     List<BindPatientIdParam> getBindPatientCard(@Param("openId") String openId);
 
+    @Update("update mz_patient_mi set social_no=#{socialNo} where ${tColumn}=#{cardNo} ")
+    void updateSocialNo(@Param("tColumn") String tColumn, @Param("cardNo") String cardNo, @Param("socialNo") String socialNo);
+
+    @Select("select social_no from mz_patient_mi where ${tColumn}=#{cardNo} ")
+    String selectSocialNo(@Param("tColumn") String tColumn, @Param("cardNo") String cardNo);
+
     @Select("select rtrim(name) name, rtrim(patient_id) patientId, rtrim(social_no) socialNo, " +
             "convert(varchar(10), lv_date, 21) lvDate, rtrim(ic_card_no) icCardNo " +
             "from mz_patient_mi with(nolock) where patient_id=#{cardNo}")

+ 17 - 3
src/main/java/thyyxxk/wxservice_server/service/PatientCardsService.java

@@ -13,9 +13,7 @@ import thyyxxk.wxservice_server.entity.patientcards.BindPatientIdParam;
 import thyyxxk.wxservice_server.entity.patientcards.ChangeCardParam;
 import thyyxxk.wxservice_server.entity.patientcards.ModifyBindParam;
 import thyyxxk.wxservice_server.entity.wxapi.PushMessageParam;
-import thyyxxk.wxservice_server.utils.DateUtil;
-import thyyxxk.wxservice_server.utils.PropertiesUtil;
-import thyyxxk.wxservice_server.utils.ResultVoUtil;
+import thyyxxk.wxservice_server.utils.*;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -56,6 +54,22 @@ public class PatientCardsService {
         return ResultVoUtil.success(dao.getBindPatientCard(openId));
     }
 
+    public ResultVo<String> hasValidIdCard(BindPatientIdParam card) {
+        String tColumn = (card.getCardType() == 1) ? "patient_id" : "ic_card_no";
+        if (IdCardUtil.isValidatedIdCard(card.getSocialNo())) {
+            dao.updateSocialNo(tColumn, card.getCardNo(), card.getSocialNo());
+            return ResultVoUtil.success();
+        }
+        if (StringUtil.notBlank(card.getSocialNo())) {
+            return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "您输入的身份证不合法,请修改。");
+        }
+        String socialNo = dao.selectSocialNo(tColumn, card.getCardNo());
+        if (IdCardUtil.isValidatedIdCard(socialNo)) {
+            return ResultVoUtil.success();
+        }
+        return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "您在我院存留的身份证不合法,请完善。");
+    }
+
     public ResultVo<HashMap<String, Object>> bindPatientId(BindPatientIdParam param) {
         log.info("绑定就诊卡:{}", param);
         final List<BindPatientIdParam> list;