Browse Source

解决未知的空指针

hurugang 2 years ago
parent
commit
6f9ecbc3bb

+ 9 - 9
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -1617,7 +1617,7 @@ public class MzChargeDetailController {
                     mzPrescriptionVo.setVisitDeptCode(mzfzPatientOrder.getDeptCode());
                 }
             }
-            if(!deptCodes.contains(mzPrescriptionVo.getVisitDeptCode())){
+            if (!deptCodes.contains(mzPrescriptionVo.getVisitDeptCode())) {
                 //如果设置的医生接诊科室不在医生的科室列表中,说明是取的该患者上一次就诊医生所属科室,将当前医生的第一个科室替换成实际接诊科室
                 mzPrescriptionVo.setVisitDeptCode(deptCodes.get(0));
             }
@@ -1885,8 +1885,8 @@ public class MzChargeDetailController {
 //                    Thread.sleep(1000);
 //                    patientDuringSiSettle = tsmzService.isPatientDuringSiSettle(mzChargeDetail.getPatientId());
 //                }
-                Clinic clinic= clinicService.queryByPatientIdAndTimesAndReceiptNo(patientId,times,0);
-                Integer countYbZf = clinic==null?YesNoEnum.NO.code:clinic.getZgmztczf();
+                Clinic clinic = clinicService.queryByPatientIdAndTimesAndReceiptNo(patientId, times, 0);
+                Integer countYbZf = (clinic == null || clinic.getZgmztczf() == null) ? YesNoEnum.NO.code : clinic.getZgmztczf();
                 if (YesNoEnum.YES.code.equals(countYbZf)) {
                     MzVisitTable mzVisitTable = mzVisitTableService.queryByPatientIdAndTimes(patientId, times);
                     if (mzVisitTable == null) {
@@ -2377,16 +2377,16 @@ public class MzChargeDetailController {
             }
             String deptNo = mzfzPatientOrderService.queryLastByPatientIdAndDoctor(patientId, tokenUser.getUserIdCode());
             if (deptNo == null || StringUtils.isBlank(deptNo)) {
-                deptNo=turnToConsultationService.queryLastByPatientIdAndDoctor(patientId, tokenUser.getUserIdCode());
+                deptNo = turnToConsultationService.queryLastByPatientIdAndDoctor(patientId, tokenUser.getUserIdCode());
             }
             if (deptNo == null || StringUtils.isBlank(deptNo)) {
-                deptNo=clinicService.queryLastByPatientIdAndDoctor(patientId, tokenUser.getUserIdCode());
+                deptNo = clinicService.queryLastByPatientIdAndDoctor(patientId, tokenUser.getUserIdCode());
             }
-            if(deptNo == null || StringUtils.isBlank(deptNo)){
+            if (deptNo == null || StringUtils.isBlank(deptNo)) {
                 //没有任何科室信息就将当前医生的第一个科室返回
-                List<String> deptNos=userDeptRelationService.queryAllByUserIdCode(tokenUser.getUserIdCode());
-                if(deptNos!=null && deptNos.size()>0){
-                    deptNo=deptNos.get(0);
+                List<String> deptNos = userDeptRelationService.queryAllByUserIdCode(tokenUser.getUserIdCode());
+                if (deptNos != null && deptNos.size() > 0) {
+                    deptNo = deptNos.get(0);
                 }
             }
             if (deptNo == null || StringUtils.isBlank(deptNo)) {

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -302,7 +302,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         }
         returnMzChargeDetail.setDiscountAmount(returnMzChargeDetail.getNotDiscountAmount().subtract(returnMzChargeDetail.getAmount()).setScale(1, BigDecimal.ROUND_HALF_UP));
         Clinic clinic=clinicMapper.selectByPatientIdAndTimesAndReceiptNo(mzChargeDetail.getPatientId(),mzChargeDetail.getTimes(),0);
-        returnMzChargeDetail.setCountYbZf(clinic==null?0:clinic.getZgmztczf());
+        returnMzChargeDetail.setCountYbZf((clinic==null|| clinic.getZgmztczf()==null)?0:clinic.getZgmztczf());
 //        Map<String, Object> insuinfoMap = tsmzService.queryInsuinfo(Constants.BRZZJF_CODE, mzChargeDetail.getPatientId());
 //        if (insuinfoMap != null && insuinfoMap.size() > 0) {
 //            if (Integer.valueOf(0).equals(insuinfoMap.get("code"))) {