PXRMRPCB ; SLC/PJH - Functions returning REMINDER data ;29-Feb-2012 09:26;DU
;;2.0;CLINICAL REMINDERS;**1001**;Feb 04, 2005;Build 21
;IHS/MSC/MGH Patch 1001 Field numbers changed to reflect differences from VA
Q
;
EDL(ORY,OREM) ;return list of education topics for a reminder
; ien^name^print name
;
N DATA,EDIEN,EDNAME,EDPNAM,FIND,ELIST,OCNT,SUB
S SUB=0,OCNT=0
F S SUB=$O(^PXD(811.9,OREM,20,SUB)) Q:'SUB D
.S FIND=$P($G(^PXD(811.9,OREM,20,SUB,0)),U)
.I $P(FIND,";",2)="AUTTEDT(" D EDTP(FIND) Q
.I $P(FIND,";",2)="PXRMD(811.5," D EDTERM($P(FIND,";")) Q
Q
;
EDTERM(TERM) ;Get any education topics on the reminder term
N TSUB,TFIND
S TSUB=0
F S TSUB=$O(^PXRMD(811.5,TERM,20,TSUB)) Q:'TSUB D
.S TFIND=$P($G(^PXRMD(811.5,TERM,20,TSUB,0)),U) Q:TFIND=""
.I $P(TFIND,U)["AUTTEDT(" D EDTP(TFIND)
Q
;
EDTP(FIND) ;Get education topic name
S EDIEN=$P(FIND,";") Q:'EDIEN Q:$D(ELIST(EDIEN)) S ELIST(EDIEN)=""
S DATA=$G(^AUTTEDT(EDIEN,0)) Q:DATA=""
S EDPNAM=$P(DATA,U,4),EDNAME=$P(DATA,U)
S OCNT=OCNT+1,ORY(OCNT)=EDIEN_U_EDNAME_U_EDPNAM
Q
;
EDU(ORY,OREDU) ;return education details in WP format
; display text only
;
N DIC,DR,DA,DIQ
K ^UTILITY("DIQ1",$J)
;IHS/MSC/MGH Field numbers changed to reflect differences in patient education files
;S DR=".01;.04;11;12"
S DR=".01;.04;1101;1102"
S DIC=9999999.09
S DA=OREDU
S DIQ(0)="EN"
D EN^DIQ1
;
; Construct output array
N OCNT,SUB,SUB1,LIT,IC,LITS
S DIC=9999999.09,OCNT=0
S LITS="NAME : ;PRINT NAME : ;EDUCATIONAL OUTCOME : ;"
S LITS=LITS_"EDUCATIONAL STANDARDS : "
F IC=1:1 S SUB=$P(DR,";",IC),LIT=$P(LITS,";",IC) Q:SUB="" D
.S SUB1="",OCNT=OCNT+1,ORY(OCNT)=" "
.I IC>2 S ORY(OCNT+1)=LIT,LIT="",OCNT=OCNT+2,ORY(OCNT)=" "
.F S SUB1=$O(^UTILITY("DIQ1",$J,DIC,OREDU,SUB,SUB1)) Q:SUB1="" D
..S OCNT=OCNT+1
..S ORY(OCNT)=LIT_$G(^UTILITY("DIQ1",$J,DIC,OREDU,SUB,SUB1))
..S LIT=""
K ^UTILITY("DIQ1",$J)
Q
;
EDS(ORY,OREDU) ;return education subtopics
; ien^name^sub-topic sequence number
;
N DIC,DR,DA,DATA,DIQ,NODE,NULL,OCNT,REF,SUB,TEMP
N EDIEN,EDNAME,EDSEQ,EDPNAM
S NULL=1,OCNT=0
K ^UTILITY("DIQ1",$J)
F NODE=1:1 D Q:EDIEN=""
.S REF=9999999.091001
.S DR=10
.S DA(REF)=NODE
.S DR(REF)=".01;3"
.S DIC=9999999.09
.S DA=OREDU
.S DIQ(0)="EIN"
.D EN^DIQ1
.S EDIEN=$G(^UTILITY("DIQ1",$J,REF,NODE,.01,"I"))
.I EDIEN="" K ^UTILITY("DIQ1",$J) Q
.S EDNAME=$G(^UTILITY("DIQ1",$J,REF,NODE,.01,"E"))
.S EDSEQ=$G(^UTILITY("DIQ1",$J,REF,NODE,3,"E")) S:EDSEQ="" EDSEQ=" "
.S EDPNAM=$P($G(^AUTTEDT(EDIEN,0)),U,4)
.S TEMP(EDSEQ,EDIEN)=EDIEN_U_EDNAME_U_EDPNAM_U_EDSEQ
.K ^UTILITY("DIQ1",$J)
;Output array in sequence order
S EDSEQ=""
F S EDSEQ=$O(TEMP(EDSEQ)) Q:EDSEQ="" D
.S EDIEN=""
.F S EDIEN=$O(TEMP(EDSEQ,EDIEN)) Q:EDIEN="" D
..S OCNT=OCNT+1,ORY(OCNT)=TEMP(EDSEQ,EDIEN)
Q
PXRMRPCB ; SLC/PJH - Functions returning REMINDER data ;29-Feb-2012 09:26;DU
+1 ;;2.0;CLINICAL REMINDERS;**1001**;Feb 04, 2005;Build 21
+2 ;IHS/MSC/MGH Patch 1001 Field numbers changed to reflect differences from VA
+3 QUIT
+4 ;
EDL(ORY,OREM) ;return list of education topics for a reminder
+1 ; ien^name^print name
+2 ;
+3 NEW DATA,EDIEN,EDNAME,EDPNAM,FIND,ELIST,OCNT,SUB
+4 SET SUB=0
SET OCNT=0
+5 FOR
SET SUB=$ORDER(^PXD(811.9,OREM,20,SUB))
IF 'SUB
QUIT
Begin DoDot:1
+6 SET FIND=$PIECE($GET(^PXD(811.9,OREM,20,SUB,0)),U)
+7 IF $PIECE(FIND,";",2)="AUTTEDT("
DO EDTP(FIND)
QUIT
+8 IF $PIECE(FIND,";",2)="PXRMD(811.5,"
DO EDTERM($PIECE(FIND,";"))
QUIT
End DoDot:1
+9 QUIT
+10 ;
EDTERM(TERM) ;Get any education topics on the reminder term
+1 NEW TSUB,TFIND
+2 SET TSUB=0
+3 FOR
SET TSUB=$ORDER(^PXRMD(811.5,TERM,20,TSUB))
IF 'TSUB
QUIT
Begin DoDot:1
+4 SET TFIND=$PIECE($GET(^PXRMD(811.5,TERM,20,TSUB,0)),U)
IF TFIND=""
QUIT
+5 IF $PIECE(TFIND,U)["AUTTEDT("
DO EDTP(TFIND)
End DoDot:1
+6 QUIT
+7 ;
EDTP(FIND) ;Get education topic name
+1 SET EDIEN=$PIECE(FIND,";")
IF 'EDIEN
QUIT
IF $DATA(ELIST(EDIEN))
QUIT
SET ELIST(EDIEN)=""
+2 SET DATA=$GET(^AUTTEDT(EDIEN,0))
IF DATA=""
QUIT
+3 SET EDPNAM=$PIECE(DATA,U,4)
SET EDNAME=$PIECE(DATA,U)
+4 SET OCNT=OCNT+1
SET ORY(OCNT)=EDIEN_U_EDNAME_U_EDPNAM
+5 QUIT
+6 ;
EDU(ORY,OREDU) ;return education details in WP format
+1 ; display text only
+2 ;
+3 NEW DIC,DR,DA,DIQ
+4 KILL ^UTILITY("DIQ1",$JOB)
+5 ;IHS/MSC/MGH Field numbers changed to reflect differences in patient education files
+6 ;S DR=".01;.04;11;12"
+7 SET DR=".01;.04;1101;1102"
+8 SET DIC=9999999.09
+9 SET DA=OREDU
+10 SET DIQ(0)="EN"
+11 DO EN^DIQ1
+12 ;
+13 ; Construct output array
+14 NEW OCNT,SUB,SUB1,LIT,IC,LITS
+15 SET DIC=9999999.09
SET OCNT=0
+16 SET LITS="NAME : ;PRINT NAME : ;EDUCATIONAL OUTCOME : ;"
+17 SET LITS=LITS_"EDUCATIONAL STANDARDS : "
+18 FOR IC=1:1
SET SUB=$PIECE(DR,";",IC)
SET LIT=$PIECE(LITS,";",IC)
IF SUB=""
QUIT
Begin DoDot:1
+19 SET SUB1=""
SET OCNT=OCNT+1
SET ORY(OCNT)=" "
+20 IF IC>2
SET ORY(OCNT+1)=LIT
SET LIT=""
SET OCNT=OCNT+2
SET ORY(OCNT)=" "
+21 FOR
SET SUB1=$ORDER(^UTILITY("DIQ1",$JOB,DIC,OREDU,SUB,SUB1))
IF SUB1=""
QUIT
Begin DoDot:2
+22 SET OCNT=OCNT+1
+23 SET ORY(OCNT)=LIT_$GET(^UTILITY("DIQ1",$JOB,DIC,OREDU,SUB,SUB1))
+24 SET LIT=""
End DoDot:2
End DoDot:1
+25 KILL ^UTILITY("DIQ1",$JOB)
+26 QUIT
+27 ;
EDS(ORY,OREDU) ;return education subtopics
+1 ; ien^name^sub-topic sequence number
+2 ;
+3 NEW DIC,DR,DA,DATA,DIQ,NODE,NULL,OCNT,REF,SUB,TEMP
+4 NEW EDIEN,EDNAME,EDSEQ,EDPNAM
+5 SET NULL=1
SET OCNT=0
+6 KILL ^UTILITY("DIQ1",$JOB)
+7 FOR NODE=1:1
Begin DoDot:1
+8 SET REF=9999999.091001
+9 SET DR=10
+10 SET DA(REF)=NODE
+11 SET DR(REF)=".01;3"
+12 SET DIC=9999999.09
+13 SET DA=OREDU
+14 SET DIQ(0)="EIN"
+15 DO EN^DIQ1
+16 SET EDIEN=$GET(^UTILITY("DIQ1",$JOB,REF,NODE,.01,"I"))
+17 IF EDIEN=""
KILL ^UTILITY("DIQ1",$JOB)
QUIT
+18 SET EDNAME=$GET(^UTILITY("DIQ1",$JOB,REF,NODE,.01,"E"))
+19 SET EDSEQ=$GET(^UTILITY("DIQ1",$JOB,REF,NODE,3,"E"))
IF EDSEQ=""
SET EDSEQ=" "
+20 SET EDPNAM=$PIECE($GET(^AUTTEDT(EDIEN,0)),U,4)
+21 SET TEMP(EDSEQ,EDIEN)=EDIEN_U_EDNAME_U_EDPNAM_U_EDSEQ
+22 KILL ^UTILITY("DIQ1",$JOB)
End DoDot:1
IF EDIEN=""
QUIT
+23 ;Output array in sequence order
+24 SET EDSEQ=""
+25 FOR
SET EDSEQ=$ORDER(TEMP(EDSEQ))
IF EDSEQ=""
QUIT
Begin DoDot:1
+26 SET EDIEN=""
+27 FOR
SET EDIEN=$ORDER(TEMP(EDSEQ,EDIEN))
IF EDIEN=""
QUIT
Begin DoDot:2
+28 SET OCNT=OCNT+1
SET ORY(OCNT)=TEMP(EDSEQ,EDIEN)
End DoDot:2
End DoDot:1
+29 QUIT