/// 门诊住院用药数据采集视图V7.0
Class web.DHCENS.LDYY.VIEWHMYONGYAO7 Extends (%RegisteredObject, %XML.Adaptor, %ZEN.DataModel.Adaptor)
{
/// Description:: 门诊住院用药数据采集视图V7.0
/// Others: d ##class(%ResultSet).RunQuery("web.DHCENS.LDYY.VIEWHMYONGYAO7","GetOILoc1")
Query GetOILoc1() As %Query(ROWSPEC = "no,type,admno") [ SqlProc ]
{
}
ClassMethod GetOILoc1Execute(ByRef qHandle As %Binary) As %Status
{
Set repid=$I(^CacheTemp)
Set qHandle=$lb(0,repid,0)
Set ind=1
s (paadm,no,type,admno )= ""
f s paadm = $O(^PAADM(paadm)) q:paadm="" d
.s:paadm'="" no = $P($G(^PAADM(paadm)),"^",2)
.d outputRow8
Quit $$$OK
outputRow8
s row=$listbuild(no,type,admno)
s ^CacheTemp(repid,ind)=row
s ind=ind+1
q
}
ClassMethod GetOILoc1Close(ByRef qHandle As %Binary) As %Status [ PlaceAfter = GetOILoc1Execute ]
{
Set repid=$LIST(qHandle,2)
Kill ^CacheTemp(repid)
Quit $$$OK
}
ClassMethod GetOILoc1Fetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = GetOILoc1Execute ]
{
Set AtEnd=$LIST(qHandle,1)
Set repid=$LIST(qHandle,2)
Set ind=$LIST(qHandle,3)
Set ind=$o(^CacheTemp(repid,ind))
If ind="" {
Set AtEnd=1
Set Row=""
}
Else {
Set Row=^CacheTemp(repid,ind)
}
s qHandle=$lb(AtEnd,repid,ind)
Quit $$$OK
}
}
二,query查询模板简易写法
/// Description:查询指定窗口科室集合
/// Creator: LiangQiang
/// Modifier: hulihua
/// CreatDate: 2011-04-15
/// Table: DHC_PHWINLOC
/// Input: phwid-药房窗口ID
/// Output: 指定科室描述、药房窗口指定科室表ID、指定科室ID
/// Return:
/// Others:
/// Debug: d ##class(%ResultSet).RunQuery("PHA.OP.DispWinCf.Query","GetLocWin","10")
Query GetLocWin(phwid As %String) As websys.Query(ROWSPEC = "Tloc:%String,Trowid:%String,TLocId:%String")
{
}
ClassMethod GetLocWinExecute(ByRef qHandle As %Binary, phwid) As %Status
{
Set repid=$I(^CacheTemp)
Set qHandle=$lb(0,repid,0)
Set ind=1
q:phwid="" $$$OK
s phwchl=""
f s phwchl=$o(^DHCPHWINL(phwid,"I",phwchl)) q:phwchl="" d
.s ctlocdr=$p(^DHCPHWINL(phwid,"I",phwchl),"^",1)
.s ctloc=$p(^CTLOC(ctlocdr),"^",2)
.s rowid=phwid_"||"_phwchl
.d OutRowtLocWin
Set qHandle=$lb(0,repid,0)
Quit $$$OK
OutRowtLocWin
Set Data=$lb(ctloc,rowid,ctlocdr)
Set ^CacheTemp(repid,ind)=Data
Set ind=ind+1
Quit
}
评论