Forráskód Böngészése

Merge branch 'master' of http://gogs.ywtinfo.com/guochengfeng/alipay-mp-service

wuyongyi 2 éve
szülő
commit
1ac8541402

+ 4 - 1
onemini-hospital-empty/src/main/java/com/ywt/alipaympapi/core/utils/IdCardUtil.java

@@ -135,6 +135,9 @@ public final class IdCardUtil {
      * @return
      */
     public static int getCurrentAgeCommon(Date date) {
+        if (date == null) {
+            return 0;
+        }
         Calendar birthday = Calendar.getInstance();
         birthday.setTime(date);
         int year = birthday.get(Calendar.YEAR);
@@ -154,7 +157,7 @@ public final class IdCardUtil {
         if (currentMonth < month || (currentMonth == month && currentDay <= day)) {
             age--;
         }
-        return age < 0 ? 0 : age;
+        return Math.max(age, 0);
     }
 
     /**

+ 12 - 13
onemini-hospital-empty/src/main/java/com/ywt/alipaympapi/service/impl/InpatientServiceImpl.java

@@ -89,10 +89,12 @@ public class InpatientServiceImpl implements InpatientService {
     }
 
     @Override
-    public List<InpatientListResponseData> inpatientList(InpatientListRequest request) throws Exception {
-        int userId = ContextHelper.getCurrentUserIdWrapped();
-        int hospId = BizUtil.getCurrentHospitalId();
+    public List<InpatientListResponseData> inpatientList(InpatientListRequest request) {
+        int userId = Checker.parseInt(request.getUserId());
         List<InpatientListResponseData> list = new ArrayList<>();
+        if (userId <= 0) return list; // 这个接口进入小程序首页就会调用;如果用户没有授权,返回空数据,而不是弹出获取用户信息授权(会违反小程序审核规则);
+
+        int hospId = BizUtil.getCurrentHospitalId();
         GetMedicalCardListRequest getMedicalCardListRequest = GetMedicalCardListRequest.newBuilder()
                 .setHospitalId(hospId)
                 .setUserId(userId)
@@ -123,26 +125,23 @@ public class InpatientServiceImpl implements InpatientService {
 
     @Override
     public List<DailyBillResponseData> dailyBillList(DailyBillRequest request) throws Exception {
+        int userId = Checker.parseInt(request.getUserId());
         List<DailyBillResponseData> dailyBillList = new ArrayList<>();
-        List<MedicalCard> userMedCardList = new ArrayList<>();
-        int userId = ContextHelper.getCurrentUserIdWrapped();
-        String hospitalId = request.getHospitalDistrictId();
+        if (userId <= 0) return dailyBillList; // 这个接口进入小程序首页就会调用;如果用户没有授权,返回空数据,而不是弹出获取用户信息授权(会违反小程序审核规则);
+
         String date = DateUtil.formatDate(new Date(), "yyyy-MM-dd");
-        int hospId = BizUtil.getCurrentHospitalId(); // fixme
-//        String hisPatientId = "";
-        userMedCardList = getUserMedCardList(userId, hospId);
+        int hospId = BizUtil.getCurrentHospitalId();
+        List<MedicalCard> userMedCardList = getUserMedCardList(userId, hospId);
         if (Checker.isNone(userMedCardList)) {
             return dailyBillList;
         }
         for (MedicalCard m : userMedCardList) {
             DailyBillResponseData data = new DailyBillResponseData();
-            InpatientVo vo = null;
-            String admNo = "";
             String hisPatientId = m.getHisPatientId();
-            vo = getInpatientVo(userId, hisPatientId);
+            InpatientVo vo = getInpatientVo(userId, hisPatientId);
             String totalAmount = Checker.getStringValue(vo.getTotalAmount());
             String depositBalance = Checker.getStringValue(vo.getDepositBalance());
-            admNo = Checker.getStringValue(vo.getAdmNo());
+            String admNo = Checker.getStringValue(vo.getAdmNo());
             GetDayFeeListRequest req = GetDayFeeListRequest.newBuilder()
                     .setPatientId(hisPatientId)
                     .setBillDate(date)

+ 2 - 0
onemini-hospital-empty/src/main/java/com/ywt/alipaympapi/web/configs/WebMvcConfigure.java

@@ -15,6 +15,8 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter {
                 .addPathPatterns("/**")
                 .excludePathPatterns("/auth/bind")
                 .excludePathPatterns("/dev/*")
+                .excludePathPatterns("/isvRequest.inpatient.list")
+                .excludePathPatterns("/isvRequest.home.dailyBill.list")
         ;
         super.addInterceptors(registry);
     }