|
@@ -165,14 +165,12 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 就诊卡详情
|
|
@Override
|
|
@Override
|
|
public QuerySingleCardResponseData querySingleMedicCard(QuerySingleCardRequest request) throws Exception {
|
|
public QuerySingleCardResponseData querySingleMedicCard(QuerySingleCardRequest request) throws Exception {
|
|
// 此处传诊疗卡ID和userId
|
|
// 此处传诊疗卡ID和userId
|
|
String cardNum = request.getCardNum();
|
|
String cardNum = request.getCardNum();
|
|
- if (Checker.isNone(cardNum)) {
|
|
|
|
- throw new AppMessageException("诊疗卡不存在");
|
|
|
|
- }
|
|
|
|
- int cardId = Integer.parseInt(cardNum);
|
|
|
|
|
|
+ CheckUtil.ensureNotEmpty(cardNum, "诊疗卡号不能为空");
|
|
int hospitalId = BizUtil.getCurrentHospitalId();
|
|
int hospitalId = BizUtil.getCurrentHospitalId();
|
|
int userId = ContextHelper.getCurrentUserIdWrapped();
|
|
int userId = ContextHelper.getCurrentUserIdWrapped();
|
|
GetMedicalCardListRequest getMedicalCardListRequest = GetMedicalCardListRequest.newBuilder()
|
|
GetMedicalCardListRequest getMedicalCardListRequest = GetMedicalCardListRequest.newBuilder()
|
|
@@ -181,28 +179,27 @@ public class IsvMedicCardServiceImpl implements IsvMedicCardService {
|
|
.build();
|
|
.build();
|
|
GetMedicalCardListResponse getMedicalCardListResponse = userServiceBlockingStub.getMedicalCardList(getMedicalCardListRequest);
|
|
GetMedicalCardListResponse getMedicalCardListResponse = userServiceBlockingStub.getMedicalCardList(getMedicalCardListRequest);
|
|
Result result = getMedicalCardListResponse.getResult();
|
|
Result result = getMedicalCardListResponse.getResult();
|
|
-
|
|
|
|
- if (result.getCode() == ResultCode.SUCCEED) {
|
|
|
|
- for (MedicalCard medicalCard : getMedicalCardListResponse.getMedicalCardsList()) {
|
|
|
|
- if (medicalCard.getCardId() == cardId) {
|
|
|
|
- double balance = medicalCard.getBalance() / 100d;
|
|
|
|
- QuerySingleCardResponseData item = new QuerySingleCardResponseData();
|
|
|
|
- item.setCardNum(medicalCard.getCardNo());//就诊卡卡号/医保卡卡号
|
|
|
|
- String cardType = medicalCard.getCardType();
|
|
|
|
- item.setType("0");//标记查询卡类型
|
|
|
|
- item.setName(medicalCard.getPatientName());//姓名
|
|
|
|
- item.setSex(SexEnum.getSexDisplayName(medicalCard.getSex()));//性别
|
|
|
|
- item.setBirthDay(medicalCard.getBirthday());//生日
|
|
|
|
- item.setIdCardNo(medicalCard.getIdNo());//身份证号码
|
|
|
|
- item.setPhoneNumber(medicalCard.getMobile());//手机号
|
|
|
|
- item.setBalance(balance + "");//卡内余额
|
|
|
|
- item.setRelationShip(RelationshipEnum.valueOf(medicalCard.getRelationship()).getDisplayName()); // 关系
|
|
|
|
- item.setDefaultCard(medicalCard.getIsDefault() ? "是" : "否");//是否是默认就诊卡
|
|
|
|
- return item;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
|
|
+ if (result.getCode() != ResultCode.SUCCEED) throw new AppMessageException(result.getInfo());
|
|
|
|
+ List<MedicalCard> list = getMedicalCardListResponse.getMedicalCardsList().stream()
|
|
|
|
+ .filter(c -> Checker.getStringValue(c.getCardNo()).equals(cardNum))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ if (list.isEmpty()) return null;
|
|
|
|
+ MedicalCard medicalCard = list.get(0);
|
|
|
|
+ double balance = medicalCard.getBalance() / 100d;
|
|
|
|
+ QuerySingleCardResponseData item = new QuerySingleCardResponseData();
|
|
|
|
+ item.setCardNum(medicalCard.getCardNo());//就诊卡卡号/医保卡卡号
|
|
|
|
+ String cardType = medicalCard.getCardType();
|
|
|
|
+ item.setType("0");// 标记查询卡类型
|
|
|
|
+ item.setName(medicalCard.getPatientName());//姓名
|
|
|
|
+ item.setSex(SexEnum.getSexDisplayName(medicalCard.getSex()));//性别
|
|
|
|
+ item.setBirthDay(medicalCard.getBirthday());//生日
|
|
|
|
+ item.setIdCardNo(medicalCard.getIdNo());//身份证号码
|
|
|
|
+ item.setPhoneNumber(medicalCard.getMobile());//手机号
|
|
|
|
+ item.setBalance(balance + "");//卡内余额
|
|
|
|
+ item.setRelationShip(RelationshipEnum.valueOf(medicalCard.getRelationship()).getDisplayName()); // 关系
|
|
|
|
+ item.setDefaultCard(medicalCard.getIsDefault() ? "是" : "否");// FIXME: 是否是默认就诊卡
|
|
|
|
+ item.setId(medicalCard.getCardId());
|
|
|
|
+ return item;
|
|
}
|
|
}
|
|
|
|
|
|
// 我的证件
|
|
// 我的证件
|