GMTSPSCK ;PBM/RMS - MED RECONCILIATION CONFIGURATION CHECKER ;Jun 07, 2018@21:40
;;2.7;Health Summary;**94**;Oct 20, 1995;Build 41
;
EN1 ; Main entry point
N ASK,IDX,IDX1,IDX2,ORDER,REC,NAME,COMP,HAVET,HAVE1,HAVE2,HAVE3,FAILS
S HAVE1=0,HAVE2=0,HAVE3=0,HAVET=0
S FAILS=""
W !,"Checking for TYPE 'Essential Med List for Review' ..."
S IDX="" F S IDX=$O(^GMT(142,IDX)) Q:IDX="" D
. S NAME=$P($G(^GMT(142,IDX,0)),U,1)
. I NAME="Essential Med List for Review" D
.. S HAVET=1
.. W " OK",!
.. S IDX1=0 F S IDX1=$O(^GMT(142,IDX,1,IDX1)) Q:IDX1="" D
... S REC=$G(^GMT(142,IDX,1,IDX1,0))
... I REC'="" D
.... S ORDER=$P(REC,U,1)
.... S IDX2=$P(REC,U,2)
.... S COMP=$$GETCOMP(IDX2)
.... I COMP'="" D
..... I $P(COMP,U,1)="Allergies/ADRs (Tool #5)" S HAVE1=1
..... I $P(COMP,U,1)="Med. Reconciliation (Tool #1)" S HAVE2=1
..... I $P(COMP,U,1)="Med Recon NoGlossary (Tool #1)" S HAVE3=1
.... E D
..... W " FAIL (Component not found)",!
. I HAVET Q
I 'HAVET D
. W " FAIL (Missing)",!
E D
. W "Checking for COMPONENT 'Allergies/ADRs (Tool #5)' configured in TYPE ..."
. I HAVE1 W " OK",!
. E W !?5," FAIL (Missing)",!
. W "Checking Tool #1 COMPONENTs to Verify One (and Only One) is Present ...",!
. W "Checking for COMPONENT 'Med. Reconciliation (Tool #1)' configured in TYPE ...",!
. W "Checking for COMPONENT 'Med Recon NoGlossary (Tool #1)' configured in TYPE ..."
. I HAVE2,'HAVE3 W " OK",!
. I 'HAVE2,HAVE3 W " OK",!
. I HAVE2,HAVE3 W !?5," FAIL (Can't have both MRT1 & MRR1 Tool #1 COMPONENTs)"
. I 'HAVE2,'HAVE3 W !?5," FAIL (Missing One)",!
W !!,"Press <Return> to Continue..." R ASK:300
Q
;-------------------------------------------------------------
; GETCOMP - Retrieves a single Health Summary Component by IEN
; Parameters: IEN - IEN of HS component
; Returns: REC - parts 1,2,4 from HS component record
GETCOMP(IEN) ;
N REC
S REC=$G(^GMT(142.1,IEN,0))
I REC'="" D
. S REC=$P(REC,U,1)_U_$P(REC,U,2)_U_$P(REC,U,4)
Q REC
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPSCK 2031 printed Dec 13, 2024@01:59:30 Page 2
GMTSPSCK ;PBM/RMS - MED RECONCILIATION CONFIGURATION CHECKER ;Jun 07, 2018@21:40
+1 ;;2.7;Health Summary;**94**;Oct 20, 1995;Build 41
+2 ;
EN1 ; Main entry point
+1 NEW ASK,IDX,IDX1,IDX2,ORDER,REC,NAME,COMP,HAVET,HAVE1,HAVE2,HAVE3,FAILS
+2 SET HAVE1=0
SET HAVE2=0
SET HAVE3=0
SET HAVET=0
+3 SET FAILS=""
+4 WRITE !,"Checking for TYPE 'Essential Med List for Review' ..."
+5 SET IDX=""
FOR
SET IDX=$ORDER(^GMT(142,IDX))
if IDX=""
QUIT
Begin DoDot:1
+6 SET NAME=$PIECE($GET(^GMT(142,IDX,0)),U,1)
+7 IF NAME="Essential Med List for Review"
Begin DoDot:2
+8 SET HAVET=1
+9 WRITE " OK",!
+10 SET IDX1=0
FOR
SET IDX1=$ORDER(^GMT(142,IDX,1,IDX1))
if IDX1=""
QUIT
Begin DoDot:3
+11 SET REC=$GET(^GMT(142,IDX,1,IDX1,0))
+12 IF REC'=""
Begin DoDot:4
+13 SET ORDER=$PIECE(REC,U,1)
+14 SET IDX2=$PIECE(REC,U,2)
+15 SET COMP=$$GETCOMP(IDX2)
+16 IF COMP'=""
Begin DoDot:5
+17 IF $PIECE(COMP,U,1)="Allergies/ADRs (Tool #5)"
SET HAVE1=1
+18 IF $PIECE(COMP,U,1)="Med. Reconciliation (Tool #1)"
SET HAVE2=1
+19 IF $PIECE(COMP,U,1)="Med Recon NoGlossary (Tool #1)"
SET HAVE3=1
End DoDot:5
+20 IF '$TEST
Begin DoDot:5
+21 WRITE " FAIL (Component not found)",!
End DoDot:5
End DoDot:4
End DoDot:3
End DoDot:2
+22 IF HAVET
QUIT
End DoDot:1
+23 IF 'HAVET
Begin DoDot:1
+24 WRITE " FAIL (Missing)",!
End DoDot:1
+25 IF '$TEST
Begin DoDot:1
+26 WRITE "Checking for COMPONENT 'Allergies/ADRs (Tool #5)' configured in TYPE ..."
+27 IF HAVE1
WRITE " OK",!
+28 IF '$TEST
WRITE !?5," FAIL (Missing)",!
+29 WRITE "Checking Tool #1 COMPONENTs to Verify One (and Only One) is Present ...",!
+30 WRITE "Checking for COMPONENT 'Med. Reconciliation (Tool #1)' configured in TYPE ...",!
+31 WRITE "Checking for COMPONENT 'Med Recon NoGlossary (Tool #1)' configured in TYPE ..."
+32 IF HAVE2
IF 'HAVE3
WRITE " OK",!
+33 IF 'HAVE2
IF HAVE3
WRITE " OK",!
+34 IF HAVE2
IF HAVE3
WRITE !?5," FAIL (Can't have both MRT1 & MRR1 Tool #1 COMPONENTs)"
+35 IF 'HAVE2
IF 'HAVE3
WRITE !?5," FAIL (Missing One)",!
End DoDot:1
+36 WRITE !!,"Press <Return> to Continue..."
READ ASK:300
+37 QUIT
+38 ;-------------------------------------------------------------
+39 ; GETCOMP - Retrieves a single Health Summary Component by IEN
+40 ; Parameters: IEN - IEN of HS component
+41 ; Returns: REC - parts 1,2,4 from HS component record
GETCOMP(IEN) ;
+1 NEW REC
+2 SET REC=$GET(^GMT(142.1,IEN,0))
+3 IF REC'=""
Begin DoDot:1
+4 SET REC=$PIECE(REC,U,1)_U_$PIECE(REC,U,2)_U_$PIECE(REC,U,4)
End DoDot:1
+5 QUIT REC