| 
					
				 | 
			
			
				@@ -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)) { 
			 |