فهرست منبع

fix: 修复获取诊疗卡详情错误的问题

Walker 2 سال پیش
والد
کامیت
983ec5b90c

+ 19 - 9
onemini-hospital-empty/src/main/java/com/ywt/alipaympapi/service/impl/IsvMedicCardServiceImpl.java

@@ -405,6 +405,7 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
         return null;
     }
 
+    // 修改就诊人
     @Override
     public UpdatePatientResponse updatePatient(UpdatePatientRequest request) throws Exception {
         return null;
@@ -417,13 +418,22 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
         int userId = ContextHelper.getCurrentUserIdWrapped();
         int hospitalId = BizUtil.getCurrentHospitalId();
         // 如果不传诊疗卡 id,则查询本人诊疗卡
-        // 获取用户身份证
-        User user = getUserInfoById(userId);
-        String idNo = Checker.getStringValue(user.getIdno());
-        MedicalCard c = getUserMedCardList(userId, hospitalId).stream()
-                .filter(i -> StringHelper.isNullOrEmpty(idNo) ? i.getCardId() == Checker.parseInt(id) : idNo.equals(i.getIdNo()))
-                .findFirst()
-                .orElse(null);
+        MedicalCard c;
+        if (StringHelper.isNullOrEmpty(id)) {
+            // 获取用户身份证
+            User user = getUserInfoById(userId);
+            String idNo = Checker.getStringValue(user.getIdno());
+            c = getUserMedCardList(userId, hospitalId).stream()
+                    .filter(i -> idNo.equals(i.getIdNo()))
+                    .findFirst()
+                    .orElse(null);
+        } else {
+            c = getUserMedCardList(userId, hospitalId).stream()
+                    .filter(i -> i.getCardId() == Checker.parseInt(id))
+                    .findFirst()
+                    .orElse(null);
+        }
+
         if (c == null) throw new AppMessageException("找不到诊疗卡信息");
         QueryPatientDetailResponse r = new QueryPatientDetailResponse();
         List<MedicCard> medicCards = new ArrayList<>();
@@ -483,11 +493,11 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
 
     /**
      * 根据用户 id 获取用户信息
-     *
      */
     public User getUserInfoById(int userId) throws AppMessageException {
         UserResponse response = userServiceBlockingStub.findByUserId(UserRequest.newBuilder().setUserid(userId).build());
-        if (response.getResult().getCode() != ResultCode.SUCCEED) throw new AppMessageException("无法获取用户信息:" + response.getResult().getInfo());
+        if (response.getResult().getCode() != ResultCode.SUCCEED)
+            throw new AppMessageException("无法获取用户信息:" + response.getResult().getInfo());
         return response.getUser();
     }
 }