EDPFAA ;SLC/KCM - RPC Calls to Facility ;5/2/12 3:36pm
;;2.0;EMERGENCY DEPARTMENT;**6,2**;Feb 24, 2012;Build 23
;
BOOT(APP) ; bootstrap appliction
D USER
D APP(APP)
Q
USER ; set bootstrap USER node
N X,TSIEN,ROLEIEN,ROLE,ROLENM,DFLTBRD,DFLTWSHT
S X("duz")=DUZ
S X("userNm")=$P($G(^VA(200,DUZ,0)),U)
S X("timeOut")=$$GET^XPAR("USR^DIV^SYS","ORWOR TIMEOUT CHART",1,"I")
S:'X("timeOut") X("timeOut")=$$DTIME^XUP(DUZ)
S:'X("timeOut") X("timeOut")=300
S X("timeOut")=X("timeOut")*1000 ; milliseconds
S X("countDown")=$$GET^XPAR("USR^SYS^PKG","ORWOR TIMEOUT COUNTDOWN",1,"I")
S:'X("countDown") X("countDown")=10
S X("countDown")=X("countDown")*1000 ; milliseconds
S TSIEN=$O(^EDPB(231.7,"B",DUZ,""))
I TSIEN S ROLEIEN=$O(^EDPB(231.7,"AC",EDPSITE,AREA,TSIEN,""))
I $G(ROLEIEN) D
.S X("roleID")=ROLEIEN
.S ROLENM=$$GET1^DIQ(232.5,ROLEIEN,.01,"E"),X("roleName")=ROLENM
.S ROLE=$$GET1^DIQ(232.5,ROLEIEN,.02,"E"),X("roleAbbr")=ROLE
.S DFLTWSHT=$$GET1^DIQ(232.5,ROLEIEN,.04,"E"),X("defaultWorksheet")=DFLTWSHT
.S DFLTBRD=$$GET1^DIQ(232.5,ROLEIEN,.05,"I"),X("defaultBoard")=DFLTBRD
.; Gather all available worksheets for this role
.D LDWSLIST^EDPBWS(EDPSITE,AREA,ROLEIEN)
D XML^EDPX($$XMLA^EDPX("user",.X,""))
I $D(^XUSEC("XUPROGMODE",DUZ))>0 D XML^EDPX("<auth name=""debug"" />")
D XML^EDPX("</user>")
Q
APP(APP) ; set bootstrap APP node
N X,AREA
S X("name")=APP
S X("site")=DUZ(2)
S X("siteNm")=$$NAME^XUAF4(X("site"))
S X("station")=$$STA^XUAF4(DUZ(2))
S X("time")=$$NOW^XLFDT
S X("version")=$$VERSRV^EDPQAR
S X("vistaSession")=$$SESSID
D XML^EDPX($$XMLA^EDPX("app",.X,""))
D AREA
I APP="cpe-ui-reports" D RPTS
I APP="cpe-ui-care" D ROLES
D XML^EDPX("</app>")
Q
AREA ; set default area node
N X
S X("area")=$$DFLTAREA^EDPQAR(""),AREA=X("area")
I X("area") S X("areaNm")=$P(^EDPB(231.9,X("area"),0),U)
D XML^EDPX($$XMLA^EDPX("defaultArea",.X))
Q
RPTS ; set auth nodes for reports
I $D(^XUSEC("EDPR EXPORT",DUZ))>0 D XML^EDPX("<auth name=""rptExport"" />")
I $D(^XUSEC("EDPR PROVIDER",DUZ))>0 D XML^EDPX("<auth name=""rptProvider"" />")
I $D(^XUSEC("EDPR XREF",DUZ))>0 D XML^EDPX("<auth name=""rptXRef"" />")
I $D(^XUSEC("EDPR ADHOC",DUZ))>0 D XML^EDPX("<auth name=""rptAdhoc"" />")
Q
ROLES ; set up roles
N ROLE S ROLE=0 ; TEMPORARY!!
I DUZ=20011 S ROLE=573
I DUZ=20014 S ROLE=272
I DUZ=20013 S ROLE=426
I DUZ=20028 S ROLE=623
I 'ROLE S ROLE=459
S X("id")=ROLE
S X("displayName")=$$CLNAME^USRLM(ROLE)
D XML^EDPX($$XMLA^EDPX("role",.X))
S IEN=$O(^EDPB(232.5,"C",EDPSITE,AREA,ROLE,0)) Q:'IEN
S BRD=$P(^EDPB(232.5,IEN,0),U,5)
D XML^EDPX("<board defaultName='"_BRD_"' />")
Q
; TODO: provide a mechanism to rebuild role list if AREA changes
N X,ROLE,IEN,BRD,DONE,ERR
S ROLE=0,DONE=0
F S ROLE=$O(^EDPB(232.5,"C",EDPSITE,AREA,ROLE)) Q:'ROLE D Q:DONE
. Q:'$$ISA^USRLM(DUZ,ROLE,.ERR,DT)
. S DONE=1
. S X("id")=ROLE
. S X("displayName")=$$CLNAME^USRLM(ROLE)
. D XML^EDPX($$XMLA^EDPX("role",.X))
. S IEN=$O(^EDPB(232.5,"C",EDPSITE,AREA,ROLE,0)) Q:'IEN
. S BRD=$P(^EDPB(232.5,IEN,0),U,5)
. D XML^EDPX("<board defaultName='"_BRD_"' />")
Q
SESS ; set up session -- (OLD from version 1?)
N X,TSIEN,ROLEIEN,ROLENM,ROLE,DFLTWSHT,DFLTBRD,DFLTROOM
S X("duz")=DUZ
S X("userNm")=$P($G(^VA(200,DUZ,0)),U)
S X("site")=DUZ(2)
S X("siteNm")=$$NAME^XUAF4(X("site"))
S X("station")=$$STA^XUAF4(DUZ(2))
S X("time")=$$NOW^XLFDT
S X("worksheets")=($D(^XUSEC("EDPF WORKSHEETS",DUZ))>0)
S X("rptExport")=($D(^XUSEC("EDPR EXPORT",DUZ))>0)
S X("rptProvider")=($D(^XUSEC("EDPR PROVIDER",DUZ))>0)
S X("rptXRef")=($D(^XUSEC("EDPR XREF",DUZ))>0)
S X("rptAdhoc")=($D(^XUSEC("EDPR ADHOC",DUZ))>0)
S X("progMode")=($D(^XUSEC("XUPROGMODE",DUZ))>0)
S X("version")=$$VERSRV^EDPQAR
;
;DRP Begin EDP*2.0*2 changes
; added line below
S X("icd10ActDate")=$$IMPDATE^EDPLEX("10D")
;End EDP*2.0*2 changes
;
; PATCH 6 - BWF - Adding 'defaultRoom' = true/false to identify wheteher or not a default room has been set.
S DFLTROOM=$$GET1^DIQ(231.9,AREA,1.12,"I")
S X("defaultRoom")=$S(DFLTROOM:"true",1:"false")
;
; This code to enable VEHU training.
;N AREA
;S AREA=$$GET^XPAR(DUZ_";VA(200,","EDPF USER AREA",1,"Q")
;I AREA S X("area")=AREA,X("areaNm")=$P($G(^EDPB(231.9,AREA,0)),U)
;
;TDP - Patch 2 change to use new EDIS timeout parameter
;S X("timeOut")=$$GET^XPAR("USR^DIV^SYS","ORWOR TIMEOUT CHART",1,"I")
S X("timeOut")=$$GET^XPAR("USR^DIV^SYS","EDP APP TIMEOUT",1,"I")
S:'X("timeOut") X("timeOut")=$$DTIME^XUP(DUZ)
S:'X("timeOut") X("timeOut")=300
S X("timeOut")=X("timeOut")*1000 ; milliseconds
;
;TDP - Patch 2 change to use new EDIS timeout countdown parameter
;S X("countDown")=$$GET^XPAR("USR^SYS^PKG","ORWOR TIMEOUT COUNTDOWN",1,"I")
S X("countDown")=$$GET^XPAR("USR^SYS^PKG","EDP APP COUNTDOWN",1,"I")
S:'X("countDown") X("countDown")=10
S X("countDown")=X("countDown")*1000 ; milliseconds
S TSIEN=$O(^EDPB(231.7,"B",DUZ,""))
I TSIEN S ROLEIEN=$$GET1^DIQ(231.7,TSIEN,.06,"I")
I $G(ROLEIEN) D
.S X("roleID")=ROLEIEN
.S ROLENM=$$GET1^DIQ(232.5,ROLEIEN,.01,"E"),X("roleName")=ROLENM
.S ROLE=$$GET1^DIQ(232.5,ROLEIEN,.02,"E"),X("roleAbbr")=ROLE
.S DFLTWSHT=$$GET1^DIQ(232.5,ROLEIEN,.04,"E"),X("defaultWorksheet")=DFLTWSHT
.S DFLTBRD=$$GET1^DIQ(232.5,ROLEIEN,.05,"I"),X("defaultBoard")=DFLTBRD
D XML^EDPX($$XMLA^EDPX("user",.X))
Q
SESSID() ; Return the next session identifier
; May lock any string, does not have to be actual global node
; Use ^XTMP("EDP... to assure uniqueness to this package
;
L +^XTMP("EDP-LOCK-SESSION-ID"):10 E Q 0
N X S X=$$GET^XPAR("PKG","EDPW SESSION ID",1,"I")+1
I X>4294967295 S X=1 ; wrap around if bigger than 32-bit uint
D EN^XPAR("PKG","EDPW SESSION ID",1,X)
L -^XTMP("EDP-LOCK-SESSION-ID")
Q X
;
VIEWS ; Return views allowed for this user
N I,X,ID
F I=1:1 S X=$P($T(OPTIONS+I),";",3,99) Q:X="zzzzz" D
. I $$ACCESS^XQCHK(DUZ,$$LKOPT^XPDMENU($P(X,U)))>0 D
. . D XML^EDPX($$XMLS^EDPX("view",$P(X,U,3),$P(X,U,2)))
Q
OPTIONS ;; options visible in Tracking System
;;EDPF TRACKING VIEW SIGNIN^Sign In^1
;;EDPF TRACKING VIEW TRIAGE^Triage^2
;;EDPF TRACKING VIEW UPDATE^Update^3
;;EDPF TRACKING VIEW DISPOSITION^Disposition^4
;;EDPF TRACKING VIEW EDIT CLOSED^Edit Closed^5
;;EDPF TRACKING VIEW BOARD^Display Board^6
;;EDPF TRACKING VIEW STAFF^Assign Staff^7
;;EDPF TRACKING VIEW REPORTS^Reports^8
;;EDPF TRACKING VIEW CONFIGURE^Configure^9
;;zzzzz
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEDPFAA 6573 printed Nov 22, 2024@17:01:57 Page 2
EDPFAA ;SLC/KCM - RPC Calls to Facility ;5/2/12 3:36pm
+1 ;;2.0;EMERGENCY DEPARTMENT;**6,2**;Feb 24, 2012;Build 23
+2 ;
BOOT(APP) ; bootstrap appliction
+1 DO USER
+2 DO APP(APP)
+3 QUIT
USER ; set bootstrap USER node
+1 NEW X,TSIEN,ROLEIEN,ROLE,ROLENM,DFLTBRD,DFLTWSHT
+2 SET X("duz")=DUZ
+3 SET X("userNm")=$PIECE($GET(^VA(200,DUZ,0)),U)
+4 SET X("timeOut")=$$GET^XPAR("USR^DIV^SYS","ORWOR TIMEOUT CHART",1,"I")
+5 if 'X("timeOut")
SET X("timeOut")=$$DTIME^XUP(DUZ)
+6 if 'X("timeOut")
SET X("timeOut")=300
+7 ; milliseconds
SET X("timeOut")=X("timeOut")*1000
+8 SET X("countDown")=$$GET^XPAR("USR^SYS^PKG","ORWOR TIMEOUT COUNTDOWN",1,"I")
+9 if 'X("countDown")
SET X("countDown")=10
+10 ; milliseconds
SET X("countDown")=X("countDown")*1000
+11 SET TSIEN=$ORDER(^EDPB(231.7,"B",DUZ,""))
+12 IF TSIEN
SET ROLEIEN=$ORDER(^EDPB(231.7,"AC",EDPSITE,AREA,TSIEN,""))
+13 IF $GET(ROLEIEN)
Begin DoDot:1
+14 SET X("roleID")=ROLEIEN
+15 SET ROLENM=$$GET1^DIQ(232.5,ROLEIEN,.01,"E")
SET X("roleName")=ROLENM
+16 SET ROLE=$$GET1^DIQ(232.5,ROLEIEN,.02,"E")
SET X("roleAbbr")=ROLE
+17 SET DFLTWSHT=$$GET1^DIQ(232.5,ROLEIEN,.04,"E")
SET X("defaultWorksheet")=DFLTWSHT
+18 SET DFLTBRD=$$GET1^DIQ(232.5,ROLEIEN,.05,"I")
SET X("defaultBoard")=DFLTBRD
+19 ; Gather all available worksheets for this role
+20 DO LDWSLIST^EDPBWS(EDPSITE,AREA,ROLEIEN)
End DoDot:1
+21 DO XML^EDPX($$XMLA^EDPX("user",.X,""))
+22 IF $DATA(^XUSEC("XUPROGMODE",DUZ))>0
DO XML^EDPX("<auth name=""debug"" />")
+23 DO XML^EDPX("</user>")
+24 QUIT
APP(APP) ; set bootstrap APP node
+1 NEW X,AREA
+2 SET X("name")=APP
+3 SET X("site")=DUZ(2)
+4 SET X("siteNm")=$$NAME^XUAF4(X("site"))
+5 SET X("station")=$$STA^XUAF4(DUZ(2))
+6 SET X("time")=$$NOW^XLFDT
+7 SET X("version")=$$VERSRV^EDPQAR
+8 SET X("vistaSession")=$$SESSID
+9 DO XML^EDPX($$XMLA^EDPX("app",.X,""))
+10 DO AREA
+11 IF APP="cpe-ui-reports"
DO RPTS
+12 IF APP="cpe-ui-care"
DO ROLES
+13 DO XML^EDPX("</app>")
+14 QUIT
AREA ; set default area node
+1 NEW X
+2 SET X("area")=$$DFLTAREA^EDPQAR("")
SET AREA=X("area")
+3 IF X("area")
SET X("areaNm")=$PIECE(^EDPB(231.9,X("area"),0),U)
+4 DO XML^EDPX($$XMLA^EDPX("defaultArea",.X))
+5 QUIT
RPTS ; set auth nodes for reports
+1 IF $DATA(^XUSEC("EDPR EXPORT",DUZ))>0
DO XML^EDPX("<auth name=""rptExport"" />")
+2 IF $DATA(^XUSEC("EDPR PROVIDER",DUZ))>0
DO XML^EDPX("<auth name=""rptProvider"" />")
+3 IF $DATA(^XUSEC("EDPR XREF",DUZ))>0
DO XML^EDPX("<auth name=""rptXRef"" />")
+4 IF $DATA(^XUSEC("EDPR ADHOC",DUZ))>0
DO XML^EDPX("<auth name=""rptAdhoc"" />")
+5 QUIT
ROLES ; set up roles
+1 ; TEMPORARY!!
NEW ROLE
SET ROLE=0
+2 IF DUZ=20011
SET ROLE=573
+3 IF DUZ=20014
SET ROLE=272
+4 IF DUZ=20013
SET ROLE=426
+5 IF DUZ=20028
SET ROLE=623
+6 IF 'ROLE
SET ROLE=459
+7 SET X("id")=ROLE
+8 SET X("displayName")=$$CLNAME^USRLM(ROLE)
+9 DO XML^EDPX($$XMLA^EDPX("role",.X))
+10 SET IEN=$ORDER(^EDPB(232.5,"C",EDPSITE,AREA,ROLE,0))
if 'IEN
QUIT
+11 SET BRD=$PIECE(^EDPB(232.5,IEN,0),U,5)
+12 DO XML^EDPX("<board defaultName='"_BRD_"' />")
+13 QUIT
+14 ; TODO: provide a mechanism to rebuild role list if AREA changes
+15 NEW X,ROLE,IEN,BRD,DONE,ERR
+16 SET ROLE=0
SET DONE=0
+17 FOR
SET ROLE=$ORDER(^EDPB(232.5,"C",EDPSITE,AREA,ROLE))
if 'ROLE
QUIT
Begin DoDot:1
+18 if '$$ISA^USRLM(DUZ,ROLE,.ERR,DT)
QUIT
+19 SET DONE=1
+20 SET X("id")=ROLE
+21 SET X("displayName")=$$CLNAME^USRLM(ROLE)
+22 DO XML^EDPX($$XMLA^EDPX("role",.X))
+23 SET IEN=$ORDER(^EDPB(232.5,"C",EDPSITE,AREA,ROLE,0))
if 'IEN
QUIT
+24 SET BRD=$PIECE(^EDPB(232.5,IEN,0),U,5)
+25 DO XML^EDPX("<board defaultName='"_BRD_"' />")
End DoDot:1
if DONE
QUIT
+26 QUIT
SESS ; set up session -- (OLD from version 1?)
+1 NEW X,TSIEN,ROLEIEN,ROLENM,ROLE,DFLTWSHT,DFLTBRD,DFLTROOM
+2 SET X("duz")=DUZ
+3 SET X("userNm")=$PIECE($GET(^VA(200,DUZ,0)),U)
+4 SET X("site")=DUZ(2)
+5 SET X("siteNm")=$$NAME^XUAF4(X("site"))
+6 SET X("station")=$$STA^XUAF4(DUZ(2))
+7 SET X("time")=$$NOW^XLFDT
+8 SET X("worksheets")=($DATA(^XUSEC("EDPF WORKSHEETS",DUZ))>0)
+9 SET X("rptExport")=($DATA(^XUSEC("EDPR EXPORT",DUZ))>0)
+10 SET X("rptProvider")=($DATA(^XUSEC("EDPR PROVIDER",DUZ))>0)
+11 SET X("rptXRef")=($DATA(^XUSEC("EDPR XREF",DUZ))>0)
+12 SET X("rptAdhoc")=($DATA(^XUSEC("EDPR ADHOC",DUZ))>0)
+13 SET X("progMode")=($DATA(^XUSEC("XUPROGMODE",DUZ))>0)
+14 SET X("version")=$$VERSRV^EDPQAR
+15 ;
+16 ;DRP Begin EDP*2.0*2 changes
+17 ; added line below
+18 SET X("icd10ActDate")=$$IMPDATE^EDPLEX("10D")
+19 ;End EDP*2.0*2 changes
+20 ;
+21 ; PATCH 6 - BWF - Adding 'defaultRoom' = true/false to identify wheteher or not a default room has been set.
+22 SET DFLTROOM=$$GET1^DIQ(231.9,AREA,1.12,"I")
+23 SET X("defaultRoom")=$SELECT(DFLTROOM:"true",1:"false")
+24 ;
+25 ; This code to enable VEHU training.
+26 ;N AREA
+27 ;S AREA=$$GET^XPAR(DUZ_";VA(200,","EDPF USER AREA",1,"Q")
+28 ;I AREA S X("area")=AREA,X("areaNm")=$P($G(^EDPB(231.9,AREA,0)),U)
+29 ;
+30 ;TDP - Patch 2 change to use new EDIS timeout parameter
+31 ;S X("timeOut")=$$GET^XPAR("USR^DIV^SYS","ORWOR TIMEOUT CHART",1,"I")
+32 SET X("timeOut")=$$GET^XPAR("USR^DIV^SYS","EDP APP TIMEOUT",1,"I")
+33 if 'X("timeOut")
SET X("timeOut")=$$DTIME^XUP(DUZ)
+34 if 'X("timeOut")
SET X("timeOut")=300
+35 ; milliseconds
SET X("timeOut")=X("timeOut")*1000
+36 ;
+37 ;TDP - Patch 2 change to use new EDIS timeout countdown parameter
+38 ;S X("countDown")=$$GET^XPAR("USR^SYS^PKG","ORWOR TIMEOUT COUNTDOWN",1,"I")
+39 SET X("countDown")=$$GET^XPAR("USR^SYS^PKG","EDP APP COUNTDOWN",1,"I")
+40 if 'X("countDown")
SET X("countDown")=10
+41 ; milliseconds
SET X("countDown")=X("countDown")*1000
+42 SET TSIEN=$ORDER(^EDPB(231.7,"B",DUZ,""))
+43 IF TSIEN
SET ROLEIEN=$$GET1^DIQ(231.7,TSIEN,.06,"I")
+44 IF $GET(ROLEIEN)
Begin DoDot:1
+45 SET X("roleID")=ROLEIEN
+46 SET ROLENM=$$GET1^DIQ(232.5,ROLEIEN,.01,"E")
SET X("roleName")=ROLENM
+47 SET ROLE=$$GET1^DIQ(232.5,ROLEIEN,.02,"E")
SET X("roleAbbr")=ROLE
+48 SET DFLTWSHT=$$GET1^DIQ(232.5,ROLEIEN,.04,"E")
SET X("defaultWorksheet")=DFLTWSHT
+49 SET DFLTBRD=$$GET1^DIQ(232.5,ROLEIEN,.05,"I")
SET X("defaultBoard")=DFLTBRD
End DoDot:1
+50 DO XML^EDPX($$XMLA^EDPX("user",.X))
+51 QUIT
SESSID() ; Return the next session identifier
+1 ; May lock any string, does not have to be actual global node
+2 ; Use ^XTMP("EDP... to assure uniqueness to this package
+3 ;
+4 LOCK +^XTMP("EDP-LOCK-SESSION-ID"):10
IF '$TEST
QUIT 0
+5 NEW X
SET X=$$GET^XPAR("PKG","EDPW SESSION ID",1,"I")+1
+6 ; wrap around if bigger than 32-bit uint
IF X>4294967295
SET X=1
+7 DO EN^XPAR("PKG","EDPW SESSION ID",1,X)
+8 LOCK -^XTMP("EDP-LOCK-SESSION-ID")
+9 QUIT X
+10 ;
VIEWS ; Return views allowed for this user
+1 NEW I,X,ID
+2 FOR I=1:1
SET X=$PIECE($TEXT(OPTIONS+I),";",3,99)
if X="zzzzz"
QUIT
Begin DoDot:1
+3 IF $$ACCESS^XQCHK(DUZ,$$LKOPT^XPDMENU($PIECE(X,U)))>0
Begin DoDot:2
+4 DO XML^EDPX($$XMLS^EDPX("view",$PIECE(X,U,3),$PIECE(X,U,2)))
End DoDot:2
End DoDot:1
+5 QUIT
OPTIONS ;; options visible in Tracking System
+1 ;;EDPF TRACKING VIEW SIGNIN^Sign In^1
+2 ;;EDPF TRACKING VIEW TRIAGE^Triage^2
+3 ;;EDPF TRACKING VIEW UPDATE^Update^3
+4 ;;EDPF TRACKING VIEW DISPOSITION^Disposition^4
+5 ;;EDPF TRACKING VIEW EDIT CLOSED^Edit Closed^5
+6 ;;EDPF TRACKING VIEW BOARD^Display Board^6
+7 ;;EDPF TRACKING VIEW STAFF^Assign Staff^7
+8 ;;EDPF TRACKING VIEW REPORTS^Reports^8
+9 ;;EDPF TRACKING VIEW CONFIGURE^Configure^9
+10 ;;zzzzz