@ -113,7 +113,7 @@ namespace PEIS.Utils
/// </summary>
/// </summary>
/// <param name="eid">体检号</param>
/// <param name="eid">体检号</param>
/// <returns></returns>
/// <returns></returns>
public static FastReport . Report GetReport ( Int64 eid , String paramFile = null )
public static FastReport . Report GetReport ( Int64 eid , String paramFile = null , FastReport . Report combineReport = null )
{
{
try
try
{
{
@ -130,19 +130,19 @@ namespace PEIS.Utils
switch ( string . IsNullOrEmpty ( paramFile ) ? fileName : paramFile )
switch ( string . IsNullOrEmpty ( paramFile ) ? fileName : paramFile )
{
{
case "Children.frx" :
case "Children.frx" :
return EasyReport ( patient , eid , filePath ) ;
return EasyReport ( patient , eid , filePath , combineReport ) ;
case "Student.frx" :
case "Student.frx" :
return EasyReport ( patient , eid , filePath ) ;
return EasyReport ( patient , eid , filePath , combineReport ) ;
case "Teacher.frx" :
case "Teacher.frx" :
return EasyReport ( patient , eid , filePath ) ;
return EasyReport ( patient , eid , filePath , combineReport ) ;
case "Work.frx" :
case "Work.frx" :
return EasyReport ( patient , eid , filePath ) ;
return EasyReport ( patient , eid , filePath , combineReport ) ;
case "Health.frx" :
case "Health.frx" :
return EasyReport ( patient , eid , filePath ) ;
return EasyReport ( patient , eid , filePath , combineReport ) ;
case "CAPReport.frx" :
case "CAPReport.frx" :
return CAPReport ( patient , eid , filePath ) ;
return CAPReport ( patient , eid , filePath , combineReport ) ;
default :
default :
return General ( patient , eid , filePath ) ;
return General ( patient , eid , filePath , combineReport ) ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
@ -239,9 +239,13 @@ namespace PEIS.Utils
/// <param name="eid"></param>
/// <param name="eid"></param>
/// <param name="filePath"></param>
/// <param name="filePath"></param>
/// <returns></returns>
/// <returns></returns>
private static FastReport . Report CAPReport ( EnrollmentPatient patient , Int64 eid , string filePath )
private static FastReport . Report CAPReport ( EnrollmentPatient patient , Int64 eid , string filePath , FastReport . Report combineReport )
{
{
var rpt = new FastReport . Report ( ) ; //实例化一个Report报表
var rpt = combineReport ;
if ( rpt = = null )
{
rpt = new FastReport . Report ( ) ; //实例化一个Report报表
}
rpt . Load ( filePath ) ;
rpt . Load ( filePath ) ;
var lstEFeeItems = new ReportModel ( ) . GetEFeeItem ( eid ) ;
var lstEFeeItems = new ReportModel ( ) . GetEFeeItem ( eid ) ;
@ -485,7 +489,14 @@ namespace PEIS.Utils
//症状
//症状
SetDataSource ( ref rpt , symptoms , "CAS" , "Symptoms" ) ;
SetDataSource ( ref rpt , symptoms , "CAS" , "Symptoms" ) ;
rpt . Prepare ( ) ; //准备
if ( combineReport = = null )
{
rpt . Prepare ( ) ; //准备
}
else
{
rpt . Prepare ( true ) ; //合并报表
}
return rpt ;
return rpt ;
}
}
@ -496,9 +507,13 @@ namespace PEIS.Utils
/// <param name="eid"></param>
/// <param name="eid"></param>
/// <param name="filePath"></param>
/// <param name="filePath"></param>
/// <returns></returns>
/// <returns></returns>
private static FastReport . Report General ( EnrollmentPatient patient , Int64 eid , string filePath )
private static FastReport . Report General ( EnrollmentPatient patient , Int64 eid , string filePath , FastReport . Report combineReport )
{
{
var rpt = new FastReport . Report ( ) ; //实例化一个Report报表
var rpt = combineReport ;
if ( rpt = = null )
{
rpt = new FastReport . Report ( ) ; //实例化一个Report报表
}
rpt . Load ( filePath ) ;
rpt . Load ( filePath ) ;
var lstEFeeItems = new ReportModel ( ) . GetEFeeItem ( eid ) ;
var lstEFeeItems = new ReportModel ( ) . GetEFeeItem ( eid ) ;
@ -574,7 +589,14 @@ namespace PEIS.Utils
SetDataSource ( ref rpt , lstPacsPhotos . Concat ( lstExts . Where ( w = > w . ReportImg ! = null ) . Select ( s = > new Entity . Report { ReportImage = s . ReportImg } ) ) , "I" , "PACSImage" ) ;
SetDataSource ( ref rpt , lstPacsPhotos . Concat ( lstExts . Where ( w = > w . ReportImg ! = null ) . Select ( s = > new Entity . Report { ReportImage = s . ReportImg } ) ) , "I" , "PACSImage" ) ;
// 科室小结
// 科室小结
SetDataSource ( ref rpt , lstExamParts , "D" , "DeptSummary" ) ;
SetDataSource ( ref rpt , lstExamParts , "D" , "DeptSummary" ) ;
rpt . Prepare ( ) ; //准备
if ( combineReport = = null )
{
rpt . Prepare ( ) ; //准备
}
else
{
rpt . Prepare ( true ) ; //合并报表
}
return rpt ;
return rpt ;
}
}
@ -585,9 +607,13 @@ namespace PEIS.Utils
/// <param name="eid"></param>
/// <param name="eid"></param>
/// <param name="filePath"></param>
/// <param name="filePath"></param>
/// <returns></returns>
/// <returns></returns>
private static FastReport . Report EasyReport ( EnrollmentPatient patient , Int64 eid , string filePath )
private static FastReport . Report EasyReport ( EnrollmentPatient patient , Int64 eid , string filePath , FastReport . Report combineReport )
{
{
var rpt = new FastReport . Report ( ) ; //实例化一个Report报表
var rpt = combineReport ;
if ( rpt = = null )
{
rpt = new FastReport . Report ( ) ; //实例化一个Report报表
}
rpt . Load ( filePath ) ;
rpt . Load ( filePath ) ;
var lstExts = new ReportModel ( ) . GetReportExt ( eid ) ;
var lstExts = new ReportModel ( ) . GetReportExt ( eid ) ;
var lstChildren = new ReportModel ( ) . GetFastResult ( eid ) ;
var lstChildren = new ReportModel ( ) . GetFastResult ( eid ) ;
@ -640,7 +666,14 @@ namespace PEIS.Utils
SetParameter ( ref rpt , dict ) ;
SetParameter ( ref rpt , dict ) ;
// 第三方报告
// 第三方报告
//SetDataSource(ref rpt, lstExts, "I", "ImageList");
//SetDataSource(ref rpt, lstExts, "I", "ImageList");
rpt . Prepare ( ) ; //准备
if ( combineReport = = null )
{
rpt . Prepare ( ) ; //准备
}
else
{
rpt . Prepare ( true ) ; //合并报表
}
return rpt ;
return rpt ;
}
}
@ -1056,92 +1089,13 @@ namespace PEIS.Utils
{
{
try
try
{
{
var rpt = new FastReport . Report ( ) ;
FastReport . Report report = null ;
var i = 0 ;
foreach ( var eid in idlist )
foreach ( var eid in idlist )
{
{
var patient = new ReportModel ( ) . GetPatientInfo ( eid ) ;
report = ReportHelper . GetReport ( eid , null , report ) ;
if ( patient = = null ) return null ;
var fileName =
DAOHelp . GetDataBySQL < Config > (
$"SELECT Description FROM Dict_Config where Value='{patient.Type}'" ) . FirstOrDefault ( )
? . Description ? ? "PReport.frx" ;
var filePath = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "ReportFiles" ,
fileName ) ;
if ( ! File . Exists ( filePath ) )
{
MessageBox . Show ( $@"未找到报告单模板文件:{fileName}" , @"获取报告单失败" ) ;
return null ;
}
if ( fileName ! = "PReport.frx" )
{
rpt = EasyReport ( patient , eid , filePath ) ;
rpt . Prepare ( i > 0 ) ;
}
else
{
rpt . Load ( filePath ) ;
var lstEFeeItems = new ReportModel ( ) . GetEFeeItem ( eid ) ;
var lstConclusions = new ReportModel ( ) . GetExamConclusions ( eid ) ;
var lstGeneral = new ReportModel ( ) . GetGeneralResult ( eid ) ;
var lstLis = new ReportModel ( ) . GetLisResult ( eid ) ;
var lstPacs = new ReportModel ( ) . GetPacsResult ( eid ) ;
var lstPacsPhotos = new ReportModel ( ) . GetPacsPhoto ( eid ) ;
// 登记信息
rpt . SetParameterValue ( "PatientName" , patient . Name ) ;
rpt . SetParameterValue ( "CardNo" , patient . CardNo ) ;
rpt . SetParameterValue ( "Nation" , patient . Nation ) ;
rpt . SetParameterValue ( "Age" , patient . Age + patient . AgeClass ) ;
rpt . SetParameterValue ( "Sex" , patient . Sex = = "1" ? "男" : patient . Sex = = "2" ? "女" : "" ) ;
rpt . SetParameterValue ( "ExamID" , patient . ID . ToString ( ) ) ;
rpt . SetParameterValue ( "ExamDate" , patient . SignTime ? . ToShortDateString ( ) ) ;
rpt . SetParameterValue ( "Marriage" , patient . Marriage ) ;
rpt . SetParameterValue ( "TeamName" , patient . OrgName ) ;
rpt . SetParameterValue ( "GroupName" , patient . GroupName ) ;
rpt . SetParameterValue ( "ExamType" , patient . Type ) ;
rpt . SetParameterValue ( "Address" , patient . Address1 ) ;
rpt . SetParameterValue ( "Tel" , patient . Tel1 ) ;
rpt . SetParameterValue ( "FinishPerson" , patient . Finisher ) ;
rpt . SetParameterValue ( "FinishDate" , patient . FinishTime ? . ToShortDateString ( ) ) ;
rpt . SetParameterValue ( "HospitalName" , Global . _ hospital . Name ) ;
if ( patient . Photo = = null )
{
rpt . SetParameterValue ( "Avatar" , patient . Photo ) ;
}
else
{
byte [ ] imageBytes = Convert . FromBase64String ( patient . Photo ) ;
using ( MemoryStream ms = new MemoryStream ( imageBytes ) )
{
Image image = Image . FromStream ( ms ) ;
using ( MemoryStream stream = new MemoryStream ( ) )
{
image . Save ( stream , ImageFormat . Png ) ;
rpt . SetParameterValue ( "Avatar" , Convert . ToBase64String ( stream . ToArray ( ) ) ) ;
}
}
}
// 收费列表
SetDataSource ( ref rpt , lstEFeeItems , "F" , "FeeItems" ) ;
// 总结结论词
SetDataSource ( ref rpt , lstConclusions , "C" , "Conclusion" ) ;
//一般检查
SetDataSource ( ref rpt , lstGeneral , "G" , "General" ) ;
//PACS
SetDataSource ( ref rpt , lstPacs , "P" , "PACS" ) ;
//LIS
SetDataSource ( ref rpt , lstLis , "L" , "LIS" ) ;
// PacsImage
SetDataSource ( ref rpt , lstPacsPhotos , "I" , "PACSImage" ) ;
rpt . Prepare ( i > 0 ) ;
}
i + + ;
}
}
return rpt ;
return report ;
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{