| 
					
				 | 
			
			
				@@ -30,7 +30,7 @@ public interface SiMzDao { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     PsnBaseInfo selectPsnBaseinfo(@Param("patNo") String patNo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 @Param("times") int times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Select("SELECT a.patient_id,a.times,a.visit_dept_code,b.adress,b.phone_no, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Select("SELECT rtrim(a.patient_id) as patientId,a.times,a.visit_dept_code,b.adress,b.phone_no, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "b.name,b.age,sex=case when b.sex='1' then '男' when b.sex='2' then '女' else '未知' end, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "visitDeptName=(select rtrim(name) from zd_unit_code where code=a.visit_dept_code), " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "a.doctor_code,a.visit_date,a.receipt_no,a.order_no,a.op_day, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -91,21 +91,24 @@ public interface SiMzDao { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     void deleteAllReceipts(@Param("patNo") String patNo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            @Param("times") Integer times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Select("select patient_id as patNo,times,charge_date,receipt_no, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Select("select rtrim(patient_id) as patNo,times,charge_date,receipt_no, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "chargeFee=(select cast(sum(isnull(unit_price,0.01)*isnull(drug_win,1)*isnull(quantity,1)) as decimal(16,2))), " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "status=(select count(1) from t_mt_receipt d where d.patient_id=a.patient_id and d.times=a.times and d.receipt_no=a.receipt_no) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "from mz_charge_detail a where a.patient_id=#{patNo} and a.charge_date>=#{start} and a.charge_date<=#{end} " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "and pay_mark=0 and confirm_flag!=4 and isnull(cash_id,'')!='99998' group by patient_id, times, charge_date,receipt_no order by times") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     List<MzDepositFile> selectMzDepositFiles(@Param("patNo") String patNo, @Param("start") String start, @Param("end") String end); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Select("select patient_id,times,receipt_no,order_no,item_no,charge_item_code, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Select("select rtrim(patient_id) as patient_id,times,receipt_no,order_no,item_no,charge_item_code, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "charge_bill_code,quantity,unit_price,serial,serial_no, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "frequency,drug_quan,drug_unit,supply_code,charge_date, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "doctorName=(select rtrim(name) from a_employee_mi where code=doctor_code)," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "group_no,confirm_flag,instruction_text,drug_win,price_time,tc_no, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            "bill_item_code,doctor_code,tc_name,drugName=(case when group_no='00' then " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "bill_item_code,doctor_code,tc_name," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "drugName=(case when group_no='00' then " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "(select name from zd_charge_item a where a.code=charge_item_code) else " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "(select top 1 name from yp_zd_dict a where a.code=charge_item_code) end)," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "ybComment=(case when group_no='00' then null else " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "(select max(yb_comment_new) from yp_zd_dict where code=charge_item_code) end)," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "nationalCode=(case when group_no='00' then " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "(select national_code from zd_charge_item a where a.code=charge_item_code) else " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "(select max(national_code) from yp_zd_dict a where a.code=charge_item_code) end) " + 
			 |