M和打印及绘图的火花

嗯?M作为操作Cache数据库的语言好像没有画笔操作啊,好像也不能调打印机啊。哪来的什么绘图和打印(这里的绘图指用画笔画,不是还原Base64串)。

本篇有助于检验理解打印原理,非检验组引入实现经验。

这里就得说的M的强大之处了。M作为操作Cache数据库的“完备”编程语言,注意是“完备”,关系库的存储过程作为编程语言还不够完备。M又有tcp,又可轻松调用webservice,又可以很容易发布webservice。既然M没画笔、不好操作打印机。那么我用别的语言(比如C#)实现画笔和打印之后,借助M的Webservice调用别的语言,或者别的语言调用M发布的Webservice得到打印和画图数据不就可以了。

这就又引发了一个问题。既然别的语言实现了打印画图操作,我为什么要用M调用,或者调用M逻辑呢?岂不是多此一举,脱裤子放屁了?

回答上面的问题就是:
1.M操作的是Cache数据库啊,所有数据都在数据库里面,打印和画图岂不是想取什么取什么,避免了多次数据库交互,打印模板和业务数据组装都在M里一次干完了。
2.既然是打印,那肯定很容易变业务啊。M作为脚本语言,适应业务变化的能力不用说了吧,还好调试。

所以用M控制打印和画图就是一件很美的事。只要你能打通M和一个外部绘图打印语言的通道,就打开了一扇大门。需要做以下工作。

1.做好M和别的语言进行打印和绘图交互的数据约定,M的优点的取数控和控制数据方便,按约定输出数据就行。

2.实现M和别的语言的交互通道,让别的语言能获取M输出的打印绘图数据进行执行。和让M把组装的数据调别的语言处理成图。

整个交互图如下:
M和打印及绘图的火花_第1张图片

由于是要实现画图和打印。拿C#来说,画点、画线、画圆、画文本、画图片等不同元素参数是不同的。为了输出统一,所以在画图数据约定还是把属性固定列数。只是在不同元素上对每列的表示有差异。

约定有下面列:
PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor,Angle,IsVShow

PrintType:表示元素类型,根据类型决定画什么元素,也是按类型决定列数据含义的。比如画文本有PrintX和PrintY表示坐标。那么画线时候就不够了。所以画线就把PrintWidth和PrintHeight表示线另一个点的坐标。这就是PrintType的用处。
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:字符串类型,元素字体 如:“宋体”
PrintFontSize:整型,元素字体大小 如:“10”
PrintFontStyle:字符串类型,元素字体样式 如:“Bold”
PrintLength:整型,打印长度
PrintWidth:整型,元素宽度
PrintHeight:整型,元素高度
PrintText:字符串类型,打印文本
DataField:字符串类型,数字字段
PrintFlag:字符串类型,打印标识
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:字符串,图片文件
PrintColor:字符串,元素颜色
Angle:整数,元素旋转角度


一.打印机控制元素

1.PrintType为“PRINTER”类型元素
DataField:输出纸张名称  如:“A4”,“A5”
PrintAlignment:输出纸张方向 可为:“Landscape”,“Portrait”
PrintFlag:输出打印机名称  如:“tiaoma”以$*开头就判断打印机名字包含$*后面字符来选择打印机

PrintFont:输出打印机送纸来源  如:“1”,“2”
PrintWidth:输出纸张宽度
PrintHeight:输出纸张高度
输出数据第一个元素为这个类型的将使用以上属性控制选择打印机和选择选择纸张

2.PrintType为“PRINTERONLY”类型元素
PrintFlag:输出打印机名称  如:“tiaoma”以$*开头就判断打印机名字包含$*后面字符来选择打印机

输出数据第一个元素为这个类型的将使用以上属性控制选择打印机忽略其他纸张,宽高,选择控制,只做打印机选择,防止干扰打印

3.PrintType为“PAGE”类型元素
输出类型为PAGE元素时将执行打印换页操作,别的元素不管,只要符合字段数据类型就行


二.绘图控制元素

1.PrintType为“ImageInfo”类型元素
PrintWidth:绘制图片的宽度
PrintHeight:绘制图片高度
PrintColor:绘制图片背景色  传空为白色
绘图输出第一个元素为ImageInfo类型的元素讲按照以上属性创建位图,其他后续元素的画笔操作都在该位图上执行。


三.画笔元素
1.PrintType为“Label”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:字符串类型,元素字体 如:“宋体”
PrintFontSize:整型,元素字体大小 如:“10”
PrintFontStyle:字符串类型,元素字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:没用,输出:0
PrintHeight:没用,输出:0
PrintText:绘制标签的文本
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:没用,输出空串
PrintColor:字符串,元素颜色
Angle:整数,元素旋转角度,默认空
以上元素控制在画板画一个文本元素

2.PrintType为“Data”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:字符串类型,元素字体 如:“宋体”
PrintFontSize:整型,元素字体大小 如:“10”
PrintFontStyle:字符串类型,元素字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:没用,输出:0
PrintHeight:没用,输出:0
PrintText:绘制标签的文本
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:没用,输出空串
PrintColor:字符串,元素颜色
Angle:整数,元素旋转角度,默认空
以上元素控制在画板画一个文本元素

3.PrintType为“CheckBox”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:字符串类型,元素字体 如:“宋体”
PrintFontSize:整型,元素字体大小 如:“10”
PrintFontStyle:字符串类型,元素字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:勾选框宽度 默认20
PrintHeight:勾选框高度 默认20
PrintText:“是”或者“否”
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:没用,输出空串
PrintColor:没用,输出空串
Angle:输出空串
以上元素控制在画板画一个复选框,PrintText控制是否选中

4.PrintType为“Radio”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:字符串类型,元素字体 如:“宋体”
PrintFontSize:整型,元素字体大小 如:“10”
PrintFontStyle:字符串类型,元素字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:勾选框宽度 默认20
PrintHeight:勾选框高度 默认20
PrintText:“是”或者“否”
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:没用,输出空串
PrintColor:没用,输出空串
Angle:输出空串
以上元素控制在画板画一个单选框,PrintText控制是否选中


5.PrintType为“Result”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:字符串类型,元素字体 如:“宋体”
PrintFontSize:整型,元素字体大小 如:“10”
PrintFontStyle:字符串类型,元素字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:没用,输出:0
PrintHeight:没用,输出:0
PrintText:绘制标签的文本
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:没用,输出空串
PrintColor:字符串,元素颜色
Angle:整数,元素旋转角度,默认空
以上元素控制在画板画一个文本元素

6.PrintType为“Microbe”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:字符串类型,元素字体 如:“宋体”
PrintFontSize:整型,元素字体大小 如:“10”
PrintFontStyle:字符串类型,元素字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:没用,输出:0
PrintHeight:没用,输出:0
PrintText:绘制标签的文本
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:没用,输出空串
PrintColor:字符串,元素颜色
Angle:整数,元素旋转角度,默认空
以上元素控制在画板画一个文本元素

7.PrintType为“ILineN”类型元素
PrintX:线第一个点的X坐标
PrintY:线第一个点的Y坐标
PrintFont:没用,输出空串
PrintFontSize:没用,输出:0
PrintFontStyle:没用,输出空串
PrintLength:线的宽度 默认:2
PrintWidth:线第二个点的X坐标
PrintHeight:线第二个点的Y坐标
PrintText:没用,输出空串
DataField:没用,输出空串
PrintFlag:线形 可为:01234
PrintAlignment:没用,输出空串
PrintImageFile:没用,输出空串
PrintColor:字符串,元素颜色
Angle:没用,输出空串
以上元素控制在画板画一条线

8.PrintType为“BarCode”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:条码文本字体 如:“宋体”
PrintFontSize:条码文本字体大小 如:“10”
PrintFontStyle:条码文本字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:条码宽度
PrintHeight:条码高度
PrintText:条码的文本
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:没用,输出空串
PrintColor:没用,输出空串
Angle:整数,元素旋转角度,默认空
以上元素控制在画板画一个带条码字的条码

9.PrintType为“BarCodeN”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:条码文本字体 如:“宋体”
PrintFontSize:条码文本字体大小 如:“10”
PrintFontStyle:条码文本字体样式 如:“Bold”
PrintLength:没用,输出:0
PrintWidth:条码宽度
PrintHeight:条码高度
PrintText:条码的文本
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:字符串类型,文本停靠 如:“Left”
PrintImageFile:为“true”或空串,决定是否绘制条码文本
PrintColor:没用,输出空串
Angle:整数,元素旋转角度,默认空
以上元素控制在画板画一个条码

10.PrintType为“Point”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:没用,输出空串
PrintFontSize:没用,输出:0
PrintFontStyle:没用,输出空串
PrintLength:没用,输出:0
PrintWidth:点的宽度
PrintHeight:点的高度
PrintText:没用,输出空串
DataField:没用,输出空串
PrintFlag:可为“o” “[]” “<>”
PrintAlignment:没用,输出空串
PrintImageFile:为“true”或空串,决定是否绘制条码文本
PrintColor:没用,输出空串
Angle:没用,输出空串
以上元素控制在画板画一个点

11.PrintType为“Poly”类型元素
PrintX:没用,输出:0
PrintY:没用,输出:0
PrintFont:没用,输出空串
PrintFontSize:没用,输出:0
PrintFontStyle:没用,输出空串
PrintLength:没用,输出:0
PrintWidth:没用,输出:0
PrintHeight:没用,输出:0
PrintText:多个点坐标以^分割,单个点的xy以@分割 如:1@12^23@12^34@56
DataField:没用,输出空串
PrintFlag:没用,输出空串
PrintAlignment:没用,输出空串
PrintImageFile:没用,输出空串
PrintColor:填充颜色,默认黑色
Angle:没用,输出空串
以上元素控制在画板画一个多边形

12.PrintType为“Graph”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:没用,输出空串
PrintFontSize:没用,输出:0
PrintFontStyle:没用,输出空串
PrintLength:没用,输出:0
PrintWidth:图片宽度
PrintHeight:图片高度
PrintText:没用,输出空串
DataField:为图标模式就放图标Base64串,否则放ftp全地址
PrintFlag:为“D”打印系统维护的图标,带“http”从这个地址下载文本绘图命令数据绘图。命令为绘图元素数据的数字json串,否则为R对下载ftp图片绘制图进行翻转绘图
PrintAlignment:没用,输出空串
PrintImageFile:没用,输出空串
PrintColor:没用,输出空串
Angle:没用,输出空串
以上元素控制在画板画一个图片

13.PrintType为“FILE”类型元素
PrintX:没用,输出:0
PrintY:没用,输出:0
PrintFont:没用,输出空串
PrintFontSize:没用,输出:0
PrintFontStyle:没用,输出空串
PrintLength:没用,输出:0
PrintWidth:没用,输出:0
PrintHeight:没用,输出:0
PrintText:输出选择的打印机名字,空就使用默认打印机
DataField:输出PDF文件的ftp或http全路径。用英文逗号分隔两个A5PDF路径打印会自动合并为一个A4。一个A5路径后跟个英文逗号,会把PDF转A4纸打印
PrintFlag:没用,输出空串
PrintAlignment:没用,输出空串
PrintImageFile:没用,输出空串
PrintColor:没用,输出空串
Angle:没用,输出空串
以上元素控制打印输出的ftp或http全路径的PDF文件

14.PrintType为“PDF”类型元素
PrintX:整型,元素X坐标
PrintY:整型,元素Y坐标
PrintFont:没用,输出空串
PrintFontSize:没用,输出:0
PrintFontStyle:没用,输出空串
PrintLength:没用,输出:0
PrintWidth:PDF绘制宽度
PrintHeight:PDF绘制高度
PrintText:没用,输出空串
DataField:PDF文件的ftp全路径或者http全路径。上尖号分隔第二位指定打印第几页,从1开始。不指定打印全部页,会造成预览打印当前页乱。建议如果是多页的话M输出指定页。这样就完全等于图片元素。否则和图片元素在多页时候有差异。
PrintFlag:为R对PDF绘制图进行翻转绘图
PrintAlignment:没用,输出空串
PrintImageFile:没用,输出空串
PrintColor:没用,输出空串
Angle:没用,输出空串
以上元素控制在画板画一个PDF文件

有了约定以后,实现约定的语言就各有千秋了,怎么实现可以用各自擅长的语言实现按元素打印和绘制的库。在检验里面就是“DHCLabtrakReportPrint.dll”,驱动他的地方就可以打印、绘图、输出PDF,这是执行层的事了,重点看看M怎么控制打印。

1.第一种模式是EXE告诉执行dll通过M发布的webservice调给定的query得到M输出的约定数据执行画笔打印或生成PDF或者图片。

先来一个小的开胃菜,不用模板写死固定位置的条码打印,这里C盘TRAK的ResultPrint.exe就是通过“DHCLabtrakReportPrint.dll”驱动M得到数据执行打印画笔的。
M和打印及绘图的火花_第2张图片

对应的M就是一段小Query,从库取数据输出绘图约定数据。

Class HIS.DHCReportPrintBarCodeForAll Extends %RegisteredObject
{

Query QueryPrintData(LabNos As %String(MAXLEN=32767), UserCode As %String, Param As %String(MAXLEN=32767), P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Query(ROWSPEC = "PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor,Angle,IsVShow")
{
}

/// LabNo:检验号
/// UserCode:用户代码
/// Param:预留参数串 "0^Merge^DOUBLE^CHECKPAPER^PrinterName^"
///                   Merge:是否合并不同样本的报告
///                   DOUBLE:A4纸张1页打印两份报告 CHECKPAPER:可按报告定义设置打印纸张,缺省必须一次打印一个TSROWID
///                   PrinterName指定打印机^[WebNamespace]PAPERSource:指打印机纸盒来源(数值)
/// PrintType="PAGE" 表示需要换页  tResultLineSpacing:结果换行
/// d ##Class(%ResultSet).RunQuery("HIS.DHCReportPrintBarCodeForAll","QueryPrintData","L0009485","demo",0)
ClassMethod QueryPrintDataExecute(ByRef qHandle As %Binary, LabNos As %String(MAXLEN=32767), UserCode As %String(MAXLEN=32767), Param As %String(MAXLEN=32767), P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Status
{
 	Set repid=$I(^CacheTemp)
	If $g(ind)="" Set ind=1
	s LabNos=$g(LabNos),UserCode=$g(UserCode),Param=$g(Param)
	
 	k ^TMP("HIS.DHCReportPrintBarCode",$i_$j)
	s ^TMP("HIS.DHCReportPrintBarCode","PARAM","QueryPrintDataExecute")=LabNos_","_UserCode_","_Param
	s ^TMP("QueryPrintData")=$lb(LabNos,UserCode,Param,P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions)
	;"1702230024|52","113","BarCode^HNLS--20161002GKU^IP10.1.63.44^MAC3C:97:0E:6F:71:3F","PrintPreview","","","","","","","","","","",$c(0)
	s ReportMerge=$p(Param,"^",2)
	s A4Double=$p(Param,"^",3),CheckPaper=$p(Param,"^",4),PrinterName=$p(Param,"^",5)
	s PaperSource=+$p(Param,"^",6)  ///打印机送纸来源
	//s CheckPaper="CHECKPAPER"  ///选择详细纸张设置打印
	s PrintColor=""	
    f ord=1:1:$L(LabNos,"^") d
    .s labNo=$p(LabNos,"^",ord)
    .s labNo=$p(labNo,"|",1)
    .q:'$l(labNo)
    .///病人信息
    .s ReportInfo=##Class(HIS.DHCReportPrintBarCodeForAll).GetPrintInfo(labNo)
    .i '$l(ReportInfo) q
    .///设置打印机
	.i CheckPaper="CHECKPAPER" d
	..s (PrintFontSize,PrintFontStyle,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile)=""
	..s PrintType="PRINTER",(PrintFont,PrintX,PrintY,PrintLength,PrintWidth,PrintHeight)=0       
	..s PrintWidth="824"
	..s PrintHeight="1024"
	..s PrintAlignment=""  ///纸张方向
	..s PrinterName="tiaoma"
	..i $l(PrinterName) s PrintFlag=PrinterName    ///指定打印机打印
	..s PrintFont=PaperSource  ///打印机送纸来源
	..set Data=$lb(PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor)
    ..d OutputData
 	.//输出数据
 	.s Data=$lb("Label",36,45,"黑体","11","Regular",60,80,20,"","姓名","","Left","","","-90","1") 
 	.s patName=$p(ReportInfo,$c(2),4)
 	.s $li(Data,10)=patName
    .d OutputData
	.s Data=$lb("Label",96,45,"宋体","10","Regular",40,41,20,"性别","","","Left","","","-90","")
 	.s patSex=$p(ReportInfo,$c(2),5)
 	.s $li(Data,10)=patSex
    .d OutputData
	.s Data=$lb("Label",116,45,"宋体","10","Regular",40,41,20,"","年龄","","Left","","","-90","1")
 	.s patAge=$p(ReportInfo,$c(2),6)
 	.s $li(Data,10)=patAge
    .d OutputData
	.s Data=$lb("Label",23,110,"宋体","10","Regular",40,37,20,"","标本","","Left","","","-90","") 
 	.s Specimen=$p(ReportInfo,$c(2),12)
 	.s $li(Data,10)=Specimen
    .d OutputData
	.s Data=$lb("Label",36,30,"宋体","10","Regular",40,37,20,"","医嘱","","Left","","","-90","1")
 	.s OrdName=$p(ReportInfo,$c(2),13)
 	.s hasOutPut=0
 	.f i=1:12:$l(OrdName) d
 	..i i+12<$l(OrdName),hasOutPut<2 d
 	...s $li(Data,10)=$e(OrdName,i,i+12)
 	...s $li(Data,3)=$lg(Data,3)
 	...d OutputData
 	...s hasOutPut=hasOutPut+1
 	..e  i hasOutPut<2  d
 	...s $li(Data,10)=$e(OrdName,i+1,i+12)
 	...s $li(Data,3)=$lg(Data,3)-15
 	...d OutputData
 	...s hasOutPut=hasOutPut+1
	.s Data=$lb("Label",23,80,"宋体","10","Regular",40,37,20,"","登记号","","Left","","","-90","") 
 	.s regNo=$p(ReportInfo,$c(2),2)
 	.s $li(Data,10)=regNo
    .d OutputData
	.s Data=$lb("Data",40,42,"宋体","10","Regular",40,327,62,"0","检验号","BarCode","Left","","","","") 
 	.s $li(Data,10)=labNo
    .d OutputData
	.s Data=$lb("Label",143,110,"宋体","9","Regular",40,33,20,"","科室","","Left","","","-90","") 
 	.s Loc=$p(ReportInfo,$c(2),7)
 	.s $li(Data,10)=Loc
    .d OutputData
    Set qHandle=$lb(0,repid,0)
    Quit $$$OK
OutputData
 	Set ColFields = "PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor"
 	Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)
 	Set ind=ind+1
	Quit
}

ClassMethod QueryPrintDataClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = QueryPrintDataExecute ]
{
	Set repid=$LIST(qHandle,2)
 	Kill ^CacheTemp(repid)
	Quit $$$OK
}

ClassMethod QueryPrintDataFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = QueryPrintDataExecute ]
{
 	Set AtEnd=$LIST(qHandle,1)
 	Set repid=$LIST(qHandle,2)
 	Set ind=$LIST(qHandle,3)
	//
 	Set ind=$o(^CacheTemp(repid,ind))
 	If ind="" {				// if there are no more rows, finish fetching
 		Set AtEnd=1
 		Set Row=""
 	}
 	Else      {				// fetch row
 		Set Row=^CacheTemp(repid,ind)
 	}
 	// Save QHandle
 	s qHandle=$lb(AtEnd,repid,ind)
	Quit $$$OK
}
}

重点就是这几句,简单吧,好调试吧。这里是EXE调用Cache库的Webservice告诉执行哪个Query来实现的。再复杂的打印无非就是取数据逻辑复杂点,再和维护模板数据组装一下复杂点。最终都沦为OutPut数据。文章最后给个稍微复杂一点的打印M示例。
M和打印及绘图的火花_第3张图片

2.第二种模式就是M作为主动一方,调用Web发布的Webservice绘图。这种模式Web把绘图库包装成Webservice供M调用执行绘图。第一个模式的M输出完全在按约定组数据,还比较松散,用M专门绘图还是有必要包装一下绘图类的

绘图测试示例:

Class wbsLisMsgAsyncHandler.LISMsg.DHCLISImageTest Extends %RegisteredObject
{

/// Creator:      zlz
/// CreatDate:    20160729
/// Description:  画表格测试
/// Table:        
/// Input:        
/// Output:       
/// Return:       
/// Others:       w ##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImageTest).DrawGridTest()
ClassMethod DrawGridTest()
{
	s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
	s data=""
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("李四","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("王二","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("张三","男","19岁","094780909478090947809","湖南","111"))
	s ret=imgObj.DrawGrid("",data,$lb(1,2,3,4,5),$lb(20,10,10,10),"",800,10,10,"","","",1,1,25,1,14,"",1100,3)
	set ret=imgObj.Save(876,1140,"","0947809.bmp","ZLZ","")
	q ret
}

/// Creator:      zlz
/// CreatDate:    20160729
/// Description:  画带标题表格测试
/// Table:        
/// Input:        
/// Output:       
/// Return:       
/// Others:       w ##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImageTest).DrawGridWithHeadTest()
ClassMethod DrawGridWithHeadTest()
{
	s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
	s data=""
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("李四","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("王二","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("4","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("5","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("6","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("7","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("8","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("9","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("10","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("11","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("12","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("12","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("14","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("15","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("16","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("17","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("18","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("19","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("20","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("21","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("22","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("23","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("24","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("25","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("26","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("27","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("28","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("29","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("30","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("31","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("32","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("33","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("34","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("35","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("36","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("37","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("38","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("39","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("40","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("41","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("42","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("43","男","19岁","094780909478090947809","湖南","111"))
	s ret=imgObj.DrawGrid("",data,$lb(1,2,3,4,5),"","",800,10,10,"",$lb("姓名","性别","年龄","编号","家庭住址","其他"),"",1,1,25,1,14,"",1100,"","",16)
	set ret=imgObj.Save(876,1140,"","0947809.bmp","ZLZ","")
	q ret
}

/// Creator:      zlz
/// CreatDate:    20160729
/// Description:  画图测试
/// Table:        
/// Input:        
/// Output:       
/// Return:       
/// Others:       w ##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImageTest).DrawImageTestMTHD()
ClassMethod DrawImageTestMTHD(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
{
	s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
	//得到直方图
	s ret=imgObj.GetHistogram("","Histogram.bmp","ZLZ",320,160,"12,13,3,22,60,60,80,12,12,13,14,15,16,17,18,19,20,20,21,22,22.1,22,22.2,22.3,22.4,22.5,22.6,22.7,22.8,22.9,23,23.1,23.2,23.3,23.4,23.5,23.6,23.7,23.8,23.9,24,24.1,24.2,24.3","PLT","直方图","5#5,10#10,15#15,20#20,24#pL","0#0,15#15,30#30,45#45,60#60,75#mol/L")
	//文本
    s ret=imgObj.DrawLabel(10,10,"测试文本")
    s ret=imgObj.DrawLabel(40,40,"画文本")
    //选中的复选框
    s ret=imgObj.DrawCheckBox(60,60,"1")
    //没选中的复选框
    s ret=imgObj.DrawCheckBox(90,60,"0")
    //线
    s ret=imgObj.DrawLine(150,0,150,300,2)
    s ret=imgObj.DrawLine(0,150,300,150,1,1,"red")
    //条码
    s ret=imgObj.DrawBarCode(140,40,"1035891934")
    //点
    s ret=imgObj.DrawPoint(140,90,4,4)
    s ret=imgObj.DrawPoint(180,90,4,4,"[]","red")
    //多边形
    s ret=imgObj.DrawPoly("100@100^290@200^150@150","red")
    //画图
    s ret=imgObj.DrawGraph(200,200,100,100,"ftp://lis:[email protected]/MCImage/19-0.jpg")
    set ret=imgObj.Save(300,300,"","0947809.bmp","ZLZ","")
    set ret=imgObj.Save(300,300,"BASE64","0947809.bmp","ZLZ","")
    
    
    //保存图片路径到仪器
    s ret=imgObj.SaveToMachine(ret,16,"999","P")
    //从FTP地址获取图片。如:西门子2120的图在ftp上获取
    s ret=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).GetFTPImgMTHD("ftp://lis:[email protected]/MCImage/19-0.jpg","","zlz.bmp","zlz")
	//把Base64串处理成图片存到ftp上
	s ret=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).GetImgByBase64MTHD("/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyM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H0PSlWQEMGOVbggnt6VSabKhF7ds09FcqX2/KD1x3pNDLwIJ2oVIJwo9B6e9SxGNJSkqgqeGFUkZh82M+2OtSRvGciVwjbcqDyCfTP+elAGi8JuFllAyqDOBxwTgVlXCfvB8h6elSpcsgZVbgnJFVrmQmQY9KVho+g6KKKokKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigDz/4wf8AIoWf/YVtP/RlegV5/wDGD/kULP8A7Ctp/wCjK9AoAKKKKACiiigAr5zCkfXvxX0ZXznLMUjTCryOaaEx/IAwfrT43VJVYoGwc1Q+1yZPC/lSvduoXCryfT2oQXL8ke/y+5IyvGDRMFEQU7jLzxxjAx/jWaL6VWDDbkEVJJcndny4+v8AdoC48qQaBkHntUYnbyidq5PPeoftT56L+VKw7l/eDEAsYV1zlic7vSpxcyLbiESgRhg5TPBOMcj6ZrJN3J0wuMelMN0/J2pk4yccmnYLmyJPmY+YTlQNh6DGeR+dQ+Z39eazBdOeCF4OelO+1ybRwv5UCNNGJfHrxTJmJYEE9KpRX0sUoZVj4wQCuRxRNfS7xwnT0oC5/9k=")
 	//通过base64串得到文件
 	s ret=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).GetFileByBase64StreamMTHD(charStream,"zlzbase64file.bmp","zlz")
	//通过比特串得到文件
	s charStreamBit=##class(%GlobalCharacterStream).%New()
 	d charStreamBit.Write("")
 	s ret=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).GetFileByBitStreamMTHD(charStreamBit,"zlzbase64file.bmp","zlz")
	q ret
	q ret
}

Query QueryPrintData(LabNos As %String(MAXLEN=32767), UserCode As %String, Param As %String(MAXLEN=32767), P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Query(ROWSPEC = "PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor,Angle,IsVShow")
{
}

/// LabNo:检验号
/// UserCode:用户代码
/// Param:预留参数串 "0^Merge^DOUBLE^CHECKPAPER^PrinterName^"
///                   Merge:是否合并不同样本的报告
///                   DOUBLE:A4纸张1页打印两份报告 CHECKPAPER:可按报告定义设置打印纸张,缺省必须一次打印一个TSROWID
///                   PrinterName指定打印机^PaperSource:指打印机纸盒来源(数值)
/// PrintType="PAGE" 表示需要换页  tResultLineSpacing:结果换行
/// d ##Class(%ResultSet).RunQuery("wbsLisMsgAsyncHandler.LISMsg.DHCLISImageTest","QueryPrintData",1000004097,"","BarCode^HNiMedicalLIS^IP172.17.143.225^MAC")
ClassMethod QueryPrintDataExecute(ByRef qHandle As %Binary, RowIDS As %String(MAXLEN=32767), UserCode As %String(MAXLEN=32767), Param As %String(MAXLEN=32767), P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Status
{
 	Set repid=$I(^CacheTemp)
	If $g(ind)="" Set ind=1
	s RowIDS=$g(RowIDS),UserCode=$g(UserCode),Param=$g(Param)
	
    s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
	s data=""
	s data=data_$lb($lb("张三","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("李四","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("王二","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("4","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("5","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("6","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("7","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("8","男","19岁","0947809","湖南","111"))
	s data=data_$lb($lb("9","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("10","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("11","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("12","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("12","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("14","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("15","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("16","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("17","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("18","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("19","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("20","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("21","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("22","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("23","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("24","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("25","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("26","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("27","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("28","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("29","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("30","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("31","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("32","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("33","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("34","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("35","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("36","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("37","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("38","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("39","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("40","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("41","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("42","男","19岁","094780909478090947809","湖南","111"))
	s data=data_$lb($lb("43","男","19岁","094780909478090947809","湖南","111"))
	s ret=imgObj.DrawGrid("",data,$lb(1,2,3,4,5),"","",800,10,10,"",$lb("姓名","性别","年龄","编号","家庭住址","其他"),"",1,1,25,1,14,"",1100,"","",16,1)
	//绘图对象与打印类的对接点
	s ret=imgObj.Print(repid,ind)
    Set qHandle=$lb(0,repid,0)
    Quit $$$OK
    
OutputData
	///普通打印
	set Data=$lb(PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor,Angle,IsVShow)
 	Set ColFields = "PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor,Angle,IsVShow"
 	Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)
 	Set ind=ind+1
	Quit
}

ClassMethod QueryPrintDataClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = QueryPrintDataExecute ]
{
	Set repid=$LIST(qHandle,2)
 	Kill ^CacheTemp(repid)
	Quit $$$OK
}

ClassMethod QueryPrintDataFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = QueryPrintDataExecute ]
{
 	Set AtEnd=$LIST(qHandle,1)
 	Set repid=$LIST(qHandle,2)
 	Set ind=$LIST(qHandle,3)
	//
 	Set ind=$o(^CacheTemp(repid,ind))
 	If ind="" {				// if there are no more rows, finish fetching
 		Set AtEnd=1
 		Set Row=""
 	}
 	Else      {				// fetch row
 		Set Row=^CacheTemp(repid,ind)
 	}
 	// Save QHandle
 	s qHandle=$lb(AtEnd,repid,ind)
	Quit $$$OK
}

}


M绘图类,其实里面还是按约定u组装数据,最后通过Save方法把组装的数据通过Webservice抛给Web执行画图,并返回Base64串或者图在文件服务器的x相对路径。所以绘图不通的时候关键是检查调用Webservice存在不存在(重点中的重点,是要上传文件服务的确保文件服务地址是好使的),输出数据是否符合约定,能调通Webservice的情况绘图失败在Web 的Logs都有失败日志输出
绘图类代码太大,请参照这篇

示例效果
M和打印及绘图的火花_第4张图片

M和打印及绘图的火花_第5张图片

然后BS在线打印预览也有了
M和打印及绘图的火花_第6张图片
多页比对也是轻松加愉快
M和打印及绘图的火花_第7张图片
打印条码时候顺带给个预览展示也是easy
M和打印及绘图的火花_第8张图片
再来点复杂的质控图在线预览也是阔以的
M和打印及绘图的火花_第9张图片

来个结合模板的打印M示例
M和打印及绘图的火花_第10张图片

质控打印M

Class HIS.DHCQCPrintCommon Extends %RegisteredObject
{

/// 质控通用打印M
Query QueryPrintData(QCPara As %String(MAXLEN=32767), UserCode As %String, TemplateCode As %String(MAXLEN=32767), P3, TMPDR As %String(MAXLEN=32767), P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Query(ROWSPEC = "PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor")
{
}

/// 为了保证兼容性和替换性,在没bug的情况下最好不要私下修改这个M,造成版本分化,维护困难
/// 要扩展报告信息请修改HIS.DHCReportPrintMicMidConfig.GetReportExData
/// TSRowIDs:"100160||A028||1^100151||A028||1"
/// UserCode:用户代码
/// Param:预留参数串 "0^Merge^DOUBLE^CHECKPAPER^PrinterName^"
///           Merge:是否合并不同样本的报告
///           DOUBLE:A4纸张1页打印两份报告 CHECKPAPER:可按报告定义设置打印纸张,缺省必须一次打印一个TSROWID
///           PrinterName指定打印机^PaperSource:指打印机纸盒来源(数值)
/// PrintType="PAGE" 表示需要换页  tResultLineSpacing:结果换行
/// 拉取医嘱功能请搜"拉取医嘱"
/// d ##Class(%ResultSet).RunQuery("HIS.DHCQCPrintCommon","QueryPrintData","2022-04-01^2022-04-30^6^24^23^272^1,2^^1^1$R$-$R$15.2$R$2.0$R$13.2$R$15.2$R$1.3$R$8.6$R$13.0$R$2.3$R$17.7$R$200228%ZSPL%1$R$-$R$14.4$R$1.9$R$13.2$R$15.2$R$1.3$R$8.6$R$13.0$R$2.3$R$17.7$R$200228%ZSPL%2$R$2+ 4+$R$55.0$R$3.0$R$5.5$R$55.0$R$0.0$R$0.0$R$55.0$R$0.0$R$0.0$R$200228%ZSPL%","113","QCPrintZ^http://localhost:50001/UI/download/printtmp/TMP5.bmp.txt^HNLAPTOP-TFUMHBIF^IP172.16.0.104^MAC","PrintPreviewOld","","","","","","","","","","","")
ClassMethod QueryPrintDataExecute(ByRef qHandle As %Binary, QCPara As %String(MAXLEN=32767), UserCode As %String(MAXLEN=32767), TemplateCode As %String(MAXLEN=32767), P3, TMPDR As %String(MAXLEN=32767), P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %Status
{
  Set repid=$I(^CacheTemp)
  If $g(ind)="" Set ind=1
  //s ^LISZLZQC("zlz")=$lb(QCPara,UserCode,TemplateCode,P3, TMPDR , P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions)
  s QCPara=$g(QCPara),UserCode=$g(UserCode),TemplateCode=$g(TemplateCode),TMPDR=$g(TMPDR)
  s ImagePath=$p(TemplateCode,"^",2)
  //得到FTP地址
  s FtpData=##class(OTH.SYSParameter).GetDataValue("LABReportImageFTP","HOS","1")
  s TemplateCode=$p(TemplateCode,"^",1)
  s UserName=""
  i $l(UserCode) s UserName=$lg($g(^dbo.SYSUserD(UserCode)),3)
  //查询开始日期
  s FStartDate=$p(QCPara,"^",1)
  //查询结束日期
  s FEndDate=$p(QCPara,"^",2)
  //仪器主键
  s FMachDR=$p(QCPara,"^",3)
  //质控物主键
  s FMatDR=$p(QCPara,"^",4)
  //批次主键
  s FMatLotDR=$p(QCPara,"^",5)
  //项目主键
  s FTestCodeDR=$p(QCPara,"^",6)
  //浓度
  s FLeavel=$p(QCPara,"^",7)
  //排除规则
  s FExcludeRule=$p(QCPara,"^",8)
  //点范围
  s FPointRange=$p(QCPara,"^",9)
  //打印头部信息格式。非前台传入也在绘制之前按这个格式组串,以使绘制逻辑通用。多个浓度用 $L$ 分割一个浓度的信息用 $R$ 分割,分别是:浓度名称,浓度,靶值,SD,CV,计算靶值,计算SD,计算CV,累计均值,累计SD,累计CV
  s FMapTitlePrintInfo=$p(QCPara,"^",10)
  //模板代码
  s FTemplateCode=TemplateCode
  //删除临时数据
  k ^TMPLISQC($zn,repid)
  
  s cr=$c(13)
  s CheckPaper=""
  s A4Double=""
  //输出提示信息的方式
  //s ERRSTR="提示信息"
  //d OutErr q $$$OK
  s HospitalDR=$lg($g(^dbo.BTMIMachineParameterD(FMachDR)),4)
  d ..InitQCOrder() 
  //获取模板
  s ReportPrintDR=$o(^dbo.PTReportPrintI("IndexCode",HospitalDR," "_$zcvt(FTemplateCode,"U"),""))
  i '$l(ReportPrintDR) s ERRSTR="没有找到"_FTemplateCode_"模板" d OutErr q $$$OK
  
  ///结果列表
  k ^TMPLISQC($zn,repid,"Result")
  s curTSSumResult=..GetQCResult(FStartDate,FEndDate,FMachDR,FMatDR,FMatLotDR,FTestCodeDR,FLeavel,FExcludeRule,FPointRange,FTemplateCode,repid) ///结果总数
  ///质控打印的额外信息
  s ExtraInfo=..GetQCPrintExtra(FStartDate,FEndDate,FMachDR,FMatDR,FMatLotDR,FTestCodeDR,FLeavel,FExcludeRule,FPointRange,FTemplateCode,repid,UserName)
  i '$l(ExtraInfo) q
  i $d(^TMPLISQC($zn,repid,"Result")) d
  .s gReportData=$g(^dbo.PTReportPrintD(ReportPrintDR))
  .s ReportPrintPaperDR=$lg(gReportData,4)
  .s resultLineSpacing=+$lg(gReportData,5)   ///结果行间距
  .s resultRows=$lg(gReportData,6)       ///结果行数
  .s resultCols=$lg(gReportData,7)       ///结果列数 1,2
  .s HospitalDR=$lg(gReportData,8)
  .s ReportLayout=$lg(gReportData,9)
  .s micResultLineSpacing=+$lg(gReportData,14)
  .s micResultRows=$lg(gReportData,15)
  .s micResultCols=$lg(gReportData,16)
  .s archivesMargin=+$lg(gReportData,17)  ///报告存档 右移
  .s fixedReport=$lg(gReportData,18)    ///是否固定报告尾部 
  .s doubleColFillType=$lg(gReportData,19)  ///双列结果打印填充类型 
  .s FixedSpacing=0
  .//输出报告格式用于打印机自动设置纸张类型,纸张方向,送纸来源,当前打印机
  .i CheckPaper="CHECKPAPER",$l(ReportPrintPaperDR) d
  ..s (PrintFontSize,PrintFontStyle,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile)=""
  ..s PrintType="PRINTER",(PrintFont,PrintX,PrintY,PrintLength,PrintWidth,PrintHeight)=0
  ..s DataField=$lg(^dbo.PTReportPrintPaperD(ReportPrintPaperDR),3)   ///纸张名称    
  ..s PrintWidth=$lg(^dbo.PTReportPrintPaperD(ReportPrintPaperDR),4)
  ..s PrintHeight=$lg(^dbo.PTReportPrintPaperD(ReportPrintPaperDR),5)
  ..s PrintAlignment=ReportLayout  ///纸张方向
  ..b //s PrinterName="HP LaserJet 5000 Series PCL6"
  ..i $l(PrinterName) s PrintFlag=PrinterName  ///指定打印机打印
  ..s PrintFont=PaperSource  ///打印机送纸来源
  ..d OutputData
  .//记录线的X
  .s LineX=0
  .//记录线的宽度
  .s LineWidth=0
  .//画数据行最后的Y
  .s LastRowY=0
  .//画横线向下偏移量
  .s LinePianYi=resultLineSpacing
  .//浮动开始的Y
  .s AutoStartY=""
  .//换页高度
  .s ChangePageHeight=1000
  .//画多张图增加的高度
  .s ImageAddHeight=0
  .//图片元素高度
  .s ImageGrapthHeight=0
  .//前一个元素的Y,表格之间位置变化使用
  .s PreElementY=""
  .//图形
  .d GetGraphData("END")
  .//标签
  .d GetLabelData
  .//数据
  .d GetDataData
  .//输出头数据
  .d GetTitleData
  .//线
  .d GetLineData
  .//结果
  .d GetResultData
  .//画表格
  .d GetGridData("质控设置信息")
  .//画表格
  .d GetGridData("质控数据表格")
  .//画表格
  .d GetGridData("失控处理表格")
  .//画表格
  .d GetGridData("质控评价表格")
  .//画自动竖线
  .d GetAutoLineData
  .//画浮动数据
  .d GetAutoDataData
  
  
  //删除临时数据
  k ^TMPLISQC($zn,repid)
  Set qHandle=$lb(0,repid,0)
  Quit $$$OK
  
OutputData
  s PrintX=archivesMargin+PrintX ///报告存档 右移
  ///连续打印
  i A4Double="ContinuousPrint" d
  .i PrintType'="PAGE" d
  ..s Data=$lb(PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor)
  ..s ^TMPLISQC(repid,"HIS.DHCReportPrintMicMid",$i_$j,"CTPrint",ord,PrintY,PrintX)=Data
  i A4Double="ContinuousPrint" Quit
  
  ///A4双页打印
  i A4Double="A4Double",PrintType="PAGE" d 
  .i DoublePage=0 d
  ..s DoublePage=1
  .e  d 
  ..s DoublePage=0
  ..s DoublePrintY=0
  i A4Double="A4Double",PrintType="PAGE",DoublePage=1 Quit
  i A4Double="A4Double",DoublePage=0,PrintY>DoublePrintY s DoublePrintY=PrintY
  i A4Double="A4Double",DoublePage=1 s PrintY=DoublePrintY+PrintY+10
  s PrintFlagOld=PrintFlag
  i (PrintFlag="LastPageD")||(PrintFlag="LastPageD") s PrintFlag="D"
  ///普通打印
  set Data=$lb(PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor)
  s indAdd=0
  
  //画最后一页的元素单独处理
  i (PrintFlagOld="LastPage")||(PrintFlagOld="LastPageD") s indAdd=100000
  Set ^CacheTemp(repid,ind+indAdd)=Data 
  Set ind=ind+1
  Quit
  
OutErr
	s ERRSTR=$g(ERRSTR)
	s (PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor)=""
	s PrintType="ERR"
	s PrintText=ERRSTR
	///普通打印
  	set Data=$lb(PrintType,PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile,PrintColor)
  	Set ^CacheTemp(repid,ind)=Data 
  	Set ind=ind+1
  	Set qHandle=$lb(0,repid,0)
  	Quit
  	
  	
GetResultData ///结果数据 
  //之前模式没测试日期1元素就不执行
  i '$d(^dbo.PTReportPrintItemI("IndexDataField",ReportPrintDR," RESULT"," 测试日期1")) q
  s SumRows=0,tResultLineSpacing=0,tColsFlag=0,tCol=""
  //行是否超出纸张
  s rowOutPage=0
  //绘制剩余数据量
  s LaveNum=curTSSumResult
  s CurCheckRowNum=LaveNum
  i resultCols=2,(CurCheckRowNum>(resultRows*2)) d
  .s CurCheckRowNum=resultRows*2
  .s LaveNum=LaveNum-(resultRows*2)
  s TestDate="" f  s TestDate=$o(^TMPLISQC($zn,repid,"Result",TestDate)) q:TestDate=""  d
  .s TestTime="" f  s TestTime=$o(^TMPLISQC($zn,repid,"Result",TestDate,TestTime)) q:TestTime=""  d
  ..s RowID="" f  s RowID=$o(^TMPLISQC($zn,repid,"Result",TestDate,TestTime,RowID)) q:RowID=""  d
  ...s tcDataList=$g(^TMPLISQC($zn,repid,"Result",TestDate,TestTime,RowID) )
  ...s SumRows=SumRows+1,iMultiRow=0
  ...//换页处理
  ...s tNewPage=0
  ...i resultCols=1 d
  ....s iPage=(SumRows-1)/resultRows
  ....i iPage>0,$e(iPage)=1 s tNewPage=1,SumRows=1
  ...i resultCols=2 d
  ....s iPage=(SumRows-1)/(resultRows*2)
  ....i iPage>0,$e(iPage)=1 s tNewPage=1,SumRows=1
  ...//行超过页高度
  ...i ((LastRowY+resultLineSpacing)>ChangePageHeight) s rowOutPage=1
  ...//超过高度也换页
  ...i ((LastRowY+resultLineSpacing)>ChangePageHeight),tCol="2" s tNewPage=1,SumRows=1
  ...//换页操作开始
  ...i tNewPage=1 d
  ....//画自动竖线
  ....d GetAutoLineData
  ....s PrintType="PAGE"
  ....s (PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile)=""
  ....d OutputData
  ....s rowOutPage=0
  ....s ImageAddHeight=-ImageGrapthHeight+resultLineSpacing
  ....//图形
  ....//d GetGraphData("END")
  ....//标签
  ....d GetLabelData
  ....//输出头数据
  ....d GetTitleData
  ....//数据
  ....d GetDataData
  ....//线
  ....d GetLineData
  ....s tResultLineSpacing=resultLineSpacing-resultLineSpacing,tColsFlag=0  ///重新设置结果开始行
  ....s LastRowY=0
  ...//换页操作结束
  ...i (SumRows>1),(tNewPage=0) s tResultLineSpacing=tResultLineSpacing+resultLineSpacing
  ...s tCol="1"
  ...i (doubleColFillType="Left") d
  ....//双列左填充打印
  ....i ((SumRows>resultRows)||(rowOutPage=1)),(resultCols=2) s tCol="2",tColsFlag=tColsFlag+1  
  ...e  d
  ....//双列平均打印
  ....i ((SumRows>((CurCheckRowNum\2)+(CurCheckRowNum#2)))||(rowOutPage=1)),(resultCols=2) s tCol="2",tColsFlag=tColsFlag+1
  ...//双列打印从头计算
  ...i tColsFlag=1 s tResultLineSpacing=0,LastRowY=0 
  ...s ItemField="" f  s ItemField=$o(^DHCQCrintOrder("R"_tCol,ItemField)) q:ItemField=""  d
  ....s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexDataField",ReportPrintDR," RESULT",$c(32)_ItemField,""))
  ....i $l(ReportPrintItemDR) d
  .....s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  .....s PrintType=$lg(ItemData,4)
  .....s PrintX=$lg(ItemData,5)
  .....//结果间距
  .....s PrintY=$lg(ItemData,6)+tResultLineSpacing+ImageAddHeight 
  .....i '$l(AutoStartY) s AutoStartY=$lg(ItemData,6)
  .....s PrintFont=$lg(ItemData,7)
  .....s PrintFontSize=$lg(ItemData,8)
  .....s PrintFontStyle=$lg(ItemData,9)
  .....s PrintLength=+$lg(ItemData,10)
  .....s PrintWidth=$lg(ItemData,11)
  .....s PrintHeight=$lg(ItemData,12)
  .....s PrintText=$lg(ItemData,13)
  .....s DataField=$lg(ItemData,14)
  .....s PrintFlag=$lg(ItemData,15)
  .....s PrintAlignment=$lg(ItemData,16)
  .....s PrintImageFile=""
  .....s PrintText=$lg(tcDataList,^DHCQCrintOrder("R"_tCol,ItemField))
  .....//包含$c(13)换行处理
  .....i $l(PrintText,cr)>1 d  
  ......s tPrintText=PrintText,tPrintY=PrintY,tPrintX=PrintX
  ......f il=1:1:$l(tPrintText,cr) d
  .......i '$l(PrintText) q
  .......s iMultiRow=iMultiRow+1
  .......s PrintText=$p(tPrintText,cr,il)
  .......s PrintY=tPrintY+(resultLineSpacing*(iMultiRow-1))
  .......i LastRowY<PrintY s LastRowY=PrintY
  .......d OutputData
  .......s PrintX=tPrintX
  .....e  d
  ......///字符超长度换行处理
  ......i (PrintLength>0),+..CheckSum(PrintText,repid)>PrintLength d
  .......s tPrintY=PrintY,tPrintX=PrintX
  .......s tPrintText=..CheckText(PrintText,PrintLength,repid)
  .......f il=1:1:$l(tPrintText,cr) d
  ........s PrintText=$p(tPrintText,cr,il)
  ........i '$l(PrintText) q
  ........s iMultiRow=iMultiRow+1
  ........s PrintY=tPrintY+(resultLineSpacing*(iMultiRow-1))
  ........i LastRowY<PrintY s LastRowY=PrintY
  ........d OutputData
  ........s PrintX=tPrintX
  ......e  d 
  .......i LastRowY<PrintY s LastRowY=PrintY
  .......d OutputData
  ...//画数据表格的横线
  ...s PrintY=LastRowY+LinePianYi
  ...s PrintType="ILine"
  ...s PrintX=LineX
  ...s PrintWidth=LineWidth
  ...s PrintHeight=1
  ...//实线
  ...s PrintFlag="0"
  ...i LastRowY<PrintY s LastRowY=PrintY
  ...d OutputData
  q
  
GetGridData(GridField)  ///表格数据
  s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexDataField",ReportPrintDR," RESULT"," "_$zcvt(GridField,"U"),""))
  i '$l(ReportPrintItemDR) q
  s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  s PrintType=$lg(ItemData,4)
  s PrintX=$lg(ItemData,5)
  s PrintY=$lg(ItemData,6)
  i $l(PreElementY) d
  .s PrintY=PrintY-PreElementY+LastRowY-resultLineSpacing
  //前一个元素的Y
  s PreElementY=$lg(ItemData,6)
  s PrintFont=$lg(ItemData,7)
  s PrintFontSize=$lg(ItemData,8)
  s PrintFontStyle=$lg(ItemData,9)
  s PrintLength=$lg(ItemData,10)
  s PrintWidth=$lg(ItemData,11)
  s PrintHeight=$lg(ItemData,12)
  s PrintText=$lg(ItemData,13)
  s DataField=$lg(ItemData,14)
  s PrintFlag=$lg(ItemData,15)
  s IsVShow=$lg(ItemData,20)
  //表格元素单独画
  i (PrintFlag'="Grid"),(PrintFlag'="GAuto") q
  //i PrintFlag="GAuto" s PrintY=PrintY+ImageAddHeight
  s PrintAlignment=$lg(ItemData,16)
  s PrintImageFile=""
  ///活动报告尾部处理
  s PrintFixedItem=$lg(ItemData,18)
  i fixedReport="0",PrintFixedItem="0" s PrintY=PrintY-FixedSpacing
  //画设置表格
  i DataField="质控设置信息",$l(FMapTitlePrintInfo) d
  .s gridDatas=$lb($lb("浓度","靶值","SD","CV%","计算均值","计算SD","计算CV%","累计均值","累计SD","累计CV%","批号"))
  .f gti=1:1:$l(FMapTitlePrintInfo,"%ZSPL%") d
  ..s OneLevelStr=$p(FMapTitlePrintInfo,"%ZSPL%",gti)
  ..i $l(OneLevelStr) d
  ...s OneRowTitle=""
  ...f gtj=2:1:$l(OneLevelStr,"$R$") d
  ....s OneRowTitle=OneRowTitle_$lb($p(OneLevelStr,"$R$",gtj))
  ...s gridDatas=gridDatas_$lb(OneRowTitle)
  .s AutoStartY=PrintY
  .s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
  .s LastRowY=imgObj.DrawGrid("靶值信息-多段按日期先后从上往下",gridDatas,$lb(1,2,3,4,5,6,7,8,9,10,11),$lb(10),"",PrintWidth,archivesMargin+PrintX,PrintY,"","",20,1,1,PrintHeight,1,PrintFontSize,"",1100,1)
  .s ImageAddHeight=LastRowY-PrintY-resultLineSpacing
  .set ret=imgObj.Print(repid,.ind)
  s HasDrawQCGrid=0
  //画质控数据表格
  i DataField="质控数据表格",(IsVShow'="1"),$d(^TMPLISQC($zn,repid,"VResult")) d
  .s gridDatas=""
  .s HasDrawQCGrid=1
  .s gIndex="" f  s gIndex=$o(^TMPLISQC($zn,repid,"VResult",gIndex)) q:gIndex=""  d
  ..s gridDatas=gridDatas_$lb(^TMPLISQC($zn,repid,"VResult",gIndex))
  .s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
  .s LastRowY=imgObj.DrawGrid("质控数据",gridDatas,"",$lb(10),$lb(PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment,PrintAlignment),PrintWidth,archivesMargin+PrintX,PrintY,PrintLength,^TMPLISQC($zn,repid,"VTitle"),20,1,1,PrintHeight,1,PrintFontSize,"",1100,1)
  .s ImageAddHeight=LastRowY-AutoStartY-(resultLineSpacing*2)
  .set ret=imgObj.Print(repid,.ind)
  i DataField="质控数据表格",(IsVShow="1"),$d(^TMPLISQC($zn,repid,"Result")) d
  .s HasDrawQCGrid=1
  .s headData=$g(^TMPLISQC($zn,repid,"ResultHead"))
  .s QCIsPrintUser=##class(OTH.SYSParameter).GetDataValue("QCIsPrintUser","SYS","DHCC")
  .s QCIsPrintTime=##class(OTH.SYSParameter).GetDataValue("QCIsPrintTime","SYS","DHCC")
  .s col=$lb(1,2)
  .i QCIsPrintTime="1" s col=col_$lb(3)
  .s levNum=$ll(headData)-4
  .f li=1:1:levNum d
  ..s col=col_$lb((li+3))
  .i QCIsPrintUser="1" s col=col_$lb(10)
  .i $ll(headData)<9 d
  ..s LessNum=9-$ll(headData)
  ..f LessAdd=1:1:LessNum d
  ...s headData=headData_$lb("")
  .s headData=headData_$lb("操作者")
  .s gridDatas=$lb(headData)
  .s firstDate="" f  s firstDate=$o(^TMPLISQC($zn,repid,"Result",firstDate)) q:firstDate=""  d
  ..s firstTime="" f  s firstTime=$o(^TMPLISQC($zn,repid,"Result",firstDate,firstTime)) q:firstTime=""  d
  ...s gIndex="" f  s gIndex=$o(^TMPLISQC($zn,repid,"Result",firstDate,firstTime,gIndex)) q:gIndex=""  d
  ....s gridDatas=gridDatas_$lb(^TMPLISQC($zn,repid,"Result",firstDate,firstTime,gIndex))
  .s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
  .s LastRowY=imgObj.DrawGrid("质控数据",gridDatas,col,$lb(5),"",PrintWidth,archivesMargin+PrintX,PrintY,"","",20,1,1,PrintHeight,1,PrintFontSize,"",1100,1)
  .s ImageAddHeight=LastRowY-AutoStartY-(resultLineSpacing*2)
  .set ret=imgObj.Print(repid,.ind)
  //绘制表格了就删除数据了
  i HasDrawQCGrid=1 d
  .k ^TMPLISQC($zn,repid,"VResult")
  .k ^TMPLISQC($zn,repid,"VTitle")
  .k ^TMPLISQC($zn,repid,"Result")
  .k ^TMPLISQC($zn,repid,"ResultHead")
  //画质控失控处理表格
  i DataField="失控处理表格",$d(^TMPLISQC($zn,repid,"LossControlTreat")) d
  .s gridDatas=^TMPLISQC($zn,repid,"LossControlTreat")
  .k ^TMPLISQC($zn,repid,"LossControlTreat")
  .s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
  .s LastRowY=imgObj.DrawGrid("失控处理",gridDatas,$lb(1,2,3,4,5,6),$lb(10,10,30,20,20,10),"",PrintWidth,archivesMargin+PrintX,PrintY,"","",20,1,1,PrintHeight,1,PrintFontSize,"",1100,1)
  .s ImageAddHeight=LastRowY-AutoStartY-(resultLineSpacing*3)
  .set ret=imgObj.Print(repid,.ind)
  //画质控评价表格
  i DataField="质控评价表格",$d(^TMPLISQC($zn,repid,"QcEvaluation")) d
  .s gridDatas=^TMPLISQC($zn,repid,"QcEvaluation")
  .k ^TMPLISQC($zn,repid,"QcEvaluation")
  .s imgObj=##Class(wbsLisMsgAsyncHandler.LISMsg.DHCLISImage).%New()
  .s LastRowY=imgObj.DrawGrid("质控评价",gridDatas,$lb(1,2),$lb(10,90),"",PrintWidth,archivesMargin+PrintX,PrintY,"","",20,1,1,PrintHeight,1,PrintFontSize,"",1100,1)
  .set ret=imgObj.Print(repid,.ind)
  q
  
GetLabelData  ///标签数据
  s ItemCodeLabel="" f  s ItemCodeLabel=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," LABEL",ItemCodeLabel)) q:ItemCodeLabel=""  d
  .s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," LABEL",ItemCodeLabel,""))
  .s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  .s PrintType=$lg(ItemData,4)
  .s PrintX=$lg(ItemData,5)
  .s PrintY=$lg(ItemData,6)
  .s PrintFont=$lg(ItemData,7)
  .s PrintFontSize=$lg(ItemData,8)
  .s PrintFontStyle=$lg(ItemData,9)
  .s PrintLength=$lg(ItemData,10)
  .s PrintWidth=$lg(ItemData,11)
  .s PrintHeight=$lg(ItemData,12)
  .s PrintText=$lg(ItemData,13)
  .s DataField=$lg(ItemData,14)
  .s PrintFlag=$lg(ItemData,15)
  .i PrintFlag="GAuto" s PrintY=PrintY+ImageAddHeight
  .s PrintAlignment=$lg(ItemData,16)
  .s PrintImageFile=""
  .///活动报告尾部处理
  .s PrintFixedItem=$lg(ItemData,18)
  .i fixedReport="0",PrintFixedItem="0" s PrintY=PrintY-FixedSpacing 
  .d OutputData
  q
  
GetTitleData ///数据
  i '$l(FMapTitlePrintInfo) q
  s ItemCodeTitleData="" f  s ItemCodeTitleData=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," TESTCODEDATA",ItemCodeTitleData)) q:ItemCodeTitleData=""  d
  .s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," TESTCODEDATA",ItemCodeTitleData,""))
  .s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  .s DataField=$lg(ItemData,14)
  .s PrintText=""
  .i $d(^DHCQCrintOrder("TD",DataField)) d
  ..s OneLevelStr=""
  ..i DataField["L1" d
  ...s OneLevelStr=$p(FMapTitlePrintInfo,"$L$",1)
  ..i DataField["L2" d
  ...s OneLevelStr=$p(FMapTitlePrintInfo,"$L$",2)
  ..i DataField["L3" d
  ...s OneLevelStr=$p(FMapTitlePrintInfo,"$L$",3)
  ..s PrintText=$p(OneLevelStr,"$R$",+$g(^DHCQCrintOrder("TD",DataField)))
  .i '$l(PrintText) q
  .s PrintType="Data"
  .s PrintX=$lg(ItemData,5)
  .s PrintY=$lg(ItemData,6)
  .s PrintFont=$lg(ItemData,7)
  .s PrintFontSize=$lg(ItemData,8)
  .s PrintFontStyle=$lg(ItemData,9)
  .s PrintLength=+$lg(ItemData,10)
  .s PrintWidth=$lg(ItemData,11)
  .s PrintHeight=$lg(ItemData,12)
  .s PrintFlag=$lg(ItemData,15)
  .s PrintAlignment=$lg(ItemData,16)
  .s PrintImageFile=""
  .//活动报告尾部处理
  .s PrintFixedItem=$lg(ItemData,18)
  .i fixedReport="0",PrintFixedItem="0" s PrintY=PrintY-FixedSpacing
  .///数据换页处理
  .i (PrintLength>0) d
  ..s TxtLen=+..CheckSum(PrintText,repid)
  ..i TxtLen>PrintLength d
  ...s tPrintY=PrintY,tPrintX=PrintX
  ...s tPrintText=..CheckText(PrintText,PrintLength,repid)
  ...f il=1:1:$l(tPrintText,$c(13)) d
  ....s PrintText=$p(tPrintText,$c(13),il)
  ....i '$l(PrintText) q
  ....d OutputData
  ....s PrintY=tPrintY + (il*resultLineSpacing)
  ....s PrintX=tPrintX
  ..e  d OutputData
  .e  d 
  ..d OutputData
  q
  
GetDataData ///数据
  s ItemCodeDataData="" f  s ItemCodeDataData=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," DATA",ItemCodeDataData)) q:ItemCodeDataData=""  d
  .s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," DATA",ItemCodeDataData,""))
  .s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  .s PrintType=$lg(ItemData,4)
  .s PrintX=$lg(ItemData,5)
  .s PrintY=$lg(ItemData,6)
  .s PrintFont=$lg(ItemData,7)
  .s PrintFontSize=$lg(ItemData,8)
  .s PrintFontStyle=$lg(ItemData,9)
  .s PrintLength=+$lg(ItemData,10)
  .s PrintWidth=$lg(ItemData,11)
  .s PrintHeight=$lg(ItemData,12)
  .s PrintText=""
  .s DataField=$lg(ItemData,14)
  .s PrintFlag=$lg(ItemData,15)
  .//不画自动定位元素
  .i PrintFlag="Auto" s ^TMPLISQC($zn,repid,"AutoData",PrintY,ItemCodeDataData)=""
  .i PrintFlag="Auto" q
  .s PrintAlignment=$lg(ItemData,16)
  .s PrintImageFile=""
  .//活动报告尾部处理
  .s PrintFixedItem=$lg(ItemData,18)
  .i fixedReport="0",PrintFixedItem="0" s PrintY=PrintY-FixedSpacing
  .i $l(DataField),$d(^DHCQCrintOrder("D",DataField)) d
  ..s PrintText=$p(ExtraInfo,$c(2),+$g(^DHCQCrintOrder("D",DataField)))
  .///用户图形签名处理
  .i PrintFlag="D"||(PrintFlag="LastPageD") d
  ..s GraphCode=$zcvt(PrintText,"U")
  ..i '$d(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_GraphCode," USR"))  d
  ...s UserDR=$o(^dbo.SYSUserI("IndexCode",##Class(LIS.Util.Common).IndexData(GraphCode),"")) 
  ...i $l(UserDR) s PrintText=$lg($g(^dbo.SYSUserD(UserDR)),3) //无签名打印用户姓名
  ..i $d(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_GraphCode," USR")) d
  ...s RowID=$o(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_GraphCode," USR",""))
  ...s GraphBase64String=$lg(^dbo.PTReportPrintGraphD(RowID),6)
  ...i $l(GraphBase64String) s DataField=GraphBase64String,PrintType="Graph"
  .///数据换页处理
  .i (PrintLength>0) d
  ..s TxtLen=+..CheckSum(PrintText,repid)
  ..i TxtLen>PrintLength d
  ...s tPrintY=PrintY,tPrintX=PrintX
  ...s tPrintText=..CheckText(PrintText,PrintLength,repid)
  ...f il=1:1:$l(tPrintText,$c(13)) d
  ....s PrintText=$p(tPrintText,$c(13),il)
  ....i '$l(PrintText) q
  ....d OutputData
  ....s PrintY=tPrintY + (il*resultLineSpacing)
  ....s PrintX=tPrintX
  ..e  d OutputData
  .e  d 
  ..d OutputData
  q
  
GetAutoDataData ///数据
  s AutoHasChangePage=0
  s AutoDY=""  f  s AutoDY=$o(^TMPLISQC($zn,repid,"AutoData",AutoDY)) q:AutoDY=""  d
  .s ItemCodeAutoDataData="" f  s ItemCodeAutoDataData=$o(^TMPLISQC($zn,repid,"AutoData",AutoDY,ItemCodeAutoDataData)) q:ItemCodeAutoDataData=""  d
  ..s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," DATA",ItemCodeAutoDataData,""))
  ..s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  ..s PrintType=$lg(ItemData,4)
  ..s PrintX=$lg(ItemData,5)
  ..s PrintY=($lg(ItemData,6)-AutoStartY)+LastRowY
  ..//判断换页
  ..i PrintY>ChangePageHeight d
  ...i AutoHasChangePage=0  d
  ....s OldPrintType=PrintType
  ....s PrintType="PAGE"
  ....d OutputData
  ....s PrintType=OldPrintType
  ...s AutoHasChangePage=1
  ...s PrintY=PrintY-ChangePageHeight+20
  ..s PrintX=$lg(ItemData,5)
  ..s PrintFont=$lg(ItemData,7)
  ..s PrintFontSize=$lg(ItemData,8)
  ..s PrintFontStyle=$lg(ItemData,9)
  ..s PrintLength=+$lg(ItemData,10)
  ..s PrintWidth=$lg(ItemData,11)
  ..s PrintHeight=$lg(ItemData,12)
  ..s PrintText=""
  ..s DataField=$lg(ItemData,14)
  ..s PrintFlag=$lg(ItemData,15)
  ..//画自动定位元素
  ..i PrintFlag'="Auto" q
  ..s PrintAlignment=$lg(ItemData,16)
  ..s PrintImageFile=""
  ..//活动报告尾部处理
  ..s PrintFixedItem=$lg(ItemData,18)
  ..i fixedReport="0",PrintFixedItem="0" s PrintY=PrintY-FixedSpacing
  ..i $l(DataField),$d(^DHCQCrintOrder("D",DataField)) d
  ...s PrintText=$p(ExtraInfo,$c(2),+$g(^DHCQCrintOrder("D",DataField)))
  ..///用户图形签名处理
  ..i (PrintFlag="D")||(PrintFlag="LastPageD") d
  ...s GraphCode=$zcvt(PrintText,"U")
  ...i '$d(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_GraphCode," USR"))  d
  ....s UserDR=$o(^dbo.SYSUserI("IndexCode",##Class(LIS.Util.Common).IndexData(GraphCode),"")) 
  ....i $l(UserDR) s PrintText=$lg($g(^dbo.SYSUserD(UserDR)),3) //无签名打印用户姓名
  ...i $d(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_GraphCode," USR")) d
  ....s RowID=$o(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_GraphCode," USR",""))
  ....s GraphBase64String=$lg(^dbo.PTReportPrintGraphD(RowID),6)
  ....i $l(GraphBase64String) s DataField=GraphBase64String,PrintType="Graph"
  ..///数据换页处理
  ..i (PrintLength>0) d
  ...s PrintText=$tr(PrintText,";",$c(13))
  ...s TxtLen=+..CheckSum(PrintText,repid)
  ...i (TxtLen>PrintLength)||(PrintText[$c(13)) d
  ....s tPrintY=PrintY,tPrintX=PrintX
  ....s tPrintText=..CheckText(PrintText,PrintLength,repid)
  ....s ilOutIndex=0
  ....f il=1:1:$l(tPrintText,$c(13)) d
  .....s PrintText=$p(tPrintText,$c(13),il)
  .....i '$l(PrintText) q
  .....s ilOutIndex=ilOutIndex+1
  .....//判断换页
  .....i PrintY>ChangePageHeight d
  ......i AutoHasChangePage=0  d
  .......s OldPrintType=PrintType
  .......s PrintType="PAGE"
  .......s LastRowY=LastRowY+20
  .......s PrintX=tPrintX
  .......d OutputData
  .......s PrintType=OldPrintType
  ......s PrintY=PrintY-ChangePageHeight+20
  ......s AutoHasChangePage=1
  .....s PrintX=tPrintX
  .....d OutputData
  .....s PrintY=tPrintY + (ilOutIndex*resultLineSpacing)
  .....i il>1 s LastRowY=LastRowY+resultLineSpacing
  .....s PrintX=tPrintX
  ...e  
  ....d OutputData
  ..e  d 
  ...d OutputData
  s PrintType="Label"
  s (PrintX,PrintY,PrintFont,PrintFontSize,PrintFontStyle,PrintLength,PrintWidth,PrintHeight,PrintText,DataField,PrintFlag,PrintAlignment,PrintImageFile)=""
  s PrintX=10
  s PrintY=1000
  s PrintFontSize=10
  s PrintFontStyle="Regular"
  s PrintLength=10
  s PrintWidth=10
  s PrintHeight=10
  s PrintText=" "
  d OutputData
  q
  

GetLineData  ///线
  s ItemCodeLineData="" f  s ItemCodeLineData=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," ILINE",ItemCodeLineData)) q:ItemCodeLineData=""  d
  .s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," ILINE",ItemCodeLineData,""))
  .s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  .s PrintType=$lg(ItemData,4)
  .s PrintX=$lg(ItemData,5)
  .s PrintY=$lg(ItemData,6)
  .s PrintFont=$lg(ItemData,7)
  .s PrintFontSize=$lg(ItemData,8)
  .s PrintFontStyle=$lg(ItemData,9)
  .s PrintLength=$lg(ItemData,10)
  .s PrintWidth=$lg(ItemData,11)
  .s PrintHeight=$lg(ItemData,12)
  .s PrintText=$lg(ItemData,13)
  .s DataField=$lg(ItemData,14)
  .s PrintFlag=$lg(ItemData,15)
  .s PrintAlignment=$lg(ItemData,16)
  .i PrintFlag="GAuto" s PrintY=PrintY+ImageAddHeight
  .//自动高度线
  .i PrintFlag="Auto" q  
  .s PrintImageFile=""
  .///活动报告尾部处理
  .s PrintFixedItem=$lg(ItemData,18)
  .i fixedReport="0",PrintFixedItem="0" s PrintY=PrintY-FixedSpacing 
  .s LineX=PrintX
  .s LineWidth=PrintWidth
  .d OutputData   
  q
  
GetAutoLineData  ///线
  s ItemCodeAutoLineData="" f  s ItemCodeAutoLineData=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," ILINE",ItemCodeAutoLineData)) q:ItemCodeAutoLineData=""  d
  .s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," ILINE",ItemCodeAutoLineData,""))
  .s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  .s PrintType=$lg(ItemData,4)
  .s PrintX=$lg(ItemData,5)
  .s PrintY=$lg(ItemData,6)+ImageAddHeight
  .s PrintFont=$lg(ItemData,7)
  .s PrintFontSize=$lg(ItemData,8)
  .s PrintFontStyle=$lg(ItemData,9)
  .s PrintLength=$lg(ItemData,10)
  .s PrintWidth=$lg(ItemData,11)
  .s PrintHeight=LastRowY-PrintY
  .s PrintText=$lg(ItemData,13)
  .s DataField=$lg(ItemData,14)
  .s PrintFlag=$lg(ItemData,15)
  .s PrintAlignment=$lg(ItemData,16)
  .//自动高度线
  .i PrintFlag'="Auto" q  
  .s PrintImageFile=""
  .///活动报告尾部处理
  .s PrintFixedItem=$lg(ItemData,18)
  .i fixedReport="0",PrintFixedItem="0" s PrintY=PrintY-FixedSpacing 
  .s LineX=PrintX
  .s LineWidth=PrintWidth
  .d OutputData   
  q

GetGraphData(gFlag)  ///图形
  s ItemCodeGraphData="" f  s ItemCodeGraphData=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," GRAPH",ItemCodeGraphData)) q:ItemCodeGraphData=""  d
  .s ReportPrintItemDR=$o(^dbo.PTReportPrintItemI("IndexPrintType",ReportPrintDR," GRAPH",ItemCodeGraphData,""))
  .s ItemData=$g(^dbo.PTReportPrintItemD(ReportPrintItemDR))
  .s PrintType=$lg(ItemData,4)
  .s PrintX=$lg(ItemData,5)
  .s PrintY=$lg(ItemData,6)
  .s PrintFont=$lg(ItemData,7)
  .s PrintFontSize=$lg(ItemData,8)
  .s PrintFontStyle=$lg(ItemData,9)
  .s PrintLength=$lg(ItemData,10)
  .s PrintWidth=$lg(ItemData,11)
  .s PrintHeight=$lg(ItemData,12)
  .//前一个元素的Y
  .s PreElementY=PrintY+PrintHeight
  .s PrintText=$lg(ItemData,13)
  .s DataField=$lg(ItemData,14)
  .s PrintFlag=$lg(ItemData,15)
  .s PrintAlignment=$lg(ItemData,16)
  .s PrintImageFile=$lg(ItemData,17)
  .s tDataField=DataField
  .s DataField=""
  .s ImageHeight=PrintHeight
  .i $l(tDataField),tDataField="P" d
  ..i $l(ImagePath) d
  ...s OldPrintX=PrintX
  ...s OldPrintY=PrintY
  ...s ImageGrapthHeight=PrintHeight
  ...s PrintY=$lg(ItemData,6)
  ...s AutoHasChangePage=0
  ...f zi=1:1:$l(ImagePath,";") d
  ....s OneImagePath=$p(ImagePath,";",zi)
  ....s ImagePathComand=$p(OneImagePath,",",2)
  ....s ImageFtpPath=$p(OneImagePath,",",1)
  ....i (ImageFtpPath["http:")||(ImageFtpPath["https:") d
  .....s ImagePathComand=ImageFtpPath
  .....s ImageFtpPath="无效"
  ....i $l(ImageFtpPath) s ImageFtpPath=FtpData_ImageFtpPath
  ....s DataField=ImageFtpPath
  ....//有数据且包含了http就认为放了命令路径,会尝试下载命令画图
  ....s PrintFlag=ImagePathComand
  ....s PrintX=OldPrintX
  ....d OutputData
  ....s PrintY=PrintY+ImageHeight
  ....s LastRowY=PrintY+resultLineSpacing
  ....//判断换页
  ....i PrintY>ChangePageHeight d
  .....s ImageHeightOld=ImageHeight
  .....s LastRowY=PrintY-ChangePageHeight+60+ImageAddHeight
  .....i AutoHasChangePage=0  d
  ......s OldPrintType=PrintType
  ......s ImageAddHeight=ImageAddHeight+ImageHeight
  ......//标签
  ......d GetLabelData
  ......//数据
  ......d GetDataData
  ......//输出头数据
  ......d GetTitleData
  ......//线
  ......d GetLineData
  ......s PrintType="PAGE"
  ......s LastRowY=LastRowY+20
  ......d OutputData
  ......s PrintType=OldPrintType
  .....s PrintY=OldPrintY+20
  .....s PrintHeight=ImageHeightOld
  .....s ImageAddHeight=(-ImageHeight)
  .....s AutoHasChangePage=1
  .e  d
  ..///获取医院Logo图形打印 数据暂时放入用户图形签名
  ..i $l(tDataField),(PrintFlag="D") d
  ...i $d(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_tDataField," DEF")) d
  ....s RowID=$o(^dbo.PTReportPrintGraphI("IndexMaster",HospitalDR," "_tDataField," DEF",""))
  ....s GraphBase64String=$lg(^dbo.PTReportPrintGraphD(RowID),6)
  ....i $l(GraphBase64String) s DataField=GraphBase64String
  ..e  i '$l(DataField) s DataField=tDataField
  ..d OutputData   
  q
}

ClassMethod QueryPrintDataClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = QueryPrintDataExecute ]
{
  Set repid=$LIST(qHandle,2)
  Kill ^CacheTemp(repid)
  Quit $$$OK
}

ClassMethod QueryPrintDataFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = QueryPrintDataExecute ]
{
  Set AtEnd=$LIST(qHandle,1)
  Set repid=$LIST(qHandle,2)
  Set ind=$LIST(qHandle,3)
  //
  Set ind=$o(^CacheTemp(repid,ind))
  If ind="" {       // if there are no more rows, finish fetching
    Set AtEnd=1
    Set Row=""
  }
  Else    {       // fetch row
    Set Row=^CacheTemp(repid,ind)
  }
  // Save QHandle
  s qHandle=$lb(AtEnd,repid,ind)
  Quit $$$OK
}

ClassMethod CheckSum(x, repid As %String) As %Integer
{
  s x=$g(x)
  s repid=$g(repid)
  s z=0 
  f y=1:1:$l(x) d
  .s t=$e(x,y)
  .i $a(t)>128 s z=z+2
  .e  s z=z+1 
  q z
}

ClassMethod CheckText(x, iLen, repid As %String) As %String
{
  s repid=$g(repid)
  s tStr="",z=0
  f y=1:1:$l(x) d
  .s t=$e(x,y)
  .i $a(t)>128 s z=z+2
  .e  s z=z+1
  .s tStr=tStr_t
  .i t=$c(13) s z=0
  .i z>iLen s tStr=tStr_$c(13),z=0
  q tStr
}

/// 获取质控打印的额外信息
ClassMethod GetQCPrintExtra(FStartDate, FEndDate, FMachDR, FMatDR, FMatLotDR, FTestCodeDR, FLeavel, FExcludeRule, FPointRange, FTemplateCode, repid, UserName) As %String
{
    s FStartDate=$g(FStartDate)
    s FEndDate=$g(FEndDate)
    s FMachDR=$g(FMachDR)
    s FMatDR=$g(FMatDR)
    s FMatLotDR=$g(FMatLotDR)
    s FTestCodeDR=$g(FTestCodeDR)
    s FLeavel=$g(FLeavel)
    s FExcludeRule=$g(FExcludeRule)
    s FPointRange=$g(FPointRange)
    s FTemplateCode=$g(FTemplateCode)
    s repid=$g(repid)
    s HospitalDR=$lg($g(^dbo.BTMIMachineParameterD(FMachDR)),4)
    s HospitalName=""
    i $l(HospitalDR) s HospitalName=$lg($g(^dbo.BTHospitalD(HospitalDR)),3)
    s Title=HospitalName
    i FTemplateCode="QCPrintZ" s Title=Title_"Z分数图"
    i FTemplateCode="QCPrintYouDen" s Title=Title_"YouDen图"
    i FTemplateCode="QCPrintQualitative" s Title=Title_"定性质控图"
    i FTemplateCode="QCPrintLJ" s Title=Title_"L-J图"
    i FTemplateCode="QCPrintGrubbs" s Title=Title_"Grubbs图"
    i FTemplateCode="QCPrintFreq" s Title=Title_"频谱图"
    i FTemplateCode="QCPrintWestGuard" s Title=Title_"WestGard图"
    i FTemplateCode="QCPrintDeviationRatio" s Title=Title_"偏离比例图"
    s DateInfo=FStartDate_"/"_FEndDate
	s FStartDate=$tr(FStartDate,"-")
	s FEndDate=$tr(FEndDate,"-")
	s MachineName=$lg($g(^dbo.BTMIMachineParameterD(FMachDR)),3)
	s MachineCode=$lg($g(^dbo.BTMIMachineParameterD(FMachDR)),2)
	s MachineLName=$lg($g(^dbo.BTMIMachineParameterD(FMachDR)),5)
	s WorkGroupMachineDR=$lg($g(^dbo.BTMIMachineParameterD(FMachDR)),6)
	s WorkGroupMachineName=$lg($g(^dbo.BTWorkGroupMachineD(WorkGroupMachineDR)),3)
	s WorkGroupDR=$lg($g(^dbo.BTWorkGroupMachineD(WorkGroupMachineDR)),4)
	s WorkGroupName=$lg($g(^dbo.BTWorkGroupD(WorkGroupDR)),3)
	s TitleWithGroup=HospitalName
    i FTemplateCode="QCPrintZ" s TitleWithGroup=TitleWithGroup_"Z分数图"
    i FTemplateCode="QCPrintYouDen" s TitleWithGroup=TitleWithGroup_"YouDen图"
    i FTemplateCode="QCPrintQualitative" s TitleWithGroup=TitleWithGroup_"定性质控图"
    i FTemplateCode="QCPrintLJ" s TitleWithGroup=TitleWithGroup_"质量控制图"
    i FTemplateCode="QCPrintGrubbs" s TitleWithGroup=TitleWithGroup_"Grubbs图"
    i FTemplateCode="QCPrintFreq" s TitleWithGroup=TitleWithGroup_"频谱图"
    i FTemplateCode="QCPrintWestGuard" s TitleWithGroup=TitleWithGroup_"WestGard图"
    i FTemplateCode="QCPrintDeviationRatio" s TitleWithGroup=TitleWithGroup_"偏离比例图"
    //用质控物得到批次主键
    i $l(FMatDR) d
	.s MaterialLotCode="" f  s MaterialLotCode=$o(^dbo.BTQCMaterialLotI("IndexMaster",FMatDR,MaterialLotCode)) q:MaterialLotCode=""  d
	..s FMatLotDR=$o(^dbo.BTQCMaterialLotI("IndexMaster",FMatDR,MaterialLotCode,""))

	//失控处理
	k ^TMPLISQC($zn,repid,"LossControlTreat")
	//质控评价
	k ^TMPLISQC($zn,repid,"QcEvaluation")
	//质控物信息
	s (MatCode,CName,WaveLengthMian,WaveLength)=""
	i $l(FMatDR),$d(^dbo.BTQCMaterialD(FMatDR)) d
	.s StrMaterialD=$g(^dbo.BTQCMaterialD(FMatDR))
	.s MatCode=$lg(StrMaterialD,2)
	.s CName=$lg(StrMaterialD,3)
	.s WaveLengthMian=$lg(StrMaterialD,7)
	//项目名称
	s (TCName,TCUnit,MethodDR,MethodName)=""
	i $d(^dbo.BTTestCodeD(FTestCodeDR)) d
	.s TCName=$lg($g(^dbo.BTTestCodeD(FTestCodeDR)),3)
	.s TCUnit=$lg($g(^dbo.BTTestCodeD(FTestCodeDR)),8)
	.s MethodDR=$lg($g(^dbo.BTTestCodeD(FTestCodeDR)),11)
	.i $l(MethodDR) s MethodName=$lg($g(^dbo.BTTestMethodD(MethodDR)),3)
	//批次浓度信息
	s LotLeavel=""
	//批次信息
	s (LotCode,LotNoOut,RGLotNoOut,StartDate,EndDate,ProductDate,ExpiryDate,Manufacturer,CorrectLuidBatch)=""
	//批次规则
	s (QCRulesCode,QCRulesName)=""
	s AllQCRuleNames=""
	i $l(FMatLotDR),$d(^dbo.BTQCMaterialLotRulesI("IndexMaster",FMatLotDR)) d
	.s QCRulesDR="" f  s QCRulesDR=$o(^dbo.BTQCMaterialLotRulesI("IndexMaster",FMatLotDR,QCRulesDR)) q:QCRulesDR=""  d
	..s MatLotRuleRowID=$o(^dbo.BTQCMaterialLotRulesI("IndexMaster",FMatLotDR,QCRulesDR,""))
	..s StrQCRules=$g(^dbo.BTQCRulesD(QCRulesDR))
	..i $lg(StrQCRules,4)="D" q 
	..s QCRulesCode=QCRulesCode_" "_QCRulesDR
	..s AllQCRuleNames(MatLotRuleRowID)=$lg(StrQCRules,3)
	.s MatLotRuleRowID="" f  s MatLotRuleRowID=$o(AllQCRuleNames(MatLotRuleRowID)) q:MatLotRuleRowID=""  d
	..i $l(QCRulesName) s QCRulesName=QCRulesName_" "_AllQCRuleNames(MatLotRuleRowID)
	..e  s QCRulesName=AllQCRuleNames(MatLotRuleRowID)
	s Leavel=""
	s CNameMatLot=""
	s AmendLiquidLot=""
	s AmendLiquidDate=""
	s AmendLiquid=""
	s RgManufacturer=""
	s LossControlTreat=""
	s QcEvaluation=""
	//定性质控规则
  	s QCRulesNameDingxing=""
  	s TargetCV=""
  	s RgEffectiveDate=""
  	s StartDate=""
  	s EndDate=""
  	s ProductDate=""
	//取此批次浓度信息
	i $l(FMatLotDR),$d(^dbo.BTQCMaterialLotTestCodeI("IndexMaster",FMatLotDR,FTestCodeDR)) d 
	.s CurLevel="" f  s CurLevel=$o(^dbo.BTQCMaterialLotTestCodeI("IndexMaster",FMatLotDR,FTestCodeDR,CurLevel)) q:CurLevel=""  d
	..i (##class(LIS.WS.BLL.DHCQCTestResult).CheckContian(FLeavel,",",CurLevel)=0) q
	..s LevelSeq="" f  s LevelSeq=$o(^dbo.BTQCMaterialLotTestCodeI("IndexMaster",FMatLotDR,FTestCodeDR,CurLevel,LevelSeq)) q:LevelSeq=""  d
	...s RowId="" f  s RowId=$o(^dbo.BTQCMaterialLotTestCodeI("IndexMaster",FMatLotDR,FTestCodeDR,CurLevel,LevelSeq,RowId)) q:RowId=""  d
	....s TcMatLotStartDate=$lg($g(^dbo.BTQCMaterialLotTestCodeD(RowId)),33)
  	....s TcMatLotEndDate=$lg($g(^dbo.BTQCMaterialLotTestCodeD(RowId)),34)
  	....i (FStartDate>TcMatLotEndDate)||(FEndDate<TcMatLotStartDate) q
  	....//取项目设定参数
  	....s StrMatLotTC=##class(LIS.WS.BLL.DHCQCTestResult).GetStrQcPara(RowId,FStartDate,FEndDate)
  	....//定性取定性的规则
  	....i $d(^dbo.BTQCMatLotResRulesI("IndexMaster",RowId)) d
  	.....s QCRulesName=""
  	.....s RRResult="" f  s RRResult=$o(^dbo.BTQCMatLotResRulesI("IndexMaster",RowId,RRResult)) q:RRResult=""  d
  	......s RRQCRulesDR="" f  s RRQCRulesDR=$o(^dbo.BTQCMatLotResRulesI("IndexMaster",RowId,RRResult,RRQCRulesDR)) q:RRQCRulesDR=""  d
  	.......s StrQCRules=$g(^dbo.BTQCRulesD(RRQCRulesDR))
	.......i $lg(StrQCRules,4)="D" q 
	.......i $l(QCRulesNameDingxing) s QCRulesNameDingxing=QCRulesNameDingxing_" "_$lg(StrQCRules,3)
	.......e  s QCRulesNameDingxing=$lg(StrQCRules,3)
	.......s QCRulesCode=QCRulesCode_" "_$lg(StrQCRules,2)
	....i $l(QCRulesNameDingxing) s QCRulesName=QCRulesNameDingxing
  	....//质控批次
  	....s LotNo=$lg(StrMatLotTC,23)
  	....i '$l(RgManufacturer) s RgManufacturer=$lg(StrMatLotTC,24)
  	....else  if RgManufacturer'[$lg(StrMatLotTC,24) s RgManufacturer=RgManufacturer_","_$lg(StrMatLotTC,24)
  	....s StartDate=$lg(StrMatLotTC,33)
  	....s EndDate=$lg(StrMatLotTC,34)
  	....s ProductDate=$lg(StrMatLotTC,35)
  	....//浓度名称:LevelName
	....s CurMatRowId=$o(^dbo.BTQCMaterialLevelI("IndexMaster",FMatDR,CurLevel,""))
	....s CurLevelName=""
	....i $l(CurMatRowId) s CurLevelName=$lg($g(^dbo.BTQCMaterialLevelD(CurMatRowId)),4)
  	....//试剂批次
  	....s RGLot=$lg(StrMatLotTC,41)
  	....i $l(LotNo),('$d(^TMPLISQC($zn,repid,$j,"HasOutLot",LotNo))) d
  	.....s LotNoOut=LotNoOut_LotNo_" "
  	.....s ^TMPLISQC($zn,repid,$j,"HasOutLot",LotNo)=""
  	.....s LotLeavel=LotLeavel_LotNo_"["_CurLevelName_"]"_" "
  	....i $l(RGLot),('$d(^TMPLISQC($zn,repid,$j,"HasOutRGLot",RGLot))) d
  	.....s RGLotNoOut=RGLotNoOut_RGLot_" "
  	.....s ^TMPLISQC($zn,repid,$j,"HasOutRGLot",RGLot)=""
  	....s ExpiryDate=$lg(StrMatLotTC,36)
  	....s RgEffectiveDate=$lg(StrMatLotTC,42)
  	....s LevelUnit=$lg(StrMatLotTC,25)
  	....//有效使用项目批次的浓度单位
  	....i $l(LevelUnit) s TCUnit=LevelUnit
  	....s CurTargetCV=$lg(StrMatLotTC,28)
  	....i $l(CurTargetCV) d
  	.....i $l(TargetCV) s TargetCV=TargetCV_","_CurTargetCV
  	.....e  s TargetCV=CurTargetCV
  	....//质控物名称
  	....s MatLotTCMatName=$lg(StrMatLotTC,26)
  	....i $l(MatLotTCMatName),'$d(^TMPLISQC($zn,repid,$j,"HasOutMatName",MatLotTCMatName)) d
  	.....i $l(CNameMatLot) s CNameMatLot=CNameMatLot_","_MatLotTCMatName
  	.....e  s CNameMatLot=CNameMatLot_MatLotTCMatName
  	.....s ^TMPLISQC($zn,repid,$j,"HasOutMatName",MatLotTCMatName)=""
	....//浓度名称:LevelName
	....s MatRowId=$o(^dbo.BTQCMaterialLevelI("IndexMaster",FMatDR,CurLevel,""))
	....s LevelName=""
	....i $l(MatRowId) s LevelName=$lg($g(^dbo.BTQCMaterialLevelD(MatRowId)),4)
	....//浓度名字映射
	....s ^TMPLISQC($zn,repid,$j,"LevelNoName",CurLevel)=LevelName
	....i $l(LevelName),'$d(^TMPLISQC($zn,repid,$j,"HasOutLeavel",LevelName)) d
	.....s Leavel=Leavel_" "_LevelName
	.....s ^TMPLISQC($zn,repid,$j,"HasOutLeavel",LevelName)=""
	....//批次名称 LotName
	....s LotRowId=$o(^dbo.BTQCMaterialLotLevelI("IndexMaster",FMatLotDR,CurLevel,""))
	....s LotName=""
	....i $l(LotRowId) s LotName=$lg($g(^dbo.BTQCMaterialLotLevelD(LotRowId)),4)
	....s Precision=$lg(StrMatLotTC,11),CV="",FloatCV=""
	....s Mean=$lg(StrMatLotTC,5)
	....s SD=$lg(StrMatLotTC,6)
    ....s Remark=$lg(StrMatLotTC,16)
    ....s TCWaveLengthMian=$lg(StrMatLotTC,39)
    ....i $l(TCWaveLengthMian) s WaveLengthMian=TCWaveLengthMian
    ....s TCWaveLength=$lg(StrMatLotTC,40)
    ....i $l(TCWaveLength) s WaveLength=TCWaveLength
	....s AmendLiquidLot=$lg(StrMatLotTC,38)
	....s AmendLiquidDate=$lg(StrMatLotTC,43)
	....s AmendLiquid=$lg(StrMatLotTC,44)
	....i Mean>0.00000001 s CV=$fn((SD/Mean)*100,"",Precision),Mean=$fn(Mean,"",Precision),SD=$fn(SD,"",Precision)
	....s FloatMean=$lg(StrMatLotTC,7)
	....s FloatSD=$lg(StrMatLotTC,8)
    ....i FloatMean>0.00000001 s FloatCV=$fn((FloatSD/FloatMean)*100,"",Precision),FloatMean=$fn(FloatMean,"",Precision),FloatSD=$fn(FloatSD,"",Precision)
    ....s TestMethod=$lg(StrMatLotTC,9)
    ....//质控维护了试验方法,优先使用
    ....i $l(TestMethod) s MethodName=TestMethod
    ....i $d(^dbo.QCTestResultI("IndexMaster",FMatLotDR,FTestCodeDR,CurLevel)) d 
    .....s TrDate="" f  s TrDate=$o(^dbo.QCTestResultI("IndexMaster",FMatLotDR,FTestCodeDR,CurLevel,TrDate)) q:TrDate=""  d
    ......//时间限定
    ......i (TrDate<FStartDate)||(TrDate>FEndDate) q
    ......s TrTime="" f  s TrTime=$o(^dbo.QCTestResultI("IndexMaster",FMatLotDR,FTestCodeDR,CurLevel,TrDate,TrTime)) q:TrTime=""  d
    .......s TrRowId="" f  s TrRowId=$o(^dbo.QCTestResultI("IndexMaster",FMatLotDR,FTestCodeDR,CurLevel,TrDate,TrTime,TrRowId)) q:TrRowId=""  d
    ........s TransDate="" f  s TransDate=$o(^dbo.QCTestResultTransactionI("IndexMaster",TrRowId,TransDate)) q:TransDate=""  d
    .........s TransTime="" f  s TransTime=$o(^dbo.QCTestResultTransactionI("IndexMaster",TrRowId,TransDate,TransTime)) q:TransTime=""  d
    ..........s TransRowId="" f  s TransRowId=$o(^dbo.QCTestResultTransactionI("IndexMaster",TrRowId,TransDate,TransTime,TransRowId)) q:TransRowId=""  d
    ...........s CurLossResult=$lg(^dbo.QCTestResultD(TrRowId),9)
    ...........s TransactionTypeDR=$lg(^dbo.QCTestResultTransactionD(TransRowId),8)
    ...........s LossAddUserDR=$lg(^dbo.QCTestResultTransactionD(TransRowId),5)
    ...........s LossAddUser=""
    ...........i $l(LossAddUserDR) s LossAddUser=$lg($g(^dbo.SYSUserD(LossAddUserDR)),3)
    ...........s TransactionType=""
    ...........i $l(TransactionTypeDR) s TransactionType=$lg(^dbo.BTQCTransactionTypeD(TransactionTypeDR),3)
    ...........s TransactionMethod=$lg(^dbo.QCTestResultTransactionD(TransRowId),9)
    ...........i $d(^TMPLISQC($zn,repid,$j,"HasOut",TransRowId)) q
    ...........s ^TMPLISQC($zn,repid,$j,"HasOut",TransRowId)=""
    ...........//原因
    ...........s Reson=""
    ...........i $l(TransactionType) s Reson="  原因:"_$lg(^dbo.QCTestResultTransactionD(TransRowId),6)
    ...........//处理方法
    ...........s DealMethod=""
    ...........i $l(TransactionMethod) s DealMethod="  处理方法:"_TransactionMethod
    ...........s LossControlTreat=LossControlTreat_"日期:"_$lg(^dbo.QCTestResultD(TrRowId),5)_" 浓度:"_LevelName_Reson_DealMethod_"  处理:"_$lg(^dbo.QCTestResultTransactionD(TransRowId),10)_"  处理者:"_LossAddUser_" ;"
    ...........i '$d(^TMPLISQC($zn,repid,"LossControlTreat")) s ^TMPLISQC($zn,repid,"LossControlTreat")=$lb($lb("日期","浓度","失控原因","失控处理方法","处理结果","处理人"))
    ...........s ^TMPLISQC($zn,repid,"LossControlTreat")=^TMPLISQC($zn,repid,"LossControlTreat")_$lb($lb($lg(^dbo.QCTestResultD(TrRowId),5),LevelName,$lg(^dbo.QCTestResultTransactionD(TransRowId),6),TransactionMethod,$lg(^dbo.QCTestResultTransactionD(TransRowId),10),LossAddUser))
    ..//有批次项目质控
    ..s MatManufacturer=""
    ..i $l(CNameMatLot) s MatManufacturer=CNameMatLot
    ..k ^TMPLISQC($zn,repid,$j,"HasOutAppraise")
    ..s QcEvaluation=""
    ..i $d(^dbo.QCResultAppraiseI("IndexMaster",FMatLotDR,FTestCodeDR)) d 
    ...s AppraDate="" f  s AppraDate=$o(^dbo.QCResultAppraiseI("IndexMaster",FMatLotDR,FTestCodeDR,AppraDate)) q:AppraDate=""  d
    ....i (AppraDate<FStartDate)||(AppraDate>FEndDate) q
    ....s AppraTime="" f  s AppraTime=$o(^dbo.QCResultAppraiseI("IndexMaster",FMatLotDR,FTestCodeDR,AppraDate,AppraTime)) q:AppraTime=""  d
    .....i $d(^dbo.QCResultAppraiseI("IndexMaster",FMatLotDR,FTestCodeDR,AppraDate,AppraTime,##Class(LIS.Util.Common).IndexData(CurLevel))) d
    ......s AppraRowId="" f  s AppraRowId=$o(^dbo.QCResultAppraiseI("IndexMaster",FMatLotDR,FTestCodeDR,AppraDate,AppraTime,##Class(LIS.Util.Common).IndexData(CurLevel),AppraRowId)) q:AppraRowId=""  d
    .......s CurLevelName=CurLevel
    .......i $d(^TMPLISQC($zn,repid,$j,"LevelNoName",CurLevel)) s CurLevelName=^TMPLISQC($zn,repid,$j,"LevelNoName",CurLevel)
    .......s QcEvaluation=QcEvaluation_" "_CurLevelName_":"_$lg(^dbo.QCResultAppraiseD(AppraRowId),8) 
  	.......i '$d(^TMPLISQC($zn,repid,"QcEvaluation")) s ^TMPLISQC($zn,repid,"QcEvaluation")=$lb($lb("浓度","质控评价内容"))
    .......s ^TMPLISQC($zn,repid,"QcEvaluation")=^TMPLISQC($zn,repid,"QcEvaluation")_$lb($lb(CurLevelName,$lg(^dbo.QCResultAppraiseD(AppraRowId),8) ))
  	i $l(LossControlTreat) s LossControlTreat="失控处理:;"_LossControlTreat
	i $l(QcEvaluation) s QcEvaluation="质控评价:;"_QcEvaluation
	//增加打印时间
  	s PrintDateTime=$zdt($h,3)
  	s EntryUser=""
  	s AuthUser=""
  	s EntryUserCode=""
  	s AuthUserCode=""
  	i $d(^TMPLISQC($zn,repid,"AuthInfo")) d
  	.s EntryUser=$lg($g(^TMPLISQC($zn,repid,"AuthInfo")),1)
  	.s AuthUser=$lg($g(^TMPLISQC($zn,repid,"AuthInfo")),2)
  	.s EntryUserDR=$lg($g(^TMPLISQC($zn,repid,"AuthInfo")),3)
  	.s AuthUserDR=$lg($g(^TMPLISQC($zn,repid,"AuthInfo")),4)
  	.i $l(EntryUserDR) s EntryUserCode=$lg($g(^dbo.SYSUserD(EntryUserDR)),2)
  	.i $l(AuthUserDR) s AuthUserCode=$lg($g(^dbo.SYSUserD(AuthUserDR)),2)
  	//1:查询日期,2:仪器代码,3:仪器名称,4:质控物代码,5:质控物,6:波长,7:项目名称,8:项目单位,9:方法名称,10:浓度,11:使用规则,12:批号,13:校正液批号,14:校正液效期,15:校正液,16:试剂厂商,17:失控处理,18:质控评价,19:主波长,20:次波长
  	s RetStr=Title_$c(2)_DateInfo_$c(2)_MachineCode_$c(2)_MachineName_$c(2)_MatCode_$c(2)_CName_$c(2)_WaveLength_$c(2)_TCName_$c(2)_TCUnit_$c(2)_MethodName_$c(2)_Leavel_$c(2)_QCRulesName_$c(2)_LotNoOut_$c(2)_AmendLiquidLot_$c(2)_AmendLiquidDate_$c(2)_AmendLiquid_$c(2)_RgManufacturer_$c(2)_LossControlTreat_$c(2)_QcEvaluation_$c(2)_WaveLengthMian_$c(2)_WaveLength_$c(2)_RGLotNoOut_$c(2)_LotNoOut_$c(2)_LotLeavel_$c(2)_PrintDateTime_$c(2)_TargetCV_$c(2)_ExpiryDate_$c(2)_UserName_$c(2)_RgEffectiveDate_$c(2)_WorkGroupName_$c(2)_WorkGroupMachineName_$c(2)_StartDate_$c(2)_EndDate_$c(2)_ProductDate_$c(2)_MachineLName_$c(2)_TitleWithGroup_$c(2)_EntryUser_$c(2)_AuthUser_$c(2)_MatManufacturer_$c(2)_EntryUserCode_$c(2)_AuthUserCode
  	q RetStr
}

/// 获取质控结果
ClassMethod GetQCResult(FStartDate, FEndDate, FMachDR, FMatDR, FMatLotDR, FTestCodeDR, FLeavel, FExcludeRule, FPointRange, FTemplateCode, repid) As %Integer
{
	s RetNum=0
    s FStartDate=$g(FStartDate)
    s FEndDate=$g(FEndDate)
    s FMachDR=$g(FMachDR)
    s FMatDR=$g(FMatDR)
    s FMatLotDR=$g(FMatLotDR)
    s FTestCodeDR=$g(FTestCodeDR)
    s FLeavel=$g(FLeavel)
    s FExcludeRule=$g(FExcludeRule)
    s FPointRange=$g(FPointRange)
    s FTemplateCode=$g(FTemplateCode)
    s repid=$g(repid)
    s FStartDate=$zdh(FStartDate,8),FEndDate=$zdh(FEndDate,8)
    //遍历方向,默认一天按时间倒序遍历
 	s ForDrection=1
 	//去除复查点就正序遍历
 	i FPointRange=4 s ForDrection=1
    k ^TMPLISQC($zn,repid,"Result")
    k ^TMPLISQC($zn,repid,"ResultHead")
    k ^TMPLISQC($zn,repid,"VResult")
    k ^TMPLISQC($zn,repid,"AuthInfo")
    k ^TMPLISQC($zn,repid,"VTitle")
    s TMPLISQC("LeavelName")=""
    s QCIsPrintUser=##class(OTH.SYSParameter).GetDataValue("QCIsPrintUser","SYS","DHCC")
    s QCIsPrintTime=##class(OTH.SYSParameter).GetDataValue("QCIsPrintTime","SYS","DHCC")
    i QCIsPrintUser="1" d
    .s TMPLISQC("LeavelName",999)=$lb("操作者")
    s MachineName=$lg($g(^dbo.BTMIMachineParameterD(FMachDR)),3)
    //记录最大累计列表长度
    s LastMaxListLen=0
 	f CurdateNum=FStartDate:1:FEndDate d
 	.s Curdate=$zd(CurdateNum,8)
 	.//浓度1结果
 	.s L1Result=""
 	.//浓度2结果
 	.s L2Result=""
 	.//浓度3结果
 	.s L3Result=""
 	.//浓度4结果
 	.s L4Result=""
 	.//浓度5结果
 	.s L5Result=""
 	.//浓度6结果
 	.s L6Result=""
 	.//最早时间
 	.s FirstTime=""
 	.k ^TMPLISQC($zn,repid,"OneDayData")
 	.k ^TMPLISQC($zn,repid,"OneDayDataOper")
 	.i $d(^dbo.QCTestResultI("IndexTestTime",Curdate)) d
 	..s CurTime="" f  s CurTime=$o(^dbo.QCTestResultI("IndexTestTime",Curdate,CurTime),ForDrection) q:CurTime=""  d
 	...i '$l(FirstTime) s FirstTime=CurTime
 	...s CurMachCode="" f  s CurMachCode=$o(^dbo.QCTestResultI("IndexTestTime",Curdate,CurTime,CurMachCode)) q:CurMachCode=""  d
 	....i $l(FMachDR),FMachDR'=CurMachCode q
 	....i $d(^dbo.QCTestResultI("IndexTestTime",Curdate,CurTime,CurMachCode,FTestCodeDR)) d
 	.....s CurLevelNo="" f  s CurLevelNo=$o(^dbo.QCTestResultI("IndexTestTime",Curdate,CurTime,CurMachCode,FTestCodeDR,CurLevelNo)) q:CurLevelNo=""  d 
    ......i $l(FLeavel),(##class(LIS.WS.BLL.DHCQCTestResult).CheckContian(FLeavel,",",CurLevelNo)=0) q
    ......s PicResult=0,TotalPicResult=""
 	......s RowID="" f  s RowID=$o(^dbo.QCTestResultI("IndexTestTime",Curdate,CurTime,CurMachCode,FTestCodeDR,CurLevelNo,RowID)) q:RowID=""  d	
  	.......//去除复查点
  	.......i FPointRange=4,($d(^TMPLISQC($zn,repid,$i,CurLevelNo,CurdateNum))>1) q
 	.......//取业务数据取数组的值
 	.......s StrData=$g(^dbo.QCTestResultD(RowID)),CurPointType=""
 	.......//批次判断
 	.......i $l(FMatLotDR),##class(LIS.WS.BLL.DHCQCTestResult).CheckContian(FMatLotDR,",",$lg(StrData,2))=0 q
 	.......s CurLevelName=""
 	.......//增加浓度名称
 	.......s MaterialRowId=$lg(^dbo.BTQCMaterialLotD($lg(StrData,2)),3)
 	.......s curLeavelRowId=""  f  s curLeavelRowId=$o(^dbo.BTQCMaterialLevelI("IndexMaster",MaterialRowId,CurLevelNo,curLeavelRowId)) q:curLeavelRowId=""  d	
 	........s CurLevelName=$lg(^dbo.BTQCMaterialLevelD(curLeavelRowId),4)
 	.......s TMPLISQC("LeavelName",CurLevelNo)=$lb(CurLevelName)
 	.......//删除点直接过滤,排除点过滤(1:正常,2:排除,3:删除,4:复查,5:平均值,6:所有在控点)
 	.......s ExcludeType=$lg(StrData,14)
 	.......i ExcludeType=3 q 
 	.......i FPointRange=2,ExcludeType=2 q 
 	.......//------------------------------
 	.......s QcTime=CurTime
 	.......i CurTime>86399 s CurTime=86399
 	.......s TestRTime=CurTime
 	.......s TCName=$lg($g(^dbo.BTTestCodeD(FTestCodeDR)),3)
 	.......s UserId=$lg(StrData,25),UserName=""
 	.......i $l(UserId) s UserName=$lg(^dbo.SYSUserD(UserId),3)
 	.......s UpdateUserDR=$lg(StrData,22),UpdateUserName=""
 	.......i $l(UpdateUserDR) s UpdateUserName=$lg(^dbo.SYSUserD(UpdateUserDR),3)
 	.......s AutUserDR=$lg(StrData,25),AutUserName=""
 	.......i $l(AutUserDR) s AutUserName=$lg(^dbo.SYSUserD(AutUserDR),3)
 	.......s MachResult=$lg(StrData,9)
 	.......s TextRes=$lg(StrData,10)
 	.......i '$l(TextRes) s TextRes=MachResult
 	.......//维护了定量转定性公式,临时把符合公式的定量值转换成定性的结果转换值
 	.......i $d(^dbo.BTQCResultToNumberI("IndexMaster",CurMachCode,FTestCodeDR)) d
 	........s OldTranResult="" f  s OldTranResult=$o(^dbo.BTQCResultToNumberI("IndexMaster",CurMachCode,FTestCodeDR,OldTranResult)) q:OldTranResult=""  d
 	.........s TranRowID="" f  s TranRowID=$o(^dbo.BTQCResultToNumberI("IndexMaster",CurMachCode,FTestCodeDR,OldTranResult,TranRowID)) q:TranRowID=""  d
 	..........s TransFormula=$lg($g(^dbo.BTQCResultToNumberD(TranRowID)),7)
 	..........s PerLevelNos=$lg($g(^dbo.BTQCResultToNumberD(TranRowID)),6)
 	..........i $l(TransFormula) d
 	...........s CalStr="(CalStrRes) s CalStrRes=("_$REPLACE(TransFormula,"#",MachResult)_")"
 	...........i $l(PerLevelNos),##class(LIS.WS.BLL.DHCQCTestResult).CheckContian(PerLevelNos,",",CurLevelNo)=1 d
 	............x (CalStr,.CalStrRes)
 	............i CalStrRes=1 d
 	.............s MachResult=$lg($g(^dbo.BTQCResultToNumberD(TranRowID)),5)
 	.............//定量转定性的原始结果就不回转换
 	.............s TextRes=TextRes_"  "
 	...........e  i '$l(PerLevelNos) d
 	............x (CalStr,.CalStrRes)
 	............i CalStrRes=1 d
 	.............s MachResult=$lg($g(^dbo.BTQCResultToNumberD(TranRowID)),5)
 	.............//定量转定性的原始结果就不回转换
 	.............s TextRes=TextRes_"  "
 	.......//是否是定性质控
 	.......s IsQualitative=0
 	.......i $d(^dbo.BTQCResultToNumberI("IndexMaster",CurMachCode,FTestCodeDR)) d
 	........s IsQualitative=1
 	........s HasTransRes=0
 	........s OldTranResult="" f  s OldTranResult=$o(^dbo.BTQCResultToNumberI("IndexMaster",CurMachCode,FTestCodeDR,OldTranResult)) q:(OldTranResult="")||(HasTransRes=1)  d
 	.........s TranRowID="" f  s TranRowID=$o(^dbo.BTQCResultToNumberI("IndexMaster",CurMachCode,FTestCodeDR,OldTranResult,TranRowID)) q:(TranRowID="")||(HasTransRes=1)  d
 	..........s OldResult=$lg($g(^dbo.BTQCResultToNumberD(TranRowID)),4)
 	..........s NewResult=$lg($g(^dbo.BTQCResultToNumberD(TranRowID)),5)
 	..........i MachResult=NewResult s MachResult=OldResult,HasTransRes=1
 	.......i IsQualitative=0 s MachResult=##class(LIS.WS.BLL.DHCQCTestResult).DealPoint(MachResult)
 	.......//非数值退出
 	.......i IsQualitative=0,'$ISVALIDNUM(MachResult) q
 	.......s PicResult=MachResult
 	.......s PicX=PicResult
 	.......s CurRuleCode=$lg(StrData,12)
 	.......i $l(FExcludeRule),##class(LIS.WS.BLL.DHCQCTestResult).CheckContian(FExcludeRule,",",CurRuleCode)=1 Quit
 	.......s CurRuleStatus=$lg($g(StrData),13)
 	.......//选择了所有在控点,有失控规则的就排除
 	.......i (FPointRange=6),$l(CurRuleCode),(CurRuleStatus="R") q
 	.......i CurRuleStatus="R" s CurPointType=0   //失控的点不连线。只显示
 	.......i ExcludeType="2" s CurPointType=0   //排除的点不连线。只显示
 	.......s CurRuleColour="",CurRuleName=""
 	.......i $l(CurRuleCode) s CurRuleName=$lg($g(^dbo.BTQCRulesD(CurRuleCode)),3)
 	.......i $l(CurRuleCode) s CurRuleColour=$lg($g(^dbo.BTQCRulesD(CurRuleCode)),5)
 	.......//失控处理了单独显示颜色
 	.......i $d(^dbo.QCTestResultTransactionI("IndexMaster",RowID)) s CurRuleColour="#a983ca"
 	.......s ResColor=$lg(StrData,26)
 	.......//参与计算颜色
 	.......i $l(ResColor) s CurRuleColour=ResColor
 	.......//排除单独颜色
 	.......i ExcludeType="2" s CurRuleColour="#549cc7"
 	.......//根据质控物批次取项目的靶值标准差
 	.......s CurMaterialLotDR=$lg(StrData,2),StrQCPara=""
 	.......//得到批次项目
  	.......s MLDRRowId=##class(LIS.WS.BLL.DHCQCTestResult).GetMatLotTestCode(CurMaterialLotDR,FTestCodeDR,CurLevelNo,RowID)
 	.......i '$l(MLDRRowId) q
 	.......i $l(MLDRRowId) s StrQCPara=##class(LIS.WS.BLL.DHCQCTestResult).GetStrQcPara(MLDRRowId,Curdate)
 	.......s Precision=$lg(StrQCPara,11),(TCCV,CalX,CalSD,CalCV)=""
 	.......s LotNo=$lg(StrQCPara,23)
 	.......s ReagentLot=$lg(StrQCPara,41)
 	.......s SetCV=$lg(StrQCPara,27)
 	.......s SetCV=$fn(SetCV,"",Precision)
 	.......s TargetCV=$lg(StrQCPara,28)
 	.......s TargetCV=$fn(TargetCV,"",Precision)
 	.......s CalcType=$lg(StrQCPara,10)
 	.......i ('$l(Precision)) s Precision=2
 	.......i $l(StrQCPara) s TCX=$fn($lg(StrQCPara,5),"",Precision)
 	.......//取到0了就不管精度了
 	.......i $ZABS(TCX)<0.00000000001 s TCX=$lg(StrQCPara,5)
 	.......i $l(StrQCPara),CalcType="FL" s TCX=$fn($lg(StrQCPara,7),"",Precision)
 	.......i $f(TCX,".")>0 s TCX=$e(TCX,0,$f(TCX,".")+Precision+1)
	.......i $e(TCX,1,1)="." d  s TCX="0"_TCX
	.......//取到0了就不管精度了
 	.......i $ZABS(TCX)<0.00000000001 s TCX=$lg(StrQCPara,7)
 	.......i $l(StrQCPara) s TCSD=$fn($lg(StrQCPara,6),"",Precision)
 	.......//取到0了就不管精度了
 	.......i $ZABS(TCSD)<0.00000000001 s TCSD=$lg(StrQCPara,6)
 	.......i $l(StrQCPara),CalcType="FL" s TCSD=$fn($lg(StrQCPara,8),"",Precision)
	.......i $f(TCSD,".")>0 s TCSD=$e(TCSD,0,$f(TCSD,".")+Precision+1)
	.......i $e(TCSD,1,1)="." d  s TCSD="0"_TCSD
	.......//取到0了就不管精度了
 	.......i $ZABS(TCSD)<0.00000000001 s TCSD=$lg(StrQCPara,8)
 	.......i $g(TCX)>0 s TCCV=$fn((TCSD/TCX)*100,"",Precision)
 	.......//有设定的直接取设定的,不计算了
 	.......i $l($lg(StrQCPara,27)) s TCCV=$lg(StrQCPara,27)
 	.......s TCCV=$fn(TCCV,"",Precision)
 	.......s TestPrecision=$lg($g(^dbo.BTTestCodeD(FTestCodeDR)),10)
 	.......i IsQualitative=0 s PicResult=$fn(PicResult,"",Precision),MachResult=$fn(MachResult,"",Precision)
 	.......s PicX=$fn(PicX,"",Precision)
 	.......s OutTime=$e($zt(CurTime),1,5)
 	.......i QCIsPrintTime'="0" d
 	........s PicResult="["_OutTime_"]"_PicResult_" "_CurRuleName
 	.......e  d
 	........s PicResult=PicResult_" "_CurRuleName
 	.......i '$d(^TMPLISQC($zn,repid,"AuthInfo")) s ^TMPLISQC($zn,repid,"AuthInfo")=$lb(UpdateUserName,AutUserName,UpdateUserDR,AutUserDR)
 	.......//一天数据按浓度堆集合
 	.......i $d(^TMPLISQC($zn,repid,"OneDayData",CurLevelNo)) d
 	........s ^TMPLISQC($zn,repid,"OneDayData",CurLevelNo)=^TMPLISQC($zn,repid,"OneDayData",CurLevelNo)_$lb(PicResult)
 	.......e  d
 	........s ^TMPLISQC($zn,repid,"OneDayData",CurLevelNo)=$lb(PicResult)
 	.......//一天数据按浓度堆集合
 	.......i $d(^TMPLISQC($zn,repid,"OneDayDataOper",CurLevelNo)) d
 	........s ^TMPLISQC($zn,repid,"OneDayDataOper",CurLevelNo)=^TMPLISQC($zn,repid,"OneDayDataOper",CurLevelNo)_$lb(UserName)
 	.......e  d
 	........s ^TMPLISQC($zn,repid,"OneDayDataOper",CurLevelNo)=$lb(UserName)
 	.......i (CurLevelNo="1")||(FTemplateCode="QCPrintLJ") d
 	........i '$l(L1Result) s L1Result=PicResult
 	........e  s L1Result=L1Result_","_PicResult
 	.......i CurLevelNo="2" d
 	........i '$l(L2Result) s L2Result=PicResult
 	........e  s L2Result=L2Result_","_PicResult
 	.......i CurLevelNo="3" d
 	........i '$l(L3Result) s L3Result=PicResult
 	........e  s L3Result=L3Result_","_PicResult
 	.......i CurLevelNo="4" d
 	........i '$l(L4Result) s L4Result=PicResult
 	........e  s L4Result=L4Result_","_PicResult
 	.......i CurLevelNo="5" d
 	........i '$l(L5Result) s L5Result=PicResult
 	........e  s L5Result=L5Result_","_PicResult
 	.......i CurLevelNo="6" d
 	........i '$l(L6Result) s L6Result=PicResult
 	........e  s L6Result=L6Result_","_PicResult
 	.//把一天的集合长度补齐
 	.i $d(^TMPLISQC($zn,repid,"OneDayData")) d
 	..s OneMaxNum=0
 	..s OneLastMaxListLen=0
 	..s MaxOperList=""
 	..//得到最大长度
 	..s OneLevelNo="" f  s OneLevelNo=$o(^TMPLISQC($zn,repid,"OneDayData",OneLevelNo)) q:OneLevelNo=""  d
 	...s OneList=^TMPLISQC($zn,repid,"OneDayData",OneLevelNo)
 	...i (OneMaxNum<$ll(OneList)) s OneMaxNum=$ll(OneList)
 	..s OneLevelNo="" f  s OneLevelNo=$o(^TMPLISQC($zn,repid,"OneDayData",OneLevelNo)) q:OneLevelNo=""  d
 	...s OneList=^TMPLISQC($zn,repid,"OneDayData",OneLevelNo)
 	...s OneOperList=^TMPLISQC($zn,repid,"OneDayDataOper",OneLevelNo)
 	...i '$l(MaxOperList) s MaxOperList=OneOperList
 	...i $ll(MaxOperList)<$ll(OneOperList) s MaxOperList=OneOperList
 	...//小于最大长度就补齐
 	...i ($ll(OneList)<OneMaxNum) d
 	....s OneCha=OneMaxNum-$ll(OneList)
 	....f zone=1:1:OneCha d
 	.....s OneList=OneList_$lb("")
 	...s CurListLen=0
 	...i $d(^TMPLISQC($zn,repid,"VResult",OneLevelNo)) s CurListLen=$ll(^TMPLISQC($zn,repid,"VResult",OneLevelNo))
 	...//补全之前没数据的长度
 	...i CurListLen<LastMaxListLen d
 	....s TowCha=LastMaxListLen-CurListLen
 	....f ztow=1:1:TowCha d
 	.....s OneList=$lb("")_OneList
 	...//按浓度拼接到主数据
 	...i $d(^TMPLISQC($zn,repid,"VResult",OneLevelNo)) d
 	....s ^TMPLISQC($zn,repid,"VResult",OneLevelNo)=^TMPLISQC($zn,repid,"VResult",OneLevelNo)_OneList
 	...e  d
 	....s ^TMPLISQC($zn,repid,"VResult",OneLevelNo)=OneList
 	...//记录最后累计长度
 	...i OneLastMaxListLen<$ll(^TMPLISQC($zn,repid,"VResult",OneLevelNo)) d
 	....s OneLastMaxListLen=$ll(^TMPLISQC($zn,repid,"VResult",OneLevelNo))
 	..s LastMaxListLen=OneLastMaxListLen
 	..//小于最大长度就补齐
 	..i ($ll(MaxOperList)<OneMaxNum) d
 	...s OneCha=OneMaxNum-$ll(MaxOperList)
 	...f zone=1:1:OneCha d
 	....s MaxOperList=MaxOperList_$lb("")
 	..//按操作者拼接到主数据
 	..i QCIsPrintUser="1" d
 	...i $d(^TMPLISQC($zn,repid,"VResult",999)) d
 	....s ^TMPLISQC($zn,repid,"VResult",999)=^TMPLISQC($zn,repid,"VResult",999)_MaxOperList
 	...e  d
 	....s ^TMPLISQC($zn,repid,"VResult",999)=MaxOperList
 	...//按日期拼接到日期主数据
 	..s OneDateList=""
 	..f zone=1:1:OneMaxNum d
 	...s OneDateList=OneDateList_$lb(Curdate)
 	..i $d(^TMPLISQC($zn,repid,"VResult",0)) d
 	...s ^TMPLISQC($zn,repid,"VResult",0)=^TMPLISQC($zn,repid,"VResult",0)_OneDateList
 	..e  d
 	...s ^TMPLISQC($zn,repid,"VResult",0)=OneDateList
    .i $l(L1Result)||$l(L2Result)||$l(L3Result)||$l(L4Result)||$l(L5Result)||$l(L6Result) d
 	..s RetNum=RetNum+1
 	..s ^TMPLISQC($zn,repid,"Result",Curdate,FirstTime,RetNum)=$lb(RetNum,Curdate,$zt(FirstTime),L1Result,L2Result,L3Result,L4Result,L5Result,L6Result,UserName)
    //左边行头
 	s ^TMPLISQC($zn,repid,"VTitle")=$lb("日期")
 	s ^TMPLISQC($zn,repid,"ResultHead")=$lb("序号","日期","时间")
 	s OneLevelNo="" f  s OneLevelNo=$o(TMPLISQC("LeavelName",OneLevelNo)) q:OneLevelNo=""  d
    .s ^TMPLISQC($zn,repid,"VTitle")=^TMPLISQC($zn,repid,"VTitle")_TMPLISQC("LeavelName",OneLevelNo)
    .s ^TMPLISQC($zn,repid,"ResultHead")=^TMPLISQC($zn,repid,"ResultHead")_TMPLISQC("LeavelName",OneLevelNo)
  	q RetNum
}

/// 保存打印日志
ClassMethod SetTSPrintFlagMTHD(TSRowIDs As %String(MAXLEN=32767), UserID As %String, param As %String, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
{
  q 0
}

/// 初始化报告打印顺序
/// w ##Class(HIS.DHCQCPrintCommon).InitQCOrder()
ClassMethod InitQCOrder() As %String
{
	//不每次执行,解决数据库日志问题
	s ChangeTime=""
	&SQL(select TimeChanged INTO :ChangeTime from %dictionary.compiledclass where ID='HIS.DHCQCPrintCommon' and CompileNamespace like '%DHC-LISDATA')
    i $l(ChangeTime),(ChangeTime=$g(^PrintOrderChangeInfo("HIS.DHCQCPrintCommon"))) q 0
    s ^PrintOrderChangeInfo("HIS.DHCQCPrintCommon")=ChangeTime
    
	s ^DHCQCrintOrder("D","标题")=1
    s ^DHCQCrintOrder("D","查询日期")=2
    s ^DHCQCrintOrder("D","仪器代码")=3
    s ^DHCQCrintOrder("D","仪器")=4
    s ^DHCQCrintOrder("D","质控物代码")=5
    s ^DHCQCrintOrder("D","质控物")=6
    s ^DHCQCrintOrder("D","波长")=7
    s ^DHCQCrintOrder("D","项目名称")=8
    s ^DHCQCrintOrder("D","浓度单位")=9
    s ^DHCQCrintOrder("D","实验方法")=10
    s ^DHCQCrintOrder("D","浓度")=11
    s ^DHCQCrintOrder("D","使用规则")=12
    s ^DHCQCrintOrder("D","批号")=13
    s ^DHCQCrintOrder("D","校正液批号")=14
    s ^DHCQCrintOrder("D","校正液效期")=15
    s ^DHCQCrintOrder("D","校正液")=16
    s ^DHCQCrintOrder("D","试剂厂商")=17
    s ^DHCQCrintOrder("D","失控处理")=18
    s ^DHCQCrintOrder("D","质控评价")=19
    s ^DHCQCrintOrder("D","主波长")=20
    s ^DHCQCrintOrder("D","次波长")=21
    s ^DHCQCrintOrder("D","试剂批号")=22
    s ^DHCQCrintOrder("D","质控批号")=23
    s ^DHCQCrintOrder("D","批次浓度")=24
    s ^DHCQCrintOrder("D","打印时间")=25
    s ^DHCQCrintOrder("D","目标CV")=26
    s ^DHCQCrintOrder("D","失效日期")=27
    s ^DHCQCrintOrder("D","打印人")=28
    s ^DHCQCrintOrder("D","试剂有效期")=29
    s ^DHCQCrintOrder("D","工作组")=30
    s ^DHCQCrintOrder("D","工作小组")=31
    s ^DHCQCrintOrder("D","开始日期")=32
    s ^DHCQCrintOrder("D","结束日期")=33
    s ^DHCQCrintOrder("D","生产日期")=34
    s ^DHCQCrintOrder("D","仪器简称")=35
    s ^DHCQCrintOrder("D","工作组标题")=36
    s ^DHCQCrintOrder("D","质控审阅人")=37
    s ^DHCQCrintOrder("D","签字")=38
    s ^DHCQCrintOrder("D","质控物厂家")=39
    //PrintFlag维护LastPageD
    s ^DHCQCrintOrder("D","质控审阅人签名")=40
    //PrintFlag维护LastPageD
    s ^DHCQCrintOrder("D","签字签名")=41
    
    s ^DHCQCrintOrder("TD","L1浓度名称")=1
    s ^DHCQCrintOrder("TD","L1浓度")=2
    s ^DHCQCrintOrder("TD","L1靶值")=3
    s ^DHCQCrintOrder("TD","L1SD")=4
    s ^DHCQCrintOrder("TD","L1CV")=5
    s ^DHCQCrintOrder("TD","L1计算均值")=6
    s ^DHCQCrintOrder("TD","L1计算SD")=7
    s ^DHCQCrintOrder("TD","L1计算CV")=8
    s ^DHCQCrintOrder("TD","L1累计均值")=9
    s ^DHCQCrintOrder("TD","L1累计SD")=10
    s ^DHCQCrintOrder("TD","L1累计CV")=11
    
    s ^DHCQCrintOrder("TD","L2浓度名称")=1
    s ^DHCQCrintOrder("TD","L2浓度")=2
    s ^DHCQCrintOrder("TD","L2靶值")=3
    s ^DHCQCrintOrder("TD","L2SD")=4
    s ^DHCQCrintOrder("TD","L2CV")=5
    s ^DHCQCrintOrder("TD","L2计算均值")=6
    s ^DHCQCrintOrder("TD","L2计算SD")=7
    s ^DHCQCrintOrder("TD","L2计算CV")=8
    s ^DHCQCrintOrder("TD","L2累计均值")=9
    s ^DHCQCrintOrder("TD","L2累计SD")=10
    s ^DHCQCrintOrder("TD","L2累计CV")=11
    
    s ^DHCQCrintOrder("TD","L3浓度名称")=1
    s ^DHCQCrintOrder("TD","L3浓度")=2
    s ^DHCQCrintOrder("TD","L3靶值")=3
    s ^DHCQCrintOrder("TD","L3SD")=4
    s ^DHCQCrintOrder("TD","L3CV")=5
    s ^DHCQCrintOrder("TD","L3计算均值")=6
    s ^DHCQCrintOrder("TD","L3计算SD")=7
    s ^DHCQCrintOrder("TD","L3计算CV")=8
    s ^DHCQCrintOrder("TD","L3累计均值")=9
    s ^DHCQCrintOrder("TD","L3累计SD")=10
    s ^DHCQCrintOrder("TD","L3累计CV")=11
    
    //结果列表1
    s ^DHCQCrintOrder("R1","仪器名称1")=1
    s ^DHCQCrintOrder("R1","测试日期1")=2
    s ^DHCQCrintOrder("R1","时间1")=3
    s ^DHCQCrintOrder("R1","操作者1")=4
    s ^DHCQCrintOrder("R1","L1结果1")=5
    s ^DHCQCrintOrder("R1","L2结果1")=6
    s ^DHCQCrintOrder("R1","L3结果1")=7
    
    //结果列表2
    s ^DHCQCrintOrder("R2","仪器名称2")=1
    s ^DHCQCrintOrder("R2","测试日期2")=2
    s ^DHCQCrintOrder("R2","时间2")=3
    s ^DHCQCrintOrder("R2","操作者2")=4
    s ^DHCQCrintOrder("R2","L1结果2")=5
    s ^DHCQCrintOrder("R2","L2结果2")=6
    s ^DHCQCrintOrder("R2","L3结果2")=7
    
    q 0
}

}

不限定用M控制绘制,js也是一样的,类似lodp

//此js作为lisprint.zip给his打印中间件的纯js使用示例
//调用示例代码如下,更多打印支持按检验调用
//打印
//$('#btnPrint').click(function () {
//    PrintWidget.Init();
//    //文本
//    PrintWidget.AddText(340, 10, "第一页测试文本", "center", "red", "楷体", "22", "bold", "10", "", "", "", "");
//    //线
//    PrintWidget.AddLine(10, 42, 800, 42, 3, "", "#000000");
//    //点
//    PrintWidget.AddPoint(10, 80, 3, "", "red");
//    PrintWidget.AddPoint(60, 80, 4, "", "red");
//    PrintWidget.AddPoint(110, 80, 9, "[]", "red");
//    PrintWidget.AddPoint(160, 80, 12, "", "red");
//    PrintWidget.AddPoint(210, 80, 14, "", "red");
//    //多边形
//    PrintWidget.AddPoly([[200, 100], [250, 100], [280, 150], [250, 200], [200, 200], [150, 150]], "blue");
//    //换页
//    PrintWidget.ChangePage();
//    PrintWidget.AddText(340, 10, "第二页测试文本", "center", "red", "楷体", "22", "bold", "10", "", "", "", "");
//    PrintWidget.AddLine(10, 42, 800, 42, 3, "", "#000000");
//    PrintWidget.AddPoint(10, 80, 3, "", "red");
//    PrintWidget.AddPoint(60, 80, 4, "", "red");
//    PrintWidget.AddPoint(110, 80, 9, "[]", "red");
//    PrintWidget.AddPoint(160, 80, 12, "", "red");
//    PrintWidget.AddPoint(210, 80, 14, "", "red");
//    PrintWidget.AddPoly([[200, 150], [250, 150], [280, 200], [250, 250], [200, 250], [150, 200]], "blue");
//    PrintWidget.AddPoly([[200, 450], [250, 450], [280, 500], [250, 550], [200, 530], [150, 580]], "blue");
//    //PrintWidget.AddPic(10,90,40,40,"")
//    console.info(printWidget);
//    PrintWidget.PrintOut();

//});

打印预览
//$('#btnPrintPreView').click(function () {
//    PrintWidget.Init();
//    //文本
//    PrintWidget.AddText(340, 10, "第一页测试文本", "center", "red", "楷体", "22", "bold", "10", "", "", "", "");
//    //线
//    PrintWidget.AddLine(10, 42, 800, 42, 3, "", "#000000");
//    //点
//    PrintWidget.AddPoint(10, 80, 3, "", "red");
//    PrintWidget.AddPoint(60, 80, 4, "", "red");
//    PrintWidget.AddPoint(110, 80, 9, "[]", "red");
//    PrintWidget.AddPoint(160, 80, 12, "", "red");
//    PrintWidget.AddPoint(210, 80, 14, "", "red");
//    //多边形
//    PrintWidget.AddPoly([[200, 100], [250, 100], [280, 150], [250, 200], [200, 200], [150, 150]], "blue");
//    //换页
//    PrintWidget.ChangePage();
//    PrintWidget.AddText(340, 10, "第二页测试文本", "center", "red", "楷体", "22", "bold", "10", "", "", "", "");
//    PrintWidget.AddLine(10, 42, 800, 42, 3, "", "#000000");
//    PrintWidget.AddPoint(10, 80, 3, "", "red");
//    PrintWidget.AddPoint(60, 80, 4, "", "red");
//    PrintWidget.AddPoint(110, 80, 9, "[]", "red");
//    PrintWidget.AddPoint(160, 80, 12, "", "red");
//    PrintWidget.AddPoint(210, 80, 14, "", "red");
//    PrintWidget.AddPoly([[200, 450], [250, 450], [280, 500], [250, 550], [200, 530], [150, 580]], "blue");
//    //PrintWidget.AddPic(10,90,40,40,"")
//    console.info(printWidget);
//    PrintWidget.PrintPreview();
//});
打印表格
//$('#btnPrintGrid').click(function () {
//    PrintWidget.Init();
//    var datas = [];
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "李四", Sex: "男", Age: "24", Phone: "15122222222" });
//    datas.push({ Name: "王二", Sex: "男", Age: "24", Phone: "15122222222" });
//    datas.push({ Name: "zlz", Sex: "男", Age: "26", Phone: "18900752521" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    datas.push({ Name: "张三aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa张三张三张三张三张三张三张三张三张三张三", Sex: "男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男男", Age: "24测试24测试24测试24测试24测试24测试24测试", Phone: "15122222222" });
//    PrintWidget.AddGrid(datas, ["Name", "Sex", "Age", "Phone"], null, ["left", "center", "right", "left"], 800, 10, 30, null, null, null, null, null, null, 1168);
//    PrintWidget.PrintPreview();
//});

//jsonStr:合检验打印元素绘制协议json的url
//printFlag:打印标识 PrintPreview或PrintOut控制打印预览和直接打印或者PDF#地址  【0用户选  -1桌面  具体地址】
function JsBasePrint(jsonStr, printFlag) {
    LISPrint.JsPrint(jsonStr, printFlag,"1");
}

//打印插件
var PrintWidget = {
    //初始化
    Init: function () {
        printWidget = [];
        printWidgetAllPage = [];
        printPaperHeightWidget = 1024;
        handPrintWidget = false;
    },
    //生成PDF type:PrintOut:打印  PrintPreview打印预览  PDF#地址  【0用户选  -1桌面  具体地址】
    PrintOutPDF: function (type) {
        if (type == null) {
            type = "PDF#0";
        }
        var jsonStr = JSON.stringify(printWidget);
        JsBasePrint(jsonStr, type);
    },
    //打印
    PrintOut: function () {
        var jsonStr = JSON.stringify(printWidget);
        JsBasePrint(jsonStr, "PrintOut");
    },
    //打印预览
    PrintPreview: function () {
        var jsonStr = JSON.stringify(printWidget);
        JsBasePrint(jsonStr, "PrintPreview");
    },
    //设置是否自动转换坐标
    SetIsAutoCoordinate: function (isAutoCoordinate) {
        IsAutoCoordinate = isAutoCoordinate;
    },
    //设置打印机,要在最开始设置,切记
    //IsAutoChangePage:为空默认自动,是否自动换页1:自动,自上而下的绘制,由动态库执行分页  0:主动,打印逻辑通过换页元素换页
    //PaperName:纸张名称
    //PaperWidth:宽度
    //PaperHeight:高度
    //PaperLayOut:纸张方向Landscape横向
    //Printer:打印机
    //PaperSource:送纸来源
    //PrintWidget.SetPrinter("", "", "", "Landscape", "", "");
    SetPrinter: function (IsAutoChangePage, PaperName, PaperWidth, PaperHeight, PaperLayOut, Printer, PaperSource) {
        //是设置的话就不清除数据
        if (printWidget.length > 0 && printWidget[0].PrintType == "PRINTER") {
            printWidget = [];
        }
        if (IsAutoChangePage == null) {
            IsAutoChangePage = "1";
        }
        if (PaperName == null) {
            PaperName = "";
        }
        if (PaperWidth == null || PaperWidth == "") {
            PaperWidth = "1";
        }
        if (PaperHeight == null || PaperHeight == "") {
            PaperHeight = "1";
        }
        if (PaperLayOut == null) {
            PaperLayOut = "";
        }
        if (Printer == null) {
            Printer = "";
        }
        //变化宽高
        if (PaperLayOut == "Landscape") {
            var tmpwh = printPaperHeightWidget;
            //存纸张高度
            printPaperHeightWidget = printPaperWidthWidget;
            //存纸张宽度度
            printPaperWidthWidget = tmpwh;
        }
        if (PaperSource == null || PaperSource == "") {
            PaperSource = "0";
        }
        printWidget.unshift({ PrintType: "PRINTER", PrintX: "1", PrintY: "1", PrintFont: PaperSource, PrintFontSize: "1", PrintFontStyle: "", PrintLength: "1", PrintWidth: PaperWidth, PrintHeight: PaperHeight, PrintText: "", DataField: PaperName, PrintFlag: Printer, PrintAlignment: PaperLayOut, PrintImageFile: "", PrintColor: "", Angle: "", IsVShow: IsAutoChangePage });
    },
    //仅仅设置打印机,防止干扰纸张,要在最开始设置,切记
    SetPrinterOnly: function (Printer) {
        //是设置的话就不清除数据
        if (printWidget.length > 0 && printWidget[0].PrintType == "PRINTER") {
            printWidget = [];
        }
        if (IsAutoChangePage == null) {
            IsAutoChangePage = "1";
        }
        if (PaperName == null) {
            PaperName = "";
        }
        if (PaperWidth == null || PaperWidth == "") {
            PaperWidth = "1";
        }
        if (PaperHeight == null || PaperHeight == "") {
            PaperHeight = "1";
        }
        if (PaperLayOut == null) {
            PaperLayOut = "";
        }
        if (Printer == null) {
            Printer = "";
        }
        printWidget.unshift({ PrintType: "PRINTERONLY", PrintX: "1", PrintY: "1", PrintFont: PaperSource, PrintFontSize: "1", PrintFontStyle: "", PrintLength: "1", PrintWidth: PaperWidth, PrintHeight: PaperHeight, PrintText: "", DataField: PaperName, PrintFlag: Printer, PrintAlignment: PaperLayOut, PrintImageFile: "", PrintColor: "", Angle: "", IsVShow: IsAutoChangePage });
    },
    //公共处理Y增长逻辑,超过纸张后换页
    AddY: function (curY, addHeight, paperHeight) {
        curY += addHeight;
        if (curY > paperHeight) {
            curY = curY - paperHeight;
            PrintWidget.ChangePage();
        }
        return curY;
    },
    //datas:数组数据
    //cols:绘制列数据属性名称数组
    //colRates:列比例,传空平均,传的位数比列少后面部分平均
    //colAligns:列停靠left  center right,传空left,传的位数比列少后面部分left
    //width:表格宽度
    //left:左
    //top:顶部
    //isDrawBorder:是否画边框
    //borderWidth:边框线宽度
    //rowHeight:行高,默认20
    //lineWidth:线宽,默认1
    //fontSize:字体,默认15
    //color:颜色,默认#000000
    //paperHeight:不为空,则根据传入的高度自动换页
    //colNum:列数,默认单列1,多列传列数
    //colDirection:多列的时候的列方向,默认0平均分配,否则为大于0的数,左边打满该数从左往右填
    //返回最大Y坐标
    AddGrid: function (datas, cols, colRates, colAligns, width, left, top, isDrawBorder, borderWidth, rowHeight, lineWidth, fontSize, color, paperHeight, colNum, colDirection, drawHLine) {
        var retMaxY = top;
        //有数据画表格
        if (datas != null && datas.length > 0) {
            //有列开始绘制
            if (cols != null && cols.length > 0) {
                //处理比例数据
                if (colRates == null) {
                    colRates = [];
                }
                //处理停靠
                if (colAligns == null) {
                    colAligns = [];
                }
                //默认宽度
                if (width == null) {
                    width = 800;
                }
                //默认左边
                if (left == null) {
                    left = 0;
                }
                //默认顶部
                if (top == null) {
                    top = 0;
                }
                //默认画边框
                if (isDrawBorder == null) {
                    isDrawBorder = true;
                }
                //默认宽度
                if (borderWidth == null) {
                    borderWidth = 1;
                }
                //默认行高
                if (rowHeight == null) {
                    rowHeight = 25;
                }
                else {
                    rowHeight = parseInt(rowHeight);
                }
                //线宽
                if (lineWidth == null) {
                    lineWidth = 1;
                }
                //默认字体大小
                if (fontSize == null) {
                    fontSize = 15;
                }
                if (color == null) {
                    color = "#000000";
                }
                //列数
                if (colNum == null) {
                    colNum = 1;
                }
                else {
                    colNum = parseInt(colNum);
                }
                //列方向
                if (colDirection == null) {
                    colDirection = 0;
                }
                else {
                    colDirection = parseInt(colDirection);
                }
                //处理多列数据
                if (colNum > 1) {
                    //处理左一个右一个数据
                    if (colDirection == 0) {
                        var tmpData = [];
                        for (var i = 0; i < datas.length + colNum; i += colNum) {
                            var rowData = {};
                            var hasAddData = false;
                            for (var j = 0; j < colNum; j++) {
                                if (i + j < datas.length) {
                                    for (var c in datas[i + j]) {
                                        rowData[c + "^" + j] = datas[i + j][c];
                                        hasAddData = true;
                                    }
                                }
                            }
                            if (hasAddData == true) {
                                tmpData.push(rowData);
                            }
                        }
                        datas = tmpData;
                    }
                    //处理从左向右填充数据
                    else if (colDirection > 0) {
                        var tmpData = [];
                        var curColNum = 0;
                        for (var i = 0; i < datas.length + colDirection; i += colDirection) {
                            for (var j = 0; j < colDirection; j++) {
                                //创建一行数据
                                if (tmpData[j] == null) {
                                    tmpData[j] = {};
                                }
                                if (i + j < datas.length) {
                                    for (var c in datas[i + j]) {
                                        tmpData[j][c + "^" + curColNum] = datas[i + j][c];
                                    }
                                }
                            }
                            curColNum++;
                        }
                        datas = tmpData;
                    }
                    var tmpcols = [];
                    var tmpcolRates = [];
                    var tmpcolAligns = [];
                    //处理列名等参数
                    for (var i = 0; i < colNum; i++) {
                        for (var j = 0; j < cols.length; j++) {
                            tmpcols.push(cols[j] + "^" + i);
                            tmpcolRates.push(colRates[j]);
                            tmpcolAligns.push(colAligns[j]);
                        }
                    }
                    cols = tmpcols;
                    colRates = tmpcolRates;
                    colAligns = tmpcolAligns;
                }
                var curY = top;
                //上横线
                PrintWidget.AddLine(left, top, left + width, top, lineWidth, "", "#000000");
                //存x坐标
                var xArr = [];
                //遍历绘制数据
                for (var i = 0; i < datas.length; i++) {
                    //存一行开始元素的索引
                    var startRowIndex = printWidget.length;
                    var curX = left;
                    var useRate = 0;
                    //记录最大的换行y
                    maxDataChangeY = curY;
                    //遍历画列
                    for (var j = 0; j < cols.length; j++) {
                        var align = "left";
                        if (j < colAligns.length) {
                            align = colAligns[j];
                        }
                        var rate = 1.0 / cols.length;
                        if (j >= colRates.length) {
                            rate = (1 - useRate) / (cols.length - j);
                        }
                        else {
                            rate = colRates[j] / 100;
                        }
                        var curColWidth = width * rate / colNum;
                        var printText = datas[i][cols[j]];
                        if (printText == null) {
                            printText = "";
                        }
                        printText = printText.toString();
                        var drawX = curX;
                        if (align == "left") {
                            drawX = curX;
                        }
                        else if (align == "right") {
                            drawX = curX + curColWidth;
                        }
                        else {
                            drawX = curX + curColWidth / 2;
                        }
                        //存中间串
                        var tmpValueStr = "";
                        var tmpStrWidth = 0;
                        var tmpChangeRowIndex = 0;
                        for (var k = 0; k < printText.length; k++) {
                            //得到一个字符的宽度
                            var charWidth = GetCharWidth(fontSize, printText[k]);
                            tmpStrWidth += charWidth;
                            //超出行了就画,或者^换行                               
                            if (tmpStrWidth > curColWidth || printText[k] == "^") {
                                if (printText[k] == "^") {
                                    k++;
                                }
                                PrintWidget.AddText(drawX, curY + tmpChangeRowIndex * rowHeight, tmpValueStr, align, color, "宋体", fontSize, "bold", "10", "", "", "", "");
                                if (maxDataChangeY < curY + tmpChangeRowIndex * rowHeight) {
                                    maxDataChangeY = curY + tmpChangeRowIndex * rowHeight;
                                }
                                tmpValueStr = "";
                                tmpStrWidth = charWidth;
                                tmpChangeRowIndex++;
                            }
                            tmpValueStr += printText[k];
                        }
                        if (tmpValueStr != "" && tmpValueStr != " ") {
                            //文本
                            PrintWidget.AddText(drawX, curY + tmpChangeRowIndex * rowHeight, tmpValueStr, align, color, "宋体", fontSize, "bold", "10", "", "", "", "");
                            if (maxDataChangeY < curY + tmpChangeRowIndex * rowHeight) {
                                maxDataChangeY = curY + tmpChangeRowIndex * rowHeight;
                            }
                        }
                        //第1行才存x坐标,解决四舍五入引起的竖线抖动
                        if (i == 0) {
                            xArr.push(parseInt(curX));
                        }
                        curX += curColWidth;
                        useRate += rate;
                    }
                    //第1行才存x坐标,解决四舍五入引起的竖线抖动
                    if (i == 0) {
                        xArr.push(parseInt(curX));
                    }

                    //所有列画完才知道最高行高
                    for (var j = 0; j < xArr.length; j++) {
                        if (j == xArr.length - 1) {
                            //画右竖线
                            PrintWidget.AddLine(left + width, curY, left + width, maxDataChangeY + rowHeight, lineWidth, "", "#000000");
                        }
                        else {
                            if (drawHLine != false) {
                                //画右竖线
                                PrintWidget.AddLine(xArr[j], curY, xArr[j], maxDataChangeY + rowHeight, lineWidth, "", "#000000");
                            }
                        }
                    }
                    //画左竖线
                    PrintWidget.AddLine(left, curY, left, maxDataChangeY + rowHeight, lineWidth, "", "#000000");

                    //画下横线
                    PrintWidget.AddLine(left, maxDataChangeY + rowHeight, left + width, maxDataChangeY + rowHeight, lineWidth, "", "#000000");
                    //有纸张高度,按高度换行
                    if (paperHeight != null) {
                        if (maxDataChangeY + rowHeight > paperHeight) {
                            var pageAddYY = 10;
                            //页重复标签实现
                            if (printWidgetAllPage != null && printWidgetAllPage.length > 0) {
                                pageAddYY = 40;
                            }
                            maxDataChangeY = rowHeight + pageAddYY;
                            for (var k = startRowIndex; k < printWidget.length; k++) {
                                printWidget[k].PrintY = printWidget[k].PrintY - curY + pageAddYY;
                                if (maxDataChangeY < printWidget[k].PrintY) {
                                    maxDataChangeY = printWidget[k].PrintY;
                                }
                                if (printWidget[k].PrintType == "ILineN") {
                                    printWidget[k].PrintHeight = printWidget[k].PrintHeight - curY + pageAddYY;
                                    if (maxDataChangeY < printWidget[k].PrintHeight) {
                                        maxDataChangeY = printWidget[k].PrintHeight;
                                    }
                                }
                            }
                            //页重复标签实现
                            if (printWidgetAllPage != null && printWidgetAllPage.length > 0) {
                                for (var zr = 0; zr < printWidgetAllPage.length; zr++) {
                                    printWidget.splice(startRowIndex + zr + 1, 0, printWidgetAllPage[zr]);
                                }
                            }
                            printWidget.splice(startRowIndex, 0, { PrintType: "PAGE", PrintX: 1, PrintY: 1, PrintFont: "宋体", PrintFontSize: "1", PrintFontStyle: "", PrintLength: "1", PrintWidth: "1", PrintHeight: "1", PrintText: "", DataField: "", PrintFlag: "", PrintAlignment: "left", PrintImageFile: "", PrintColor: "#00000" });
                            printWidget.splice(startRowIndex + 1, 0, { PrintType: "ILineN", PrintX: left, PrintY: pageAddYY, PrintFont: "宋体", PrintFontSize: "1", PrintFontStyle: "", PrintLength: lineWidth, PrintWidth: left + width, PrintHeight: pageAddYY, PrintText: "", DataField: "", PrintFlag: "o", PrintAlignment: "", PrintImageFile: "", PrintColor: "#000000" });
                            maxDataChangeY -= rowHeight;
                        }
                    }
                    curY = maxDataChangeY + rowHeight;
                    retMaxY = curY;
                }
            }
        }
        return retMaxY;
    },
    //添加文本
    AddText: function (PrintX, PrintY, PrintText, PrintAlignment, PrintColor, PrintFont, PrintFontSize, PrintFontStyle, PrintLength, PrintWidth, PrintHeight, Angle, IsVShow, PageRepeat) {
        if (Angle == null) {
            Angle = "";
        }
        if (IsVShow == null) {
            IsVShow = "";
        }
        if (PrintFont == null) {
            PrintFont = "宋体";
        }
        if (PrintLength == null) {
            PrintLength = "";
        }
        if (PrintHeight == null || PrintHeight == "") {
            PrintHeight = "20";
        }
        if (PrintWidth == null || PrintWidth == "") {
            PrintWidth = "1";
        }
        if (PrintFontSize != null && PrintFontSize != "") {
            //字符串类型的处理
            if (typeof (PrintFontSize) == "string") {
                PrintFontSize = PrintFontSize.replace("px", "");
            }
        }
        else {
            PrintFontSize = "9";
        }
        if (PrintAlignment == "left") {
            PrintAlignment = "Justified";
        }
        else if (PrintAlignment == "center") {
            PrintAlignment = "Center";
        }
        else if (PrintAlignment == "right") {
            PrintAlignment = "Right";
        }
        else {
            PrintAlignment = "Default";
        }
        if (PrintColor == null || PrintColor == "") {
            PrintColor = "#000000";
        }
        printWidget.push({ PrintType: "Label", PrintX: PrintX, PrintY: PrintY, PrintFont: PrintFont, PrintFontSize: PrintFontSize, PrintFontStyle: PrintFontStyle, PrintLength: PrintLength, PrintWidth: PrintWidth, PrintHeight: PrintHeight, PrintText: PrintText, DataField: "", PrintFlag: "", PrintAlignment: PrintAlignment, PrintImageFile: "", PrintColor: PrintColor, Angle: Angle, IsVShow: IsVShow });
        if (PageRepeat == true) {
            printWidgetAllPage.push({ PrintType: "Label", PrintX: PrintX, PrintY: PrintY, PrintFont: PrintFont, PrintFontSize: PrintFontSize, PrintFontStyle: PrintFontStyle, PrintLength: PrintLength, PrintWidth: PrintWidth, PrintHeight: PrintHeight, PrintText: PrintText, DataField: "", PrintFlag: "", PrintAlignment: PrintAlignment, PrintImageFile: "", PrintColor: PrintColor, Angle: Angle, IsVShow: IsVShow });
        }
    },
    //添加线
    AddLine: function (StartX, StartY, EndX, EndY, LineSize, LineType, PrintColor) {
        if (LineSize == null) {
            LineSize = 2;
        }
        if (LineType == null) {
            LineType = "o";
        }
        //线宽为0就不画线
        if (LineSize == "0") {
            return;
        }
        printWidget.push({ PrintType: "ILineN", PrintX: StartX, PrintY: StartY, PrintFont: "宋体", PrintFontSize: "1", PrintFontStyle: "", PrintLength: LineSize, PrintWidth: EndX, PrintHeight: EndY, PrintText: "", DataField: "", PrintFlag: LineType, PrintAlignment: "", PrintImageFile: "", PrintColor: PrintColor });
    },
    //添加点
    AddPoint: function (PrintX, PrintY, Size, PointType, PrintColor) {
        if (PointType == null) {
            PointType = "o";
        }
        if (Size == null) {
            Size = 1;
        }
        printWidget.push({ PrintType: "Point", PrintX: PrintX, PrintY: PrintY, PrintFont: "宋体", PrintFontSize: "1", PrintFontStyle: "", PrintLength: "1", PrintWidth: Size, PrintHeight: Size, PrintText: "", DataField: "", PrintFlag: PointType, PrintAlignment: "left", PrintImageFile: "", PrintColor: PrintColor });
    },
    //添加多边形
    AddPoly: function (PointArr, FillColor) {
        var polyPrintText = "";
        for (var i = 0; i < PointArr.length; i++) {
            if (polyPrintText == "") {
                polyPrintText += PointArr[i][0] + "@" + PointArr[i][1];
            }
            else {
                polyPrintText += "^" + PointArr[i][0] + "@" + PointArr[i][1];
            }
        }
        printWidget.push({ PrintType: "Poly", PrintX: 1, PrintY: 1, PrintFont: "宋体", PrintFontSize: "1", PrintFontStyle: "", PrintLength: "", PrintWidth: "1", PrintHeight: "1", PrintText: polyPrintText, DataField: "", PrintFlag: "", PrintAlignment: "left", PrintImageFile: "", PrintColor: FillColor });
    },
    //添加图片
    AddPic: function (PrintX, PrintY, PrintWidth, PrintHeight, Data, PrintFlag) {
        printWidget.push({ PrintType: "Graph", PrintX: PrintX, PrintY: PrintY, PrintFont: "宋体", PrintFontSize: "1", PrintFontStyle: "", PrintLength: "", PrintWidth: PrintWidth, PrintHeight: PrintHeight, PrintText: "", DataField: Data, PrintFlag: PrintFlag, PrintAlignment: "left", PrintImageFile: "", PrintColor: "" });
    },
    //换页
    ChangePage: function () {
        printWidget.push({ PrintType: "PAGE", PrintX: 1, PrintY: 1, PrintFont: "宋体", PrintFontSize: "1", PrintFontStyle: "", PrintLength: "1", PrintWidth: "1", PrintHeight: "1", PrintText: "", DataField: "", PrintFlag: "", PrintAlignment: "left", PrintImageFile: "", PrintColor: "#00000" });
    },
    //设置纸张高度,如果按数学坐标系绘制的需要用这个高度换算Y坐标
    SetPaperHeight: function (Height) {
        if (Height == null) {
            Height = 1024;
        }
        printPaperHeightWidget = Height;
    },
    //根据纸张高度处理分页
    //paperHeight:纸张高度
    DealPage: function (paperHeight) {
        for (var i = 0; i < printWidget.length; i++) {
            var aMaxY = printWidget[i].PrintY;
            if (printWidget[i].PrintType == "ILineN") {
                if (aMaxY < printWidget[i].PrintHeight) {
                    aMaxY = printWidget[i].PrintHeight;
                }
            }
            else if (printWidget[i].PrintType == "Poly") {
                var polyStr = "";
                var strArr = printWidget[i].PrintText.split("^");
                if (strArr != null && strArr.length > 0) {
                    for (var j = 0; j < strArr.length; j++) {
                        var strArr1 = strArr[j].split("@");
                        if (aMaxY < parseFloat(strArr1[1])) {
                            aMaxY = parseFloat(strArr1[1]);
                        }
                    }
                }
            }
            printWidget[i].MaxY = aMaxY;
        }
        var ztmpprintWidget = [];
        var paperIndex = 1;
        for (var i = 0; i < printWidget.length; i++

你可能感兴趣的:(Caché,数据库)