|
@@ -168,7 +168,6 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
|
throw new AppMessageException("暂不支持修改诊疗卡功能");
|
|
|
}
|
|
|
|
|
|
- // 就诊卡详情
|
|
|
@Override
|
|
|
public QuerySingleCardResponseData querySingleMedicCard(QuerySingleCardRequest request) throws Exception {
|
|
|
// 此处传诊疗卡ID和userId
|
|
@@ -197,16 +196,19 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
|
return item;
|
|
|
}
|
|
|
|
|
|
- // 我的证件
|
|
|
+ // 查询用户默认就诊卡,获取用户就诊卡列表,用身份证匹配
|
|
|
@Override
|
|
|
public QueryDefaultCardResponseData queryDefaultMedicCard(QueryDefaultCardRequest request) throws Exception {
|
|
|
int hospitalId = BizUtil.getCurrentHospitalId();
|
|
|
int userId = ContextHelper.getCurrentUserIdWrapped();
|
|
|
- List<MedicalCard> list = getUserMedCardList(userId, hospitalId).stream()
|
|
|
- .sorted(Comparator.comparing(MedicalCard::getLastChosenTime).reversed())
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (list.isEmpty()) return null;
|
|
|
- MedicalCard medicalCard = list.get(0);
|
|
|
+ // 获取用户身份证
|
|
|
+ User user = getUserInfoById(userId);
|
|
|
+ String idNo = Checker.getStringValue(user.getIdno());
|
|
|
+ MedicalCard medicalCard = getUserMedCardList(userId, hospitalId).stream()
|
|
|
+ .filter(c -> idNo.equals(c.getIdNo()))
|
|
|
+ .findFirst()
|
|
|
+ .orElse(null);
|
|
|
+ if (medicalCard == null) throw new AppMessageException("找不到身份证一致的诊疗卡");
|
|
|
double balance = medicalCard.getBalance() / 100d;
|
|
|
QueryDefaultCardResponseData item = new QueryDefaultCardResponseData();
|
|
|
item.setCardNum(medicalCard.getCardNo());//就诊卡卡号/医保卡卡号
|
|
@@ -224,7 +226,6 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
|
return item;
|
|
|
}
|
|
|
|
|
|
- // 查询就诊卡列表
|
|
|
@Override
|
|
|
public PageVO<QueryListCardResponseData> queryListMedicCard(QueryListCardRequest request) throws Exception {
|
|
|
int hospitalId = BizUtil.getCurrentHospitalId();
|
|
@@ -253,7 +254,6 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
|
return new PageVO<>(pagination, lst);
|
|
|
}
|
|
|
|
|
|
- // 删除就诊卡
|
|
|
@Override
|
|
|
public DeleteCardResponseData deleteMedicCard(DeleteCardRequest request) throws Exception {
|
|
|
int cardId = Checker.parseInt(request.getCardId());
|
|
@@ -424,6 +424,16 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
|
return getMedicalCardListResponse.getMedicalCardsList();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据用户 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());
|
|
|
+ return response.getUser();
|
|
|
+ }
|
|
|
+
|
|
|
// 查看就诊人详情
|
|
|
@Override
|
|
|
public QueryPatientDetailResponse querySinglePatient(QueryPatientDetailRequest request) throws Exception {
|
|
@@ -455,6 +465,7 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
|
return r;
|
|
|
}
|
|
|
|
|
|
+ // 查询登录用户就诊卡列表
|
|
|
@Override
|
|
|
public List<MyCardListResponse> myCardList(MyCardListRequest request) throws Exception {
|
|
|
return null;
|