lihong пре 2 година
родитељ
комит
4c27aa52da

+ 11 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/PatientMiSzController.java

@@ -5,13 +5,16 @@ import cn.hnthyy.thmz.Utils.WindowsUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.zy.PatientMiSfz;
 import cn.hnthyy.thmz.enums.GenderEnum;
+import cn.hnthyy.thmz.service.his.zy.APatientMiService;
 import cn.hnthyy.thmz.service.his.zy.PatientMiSfzService;
+import cn.hutool.core.collection.CollUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.ResourceUtils;
 import org.springframework.web.bind.annotation.*;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -19,6 +22,7 @@ import java.util.Map;
 public class PatientMiSzController {
     @Autowired
     private PatientMiSfzService patientMiSfzService;
+    private APatientMiService aPatientMiService;
     /**
      * 查询用户的身份证信息
      * @return
@@ -34,6 +38,13 @@ public class PatientMiSzController {
         }
         try {
             PatientMiSfz patientMiSfz=patientMiSfzService.queryPatientMiSfzByPatientId(patientId);
+            if (patientMiSfz == null) {
+                List<String> stringList = aPatientMiService.queryInPatientNoByMzNo(patientId);
+                if (CollUtil.isNotEmpty(stringList)) {
+                    String patNO = stringList.get(0);
+                    patientMiSfz = patientMiSfzService.queryByPatNo(patNO,patientId);
+                }
+            }
             if(patientMiSfz!=null){
                 resultMap.put("code", 0);
                 resultMap.put("message", "查询用户的身份证信息成功");

+ 5 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zy/PatientMiSfzMapper.java

@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -47,4 +48,8 @@ public interface PatientMiSfzMapper {
             " (#{socialNo}, #{name}, #{sex}, #{nation}, #{birthDay}, #{address}, #{agency}, #{expirestart}, #{expireend}, #{txImage}, #{sfzImage}, #{inpatientNo},#{patientId}) ")
     int insertPatientMiSfz(PatientMiSfz patientMiSfz);
 
+    @Select("select top 1 * from patient_mi_sfz where inpatient_no=#{patNO} and sfz_image is not null ")
+    PatientMiSfz selectByPatNo(String patNO);
+    @Update(" update patient_mi_sfz set patient_id=#{patientId} where inpatient_no=#{patNO} and sfz_image is not null ")
+    void updatePatientId(@Param("patNO") String patNO,@Param("patientId") String patientId);
 }

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/his/zy/PatientMiSfzService.java

@@ -20,4 +20,12 @@ public interface PatientMiSfzService {
      * @return
      */
     int savePatientMiSfz(PatientMiSfz patientMiSfz);
+   /**
+    * @description: 通过住院号查询身份证信息
+    * @author: lihong
+    * @date: 2023/11/24 11:16
+    * @param: patNO
+    * @return: cn.hnthyy.thmz.entity.his.zy.PatientMiSfz
+    **/
+    PatientMiSfz queryByPatNo(String patNO,String patientId);
 }

+ 18 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zy/PatientMiSfzServiceImpl.java

@@ -33,4 +33,22 @@ public class PatientMiSfzServiceImpl implements PatientMiSfzService {
         patientMiSfzMapper.deletePatientMiSfzByPatientId(patientMiSfz.getPatientId());
         return  patientMiSfzMapper.insertPatientMiSfz(patientMiSfz);
     }
+
+    /**
+     * @param patNO
+     * @description: 通过住院号查询身份证信息
+     * @author: lihong
+     * @date: 2023/11/24 11:16
+     * @param: patNO
+     * @return: cn.hnthyy.thmz.entity.his.zy.PatientMiSfz
+     */
+    @Override
+    public PatientMiSfz queryByPatNo(String patNO,String patientId) {
+        PatientMiSfz patientMiSfz = patientMiSfzMapper.selectByPatNo(patNO);
+        if (patientMiSfz != null) {
+        //  更新门诊号
+            patientMiSfzMapper.updatePatientId(patNO,patientId);
+        }
+        return patientMiSfz;
+    }
 }