124 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			124 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using AIMSDAL;
 | |
| using AIMSModel;
 | |
| using AIMSObjectQuery;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| using HelperDB;
 | |
| 
 | |
| namespace AIMSBLL
 | |
| {
 | |
|     public partial class BFeesRecordReport
 | |
|     {
 | |
| 
 | |
|         public static DataTable GetUpListByWhere2(string where)
 | |
|         {
 | |
|             string sql = string.Format(@" 
 | |
|   SELECT 
 | |
| ROW_NUMBER() OVER (ORDER BY FeeCode ASC) AS noo,
 | |
|     FeeCode ,
 | |
|     ChargName ,
 | |
|     ChargSpec  , 
 | |
|     sum(convert(float,FeeNum)) FeeNum,
 | |
|     UnitPrice 
 | |
|     FROM [dbo].[FeesRecord] 
 | |
|   where FeeIsDrug=1 and {0}
 | |
|   group by FeeCode , ChargName, ChargSpec  ,UnitPrice   
 | |
|   order by  FeeCode  ", where);
 | |
|             DataTable dt = DBHelper.GetDataTable(sql);
 | |
|             return dt;
 | |
|         }
 | |
| 
 | |
|         public static DataTable GetUpListByWhere(string where)
 | |
|         {
 | |
|             string sql = string.Format(@" 
 | |
|   SELECT *,
 | |
| 	info.OperationRoom,
 | |
| 	info.PatientName,
 | |
| 	info.MdrecNo
 | |
|     FROM[dbo].[FeesRecord] 
 | |
|   left join [dbo].[V_OperationRecordInfo] info on info.RecoredId=[FeesRecord].OperationRecordId
 | |
|   where FeeIsDrug=1 and {0}
 | |
|   order by FeeCode ", where);
 | |
|             DataTable dt = DBHelper.GetDataTable(sql);
 | |
|             return dt;
 | |
|         }
 | |
| 
 | |
|         public static DataTable GetUpListByWhere3(string where)
 | |
|         {
 | |
|             string sql = string.Format(@"  
 | |
|   select FeesRecord.id,
 | |
| 	voi.OpeDAY '日期',
 | |
| 	voi.PatientName 患者姓名,
 | |
| 	voi.MdrecNo 病历号,  
 | |
| 	voi.ApplyDiagnoseInfoName 诊断,
 | |
| 	FeesRecord.ChargName  药品名称,
 | |
| 	FeesRecord.InsureNO 批号,
 | |
| 	FeesRecord.ChargSpec   '规格', 
 | |
| 	FeesRecord.Extend2+FeesRecord.Extend1 使用量,
 | |
| 	IsInsure 残余量,
 | |
| 	Conclusion 处理方式, 
 | |
| 	FeesRecord.ExecWork 操作人, 
 | |
| 	FeesRecord.Extend5 监督人
 | |
| FROM FeesRecord 
 | |
| LEFT JOIN Oris_Patient pt on pt.id=PatientId
 | |
| LEFT JOIN V_OperationRecordInfo voi on voi.RecoredId=FeesRecord.OperationRecordId
 | |
|   where FeeIsDrug=1 and FeesRecord.Extend4<>'' and {0} order by ChargName ", where); 
 | |
|             DataTable dt = DBHelper.GetDataTable(sql);
 | |
|             return dt;
 | |
|         }
 | |
|         public static DataTable GetUpListByWhere4(string where)
 | |
|         {
 | |
|             string sql = string.Format(@" 
 | |
|   select FeesRecord.id,
 | |
| 	voi.OpeDAY '开医嘱时间',
 | |
| 	voi.MdrecNo ID号,
 | |
| 	voi.PatientName 姓名,
 | |
| 	voi.Sex 性别, 
 | |
| 	pt.IdentityCard 身份证号,
 | |
| 	voi.ApplyDiagnoseInfoName 诊断,
 | |
| 	FeesRecord.ChargName  药品名称,
 | |
| 	FeesRecord.InsureNO 药品批号,
 | |
| 	FeesRecord.ChargSpec   规格,
 | |
| 	FeesRecord.FeeNum   收费数量,
 | |
| 	FeesRecord.Extend2+FeesRecord.Extend1 使用量,
 | |
| 	IsInsure 余量,
 | |
| 	Conclusion 余液处理方式, 
 | |
| 	FeesRecord.ExecWork 处置者, 
 | |
| 	FeesRecord.Extend5 审核者
 | |
| FROM FeesRecord 
 | |
| LEFT JOIN Oris_Patient pt on pt.id=PatientId
 | |
| LEFT JOIN V_OperationRecordInfo voi on voi.RecoredId=FeesRecord.OperationRecordId
 | |
|   where FeeIsDrug=1 and FeesRecord.Extend4<>'' and {0} ", where);
 | |
|             DataTable dt = DBHelper.GetDataTable(sql);
 | |
|             return dt;
 | |
|         }
 | |
| 
 | |
|         public static DataTable GetDrugByType(string where)
 | |
|         {
 | |
|             string sql = string.Format(@" select ChargName from [FeesRecord] where Extend4<>'' and FeeTypeId='{0}' group by ChargName ", where);
 | |
|             DataTable dt = DBHelper.GetDataTable(sql);
 | |
|             return dt;
 | |
|         }
 | |
|         public static void UpdateChargcyl(string where)
 | |
|         {
 | |
|             string sql = string.Format(@" 
 | |
|   Update [FeesRecord] set IsInsure=(select   convert(nvarchar(10),(num*Qty)-Qty2 )+ unitt from (
 | |
| SELECT    fr.Id 
 | |
| 		,[FeeNum]  num
 | |
|       ,[Extend1] unitt 
 | |
| 	  ,	CASE WHEN ISNUMERIC( fr.[Extend2] )=1 AND  fr.[Extend2]  not LIKE '%[^0-9.]%' 
 | |
| 	THEN CAST(  fr.[Extend2] AS DECIMAL(19,6)) 
 | |
| 	ELSE 0.0 END AS Qty2
 | |
| 	  ,	CASE WHEN ISNUMERIC(Drugs.Dosage )=1 AND Drugs.Dosage   not LIKE '%[^0-9.]%' 
 | |
| 	THEN CAST( Drugs.Dosage AS DECIMAL(19,6)) 
 | |
| 	ELSE 0.0 END AS Qty  
 | |
|   FROM [dbo].[FeesRecord] fr
 | |
|   left join Drugs on fr.FeeId =Drugs.Id where  fr.Id= [FeesRecord].Id) temp)
 | |
|   where  FeeIsDrug=1 and FeesRecord.Extend4<>'' and {0}", where);
 | |
|           DBHelper.ExecuteScalar(sql); 
 | |
|         }
 | |
|     }
 | |
| }
 |