PXEXMGR ;SLC/PKR - List Manager routines for Exams. ;06/20/2018
;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
;
;=========================================
ADD ;Add a new entry.
D CLEAR^VALM1
N DA,DIC,DLAYGO,DTOUT,DUOUT,NEW,TEXT,Y
S DIC="^AUTTEXAM("
S DIC(0)="AEKLQ"
S DIC("A")="Enter a new Exam Name: "
S DLAYGO=9999999.15
D ^DIC
I ($D(DTOUT))!($D(DUOUT))!(Y=-1) S VALMBCK="R" Q
S NEW=$P(Y,U,3)
I 'NEW D G ADD
. S TEXT(1)=$P(Y,U,2)_" already exists, choose a different name or use the EDIT action to edit that entry."
. S TEXT(2)=""
. D EN^DDIOL(.TEXT)
. H 3
I NEW D
. S DA=$P(Y,U,1)
. D SMANEDIT^PXEXSM(DA,1)
S VALMBCK="R"
Q
;
;=========================================
BLDLIST(NODE) ;Build of list of Exam file entries.
N IEN,DESC,NAME
K ^TMP(NODE,$J)
;Build the list in alphabetical order.
S NAME="",VALMCNT=0
F S NAME=$O(^AUTTEXAM("B",NAME)) Q:NAME="" D
. S IEN=$O(^AUTTEXAM("B",NAME,""))
. S VALMCNT=VALMCNT+1
. S ^TMP(NODE,$J,"SEL",VALMCNT)=IEN
. S ^TMP(NODE,$J,"IEN",IEN)=VALMCNT
. S DESC=$G(^AUTTEXAM(IEN,201,1,0))
. S ^TMP(NODE,$J,VALMCNT,0)=$$FORMAT(VALMCNT,NAME,DESC)
. S ^TMP(NODE,$J,"IDX",VALMCNT,VALMCNT)=""
. S ^TMP(NODE,$J,"LINES",VALMCNT)=VALMCNT_U_VALMCNT
S ^TMP(NODE,$J,"VALMCNT")=VALMCNT
S ^TMP(NODE,$J,"NEXAM")=VALMCNT
Q
;
;=========================================
CLOG(IEN) ;Display the change log.
D LMCLBROW^PXSINQ(9999999.15,"110*",IEN)
Q
;
;=========================================
CLOGS ;Display Change Log for a selected entry.
N IEN
;Get the entry
S IEN=+$$GETSEL("Display the change log for which exam?")
S VALMBCK="R"
I IEN=0 S VALMBCK="R" Q
D CLOG(IEN)
S VALMBCK="R"
Q
;
;=========================================
COPY(IEN) ;Copy a selected entry to a new name.
D FULL^VALM1
D COPY^PXCOPY(9999999.15,IEN)
D BLDLIST^PXEXMGR("PXEXAML")
S VALMBCK="R"
Q
;
;=========================================
COPYS ;Copy a selected entry.
N IEN
;Get the entry
S IEN=+$$GETSEL("Select exam to copy")
I IEN=0 S VALMBCK="R" Q
D COPY(IEN)
Q
;
;=========================================
EDITS ;Edit a selected entry.
S VALMBCK="R"
N CLASS,IEN
;Get the entry
S IEN=+$$GETSEL("Select the exam to edit")
I IEN=0 S VALMBCK="R" Q
D SMANEDIT^PXEXSM(IEN,0)
Q
;
;=========================================
ENTRY ;Entry code
D INITMPG^PXEXMGR
D BLDLIST^PXEXMGR("PXEXAML")
D XQORM
Q
;
;=========================================
EXIT ;Exit code
D INITMPG^PXEXMGR
D CLEAN^VALM10
D FULL^VALM1
S VALMBCK="Q"
Q
;
;=========================================
FORMAT(NUMBER,NAME,DESC) ;Format entry number, name, and first line of
;description for LM display.
N TEXT,TDESC,TNAME
S TNAME=$S($L(NAME)<56:NAME,1:$E(NAME,1,52)_"...")
S TEXT=$$RJ^XLFSTR(NUMBER,5," ")_" "_TNAME
S TDESC=$S(DESC="":"",$L(DESC)<17:DESC,1:$E(DESC,1,13)_"...")
I TDESC'="" S TEXT=TEXT_$$REPEAT^XLFSTR(" ",(63-$L(TEXT)))_TDESC
Q TEXT
;
;=========================================
GETSEL(TEXT) ;Get a single selection
N DIR,NEXAM,X,Y
S NEXAM=+$G(^TMP("PXEXAML",$J,"NEXAM"))
I NEXAM=0 Q 0
S DIR(0)="N^1:"_NEXAM
S DIR("A")=TEXT
D ^DIR
Q +$G(^TMP("PXEXAML",$J,"SEL",+Y))
;
;=========================================
HELP ;Display help.
N DDS,DIR0,DONE,IND,TEXT
;DBIA #5746 covers kill and set of DDS. DDS needs to be set or the
;Browser will kill some ScreenMan variables.
S DDS=1,DONE=0
F IND=1:1 Q:DONE D
. S TEXT(IND)=$P($T(HTEXT+IND),";",3,99)
. I TEXT(IND)="**End Text**" K TEXT(IND) S DONE=1 Q
D BROWSE^DDBR("TEXT","NR","Exam Management Help")
S VALMBCK="R"
Q
;
;=========================================
HDR ; Header code
S VALMHDR(1)="Exam File Entries."
S VALMSG="+ Next Screen - Prev Screen ?? More Actions"
Q
;
;=========================================
HTEXT ;Exam management help text.
;;Select one of the following actions:
;; ADD - add a new exam.
;; EDIT - edit an exam.
;; COPY - copy an existing exam to a new exam.
;; INQ - exam inquiry.
;; CL - exam change log display.
;;
;;You can select the action first and then the entry or choose the entry and then
;;the action.
;;
;;**End Text**
Q
;
;=========================================
INITMPG ;Initialize all the ^TMP globals.
K ^TMP("PXEXAML",$J)
Q
;
;=========================================
INQ(IEN) ;Exam inquiry.
S VALMBCK="R"
D BEXINQ^PXEXINQ(IEN)
Q
;
;=========================================
INQS ;Display inquiry for selected entries.
S VALMBCK="R"
N IEN
;Get the entry
S IEN=+$$GETSEL("Display inquiry for which exam?")
I IEN=0 S VALMBCK="R" Q
D INQ(IEN)
S VALMBCK="R"
Q
;
;=========================================
ISMAPPED(IEN) ;Return 1 if the exam has mapped codes.
I +$P($G(^AUTTEXAM(IEN,210,0)),U,4)>0 Q 1
Q 0
;
;=========================================
PEXIT ; Protocol exit code
S VALMSG="+ Next Screen - Prev Screen ?? More Actions"
;Reset after page up/down etc
D XQORM
Q
;
;=========================================
START ;Main entry point for PX Exam Management
N VALMBCK,VALMSG,X
S X="IORESET"
D ENDR^%ZISS
D EN^VALM("PX EXAM MANAGEMENT")
W IORESET
D KILL^%ZISS
Q
;
;=========================================
XQORM ;Set range for selection.
N NEXAM
S NEXAM=^TMP("PXEXAML",$J,"NEXAM")
S XQORM("#")=$O(^ORD(101,"B","PX EXAM SELECT ENTRY",0))_U_"1:"_NEXAM
S XQORM("A")="Select Action: "
Q
;
;=========================================
XSEL ;Entry action for protocol PX EXAM SELECT ENTRY.
N CLASS,EDITOK,IEN,SEL
S SEL=$P(XQORNOD(0),"=",2)
;Remove trailing ,
I $E(SEL,$L(SEL))="," S SEL=$E(SEL,1,$L(SEL)-1)
;Invalid selection
I SEL["," D Q
. W !,"Only one item number allowed." H 2
. S VALMBCK="R"
I ('SEL)!(SEL>VALMCNT)!('$D(@VALMAR@("SEL",SEL))) D Q
. W !,SEL_" is not a valid item number." H 2
. S VALMBCK="R"
;
;Get the IEN.
S IEN=^TMP("PXEXAML",$J,"SEL",SEL)
S CLASS=$P(^AUTTEXAM(IEN,100),U,1)
;
;Full screen mode
D FULL^VALM1
;
;Action list.
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,OPTION,X,Y
S DIR(0)="SBM"_U
S EDITOK=$S(CLASS'="N":1,1:($G(PXNAT)=1)&($G(DUZ(0))="@"))
I EDITOK S DIR(0)=DIR(0)_"EDIT:Edit;"
S DIR(0)=DIR(0)_"COPY:Copy;"
S DIR(0)=DIR(0)_"INQ:Inquire;"
S DIR(0)=DIR(0)_"CL:Change Log;"
S DIR("A")="Select Action: "
S DIR("B")=$S(CLASS="N":"INQ",1:"EDIT")
S DIR("?")="Select from the actions displayed."
D ^DIR
I $D(DIROUT)!$D(DIRUT) S VALMBCK="R" Q
I $D(DTOUT)!$D(DUOUT) S VALMBCK="R" Q
S OPTION=Y
D CLEAR^VALM1
;
I OPTION="COPY" D COPY^PXEXMGR(IEN)
I OPTION="EDIT" D SMANEDIT^PXEXSM(IEN,0)
I OPTION="INQ" D BEXINQ^PXEXINQ(IEN)
I OPTION="CL" D CLOG^PXEXMGR(IEN)
S VALMBCK="R"
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXEXMGR 6866 printed Dec 13, 2024@02:28:50 Page 2
PXEXMGR ;SLC/PKR - List Manager routines for Exams. ;06/20/2018
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
+2 ;
+3 ;=========================================
ADD ;Add a new entry.
+1 DO CLEAR^VALM1
+2 NEW DA,DIC,DLAYGO,DTOUT,DUOUT,NEW,TEXT,Y
+3 SET DIC="^AUTTEXAM("
+4 SET DIC(0)="AEKLQ"
+5 SET DIC("A")="Enter a new Exam Name: "
+6 SET DLAYGO=9999999.15
+7 DO ^DIC
+8 IF ($DATA(DTOUT))!($DATA(DUOUT))!(Y=-1)
SET VALMBCK="R"
QUIT
+9 SET NEW=$PIECE(Y,U,3)
+10 IF 'NEW
Begin DoDot:1
+11 SET TEXT(1)=$PIECE(Y,U,2)_" already exists, choose a different name or use the EDIT action to edit that entry."
+12 SET TEXT(2)=""
+13 DO EN^DDIOL(.TEXT)
+14 HANG 3
End DoDot:1
GOTO ADD
+15 IF NEW
Begin DoDot:1
+16 SET DA=$PIECE(Y,U,1)
+17 DO SMANEDIT^PXEXSM(DA,1)
End DoDot:1
+18 SET VALMBCK="R"
+19 QUIT
+20 ;
+21 ;=========================================
BLDLIST(NODE) ;Build of list of Exam file entries.
+1 NEW IEN,DESC,NAME
+2 KILL ^TMP(NODE,$JOB)
+3 ;Build the list in alphabetical order.
+4 SET NAME=""
SET VALMCNT=0
+5 FOR
SET NAME=$ORDER(^AUTTEXAM("B",NAME))
if NAME=""
QUIT
Begin DoDot:1
+6 SET IEN=$ORDER(^AUTTEXAM("B",NAME,""))
+7 SET VALMCNT=VALMCNT+1
+8 SET ^TMP(NODE,$JOB,"SEL",VALMCNT)=IEN
+9 SET ^TMP(NODE,$JOB,"IEN",IEN)=VALMCNT
+10 SET DESC=$GET(^AUTTEXAM(IEN,201,1,0))
+11 SET ^TMP(NODE,$JOB,VALMCNT,0)=$$FORMAT(VALMCNT,NAME,DESC)
+12 SET ^TMP(NODE,$JOB,"IDX",VALMCNT,VALMCNT)=""
+13 SET ^TMP(NODE,$JOB,"LINES",VALMCNT)=VALMCNT_U_VALMCNT
End DoDot:1
+14 SET ^TMP(NODE,$JOB,"VALMCNT")=VALMCNT
+15 SET ^TMP(NODE,$JOB,"NEXAM")=VALMCNT
+16 QUIT
+17 ;
+18 ;=========================================
CLOG(IEN) ;Display the change log.
+1 DO LMCLBROW^PXSINQ(9999999.15,"110*",IEN)
+2 QUIT
+3 ;
+4 ;=========================================
CLOGS ;Display Change Log for a selected entry.
+1 NEW IEN
+2 ;Get the entry
+3 SET IEN=+$$GETSEL("Display the change log for which exam?")
+4 SET VALMBCK="R"
+5 IF IEN=0
SET VALMBCK="R"
QUIT
+6 DO CLOG(IEN)
+7 SET VALMBCK="R"
+8 QUIT
+9 ;
+10 ;=========================================
COPY(IEN) ;Copy a selected entry to a new name.
+1 DO FULL^VALM1
+2 DO COPY^PXCOPY(9999999.15,IEN)
+3 DO BLDLIST^PXEXMGR("PXEXAML")
+4 SET VALMBCK="R"
+5 QUIT
+6 ;
+7 ;=========================================
COPYS ;Copy a selected entry.
+1 NEW IEN
+2 ;Get the entry
+3 SET IEN=+$$GETSEL("Select exam to copy")
+4 IF IEN=0
SET VALMBCK="R"
QUIT
+5 DO COPY(IEN)
+6 QUIT
+7 ;
+8 ;=========================================
EDITS ;Edit a selected entry.
+1 SET VALMBCK="R"
+2 NEW CLASS,IEN
+3 ;Get the entry
+4 SET IEN=+$$GETSEL("Select the exam to edit")
+5 IF IEN=0
SET VALMBCK="R"
QUIT
+6 DO SMANEDIT^PXEXSM(IEN,0)
+7 QUIT
+8 ;
+9 ;=========================================
ENTRY ;Entry code
+1 DO INITMPG^PXEXMGR
+2 DO BLDLIST^PXEXMGR("PXEXAML")
+3 DO XQORM
+4 QUIT
+5 ;
+6 ;=========================================
EXIT ;Exit code
+1 DO INITMPG^PXEXMGR
+2 DO CLEAN^VALM10
+3 DO FULL^VALM1
+4 SET VALMBCK="Q"
+5 QUIT
+6 ;
+7 ;=========================================
FORMAT(NUMBER,NAME,DESC) ;Format entry number, name, and first line of
+1 ;description for LM display.
+2 NEW TEXT,TDESC,TNAME
+3 SET TNAME=$SELECT($LENGTH(NAME)<56:NAME,1:$EXTRACT(NAME,1,52)_"...")
+4 SET TEXT=$$RJ^XLFSTR(NUMBER,5," ")_" "_TNAME
+5 SET TDESC=$SELECT(DESC="":"",$LENGTH(DESC)<17:DESC,1:$EXTRACT(DESC,1,13)_"...")
+6 IF TDESC'=""
SET TEXT=TEXT_$$REPEAT^XLFSTR(" ",(63-$LENGTH(TEXT)))_TDESC
+7 QUIT TEXT
+8 ;
+9 ;=========================================
GETSEL(TEXT) ;Get a single selection
+1 NEW DIR,NEXAM,X,Y
+2 SET NEXAM=+$GET(^TMP("PXEXAML",$JOB,"NEXAM"))
+3 IF NEXAM=0
QUIT 0
+4 SET DIR(0)="N^1:"_NEXAM
+5 SET DIR("A")=TEXT
+6 DO ^DIR
+7 QUIT +$GET(^TMP("PXEXAML",$JOB,"SEL",+Y))
+8 ;
+9 ;=========================================
HELP ;Display help.
+1 NEW DDS,DIR0,DONE,IND,TEXT
+2 ;DBIA #5746 covers kill and set of DDS. DDS needs to be set or the
+3 ;Browser will kill some ScreenMan variables.
+4 SET DDS=1
SET DONE=0
+5 FOR IND=1:1
if DONE
QUIT
Begin DoDot:1
+6 SET TEXT(IND)=$PIECE($TEXT(HTEXT+IND),";",3,99)
+7 IF TEXT(IND)="**End Text**"
KILL TEXT(IND)
SET DONE=1
QUIT
End DoDot:1
+8 DO BROWSE^DDBR("TEXT","NR","Exam Management Help")
+9 SET VALMBCK="R"
+10 QUIT
+11 ;
+12 ;=========================================
HDR ; Header code
+1 SET VALMHDR(1)="Exam File Entries."
+2 SET VALMSG="+ Next Screen - Prev Screen ?? More Actions"
+3 QUIT
+4 ;
+5 ;=========================================
HTEXT ;Exam management help text.
+1 ;;Select one of the following actions:
+2 ;; ADD - add a new exam.
+3 ;; EDIT - edit an exam.
+4 ;; COPY - copy an existing exam to a new exam.
+5 ;; INQ - exam inquiry.
+6 ;; CL - exam change log display.
+7 ;;
+8 ;;You can select the action first and then the entry or choose the entry and then
+9 ;;the action.
+10 ;;
+11 ;;**End Text**
+12 QUIT
+13 ;
+14 ;=========================================
INITMPG ;Initialize all the ^TMP globals.
+1 KILL ^TMP("PXEXAML",$JOB)
+2 QUIT
+3 ;
+4 ;=========================================
INQ(IEN) ;Exam inquiry.
+1 SET VALMBCK="R"
+2 DO BEXINQ^PXEXINQ(IEN)
+3 QUIT
+4 ;
+5 ;=========================================
INQS ;Display inquiry for selected entries.
+1 SET VALMBCK="R"
+2 NEW IEN
+3 ;Get the entry
+4 SET IEN=+$$GETSEL("Display inquiry for which exam?")
+5 IF IEN=0
SET VALMBCK="R"
QUIT
+6 DO INQ(IEN)
+7 SET VALMBCK="R"
+8 QUIT
+9 ;
+10 ;=========================================
ISMAPPED(IEN) ;Return 1 if the exam has mapped codes.
+1 IF +$PIECE($GET(^AUTTEXAM(IEN,210,0)),U,4)>0
QUIT 1
+2 QUIT 0
+3 ;
+4 ;=========================================
PEXIT ; Protocol exit code
+1 SET VALMSG="+ Next Screen - Prev Screen ?? More Actions"
+2 ;Reset after page up/down etc
+3 DO XQORM
+4 QUIT
+5 ;
+6 ;=========================================
START ;Main entry point for PX Exam Management
+1 NEW VALMBCK,VALMSG,X
+2 SET X="IORESET"
+3 DO ENDR^%ZISS
+4 DO EN^VALM("PX EXAM MANAGEMENT")
+5 WRITE IORESET
+6 DO KILL^%ZISS
+7 QUIT
+8 ;
+9 ;=========================================
XQORM ;Set range for selection.
+1 NEW NEXAM
+2 SET NEXAM=^TMP("PXEXAML",$JOB,"NEXAM")
+3 SET XQORM("#")=$ORDER(^ORD(101,"B","PX EXAM SELECT ENTRY",0))_U_"1:"_NEXAM
+4 SET XQORM("A")="Select Action: "
+5 QUIT
+6 ;
+7 ;=========================================
XSEL ;Entry action for protocol PX EXAM SELECT ENTRY.
+1 NEW CLASS,EDITOK,IEN,SEL
+2 SET SEL=$PIECE(XQORNOD(0),"=",2)
+3 ;Remove trailing ,
+4 IF $EXTRACT(SEL,$LENGTH(SEL))=","
SET SEL=$EXTRACT(SEL,1,$LENGTH(SEL)-1)
+5 ;Invalid selection
+6 IF SEL[","
Begin DoDot:1
+7 WRITE !,"Only one item number allowed."
HANG 2
+8 SET VALMBCK="R"
End DoDot:1
QUIT
+9 IF ('SEL)!(SEL>VALMCNT)!('$DATA(@VALMAR@("SEL",SEL)))
Begin DoDot:1
+10 WRITE !,SEL_" is not a valid item number."
HANG 2
+11 SET VALMBCK="R"
End DoDot:1
QUIT
+12 ;
+13 ;Get the IEN.
+14 SET IEN=^TMP("PXEXAML",$JOB,"SEL",SEL)
+15 SET CLASS=$PIECE(^AUTTEXAM(IEN,100),U,1)
+16 ;
+17 ;Full screen mode
+18 DO FULL^VALM1
+19 ;
+20 ;Action list.
+21 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,OPTION,X,Y
+22 SET DIR(0)="SBM"_U
+23 SET EDITOK=$SELECT(CLASS'="N":1,1:($GET(PXNAT)=1)&($GET(DUZ(0))="@"))
+24 IF EDITOK
SET DIR(0)=DIR(0)_"EDIT:Edit;"
+25 SET DIR(0)=DIR(0)_"COPY:Copy;"
+26 SET DIR(0)=DIR(0)_"INQ:Inquire;"
+27 SET DIR(0)=DIR(0)_"CL:Change Log;"
+28 SET DIR("A")="Select Action: "
+29 SET DIR("B")=$SELECT(CLASS="N":"INQ",1:"EDIT")
+30 SET DIR("?")="Select from the actions displayed."
+31 DO ^DIR
+32 IF $DATA(DIROUT)!$DATA(DIRUT)
SET VALMBCK="R"
QUIT
+33 IF $DATA(DTOUT)!$DATA(DUOUT)
SET VALMBCK="R"
QUIT
+34 SET OPTION=Y
+35 DO CLEAR^VALM1
+36 ;
+37 IF OPTION="COPY"
DO COPY^PXEXMGR(IEN)
+38 IF OPTION="EDIT"
DO SMANEDIT^PXEXSM(IEN,0)
+39 IF OPTION="INQ"
DO BEXINQ^PXEXINQ(IEN)
+40 IF OPTION="CL"
DO CLOG^PXEXMGR(IEN)
+41 SET VALMBCK="R"
+42 QUIT
+43 ;