PSOPXRMU ;BHM/MFR - Set/Kill of Clinical Reminders Index;07/12/2004
;;7.0;OUTPATIENT PHARMACY;**118**;DEC 1997
;Reference to ^PXRMINDX supported by DBIA 4114
;
SKIDX(X,DA,NODE,CMD) ;Set/Kill Clinical Reminder Index
;Input: X(1) - DAYS SUPPLY, X(2)=RELEASED DATE/TIME
; DA - PRESCRIPTION file IEN
; NODE - "O":Original; "R":Refill; "P":Partial
; CMD - "S":Set; "K": Kill
;
N D0,DAS,DATE,DFN,DRUG,Z
S D0=$S(NODE="O":DA,1:DA(1))
S Z=$G(^PSRX(D0,0)),DFN=$P(Z,U,2),DRUG=$P(Z,U,6)
I DFN=""!(DRUG="") Q
S DATE=+$$FMADD^XLFDT(X(2),X(1))
S DAS=DA_";2"
S:NODE="R" DAS=DA(1)_";1;"_DA_";0"
S:NODE="P" DAS=DA(1)_";P;"_DA_";0"
;
I CMD="S" D
. S ^PXRMINDX(52,"IP",DRUG,DFN,X(2),DATE,DAS)=""
. S ^PXRMINDX(52,"PI",DFN,DRUG,X(2),DATE,DAS)=""
I CMD="K" D
. K ^PXRMINDX(52,"IP",DRUG,DFN,X(2),DATE,DAS)
. K ^PXRMINDX(52,"PI",DFN,DRUG,X(2),DATE,DAS)
Q
;
;=============================================
KNVA(X,DA) ;Delete index for NVA node.
N DAS,START,STOP
;Reference to ^PXRMINDX("55NVA" is supported by DBIA# 4114.
S START=$S(X(3)'="":X(3),1:X(2))
S STOP=$S(X(4)'="":X(4),1:"U"_DA(1))
S DAS=DA(1)_";NVA;"_DA_";0"
K ^PXRMINDX("55NVA","IP",X(1),DA(1),START,STOP,DAS)
K ^PXRMINDX("55NVA","PI",DA(1),X(1),START,STOP,DAS)
Q
;
;=============================================
SNVA(X,DA) ;Set index for NVA node
;X(1)=PHARMACY ORDERABLE ITEM,X(2)=DOCUMENTED DATE,
;X(3)=START DATE (optional), X(4)=DISCONTINUED DATE (optional)
;Reference to ^PXRMINDX(55 is supported by DBIA# 4114.
N DAS,START,STOP
S START=$S(X(3)'="":X(3),1:X(2))
S STOP=$S(X(4)'="":X(4),1:"U"_DA(1))
S DAS=DA(1)_";NVA;"_DA_";0"
S ^PXRMINDX("55NVA","IP",X(1),DA(1),START,STOP,DAS)=""
S ^PXRMINDX("55NVA","PI",DA(1),X(1),START,STOP,DAS)=""
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOPXRMU 1802 printed Nov 22, 2024@17:43:12 Page 2
PSOPXRMU ;BHM/MFR - Set/Kill of Clinical Reminders Index;07/12/2004
+1 ;;7.0;OUTPATIENT PHARMACY;**118**;DEC 1997
+2 ;Reference to ^PXRMINDX supported by DBIA 4114
+3 ;
SKIDX(X,DA,NODE,CMD) ;Set/Kill Clinical Reminder Index
+1 ;Input: X(1) - DAYS SUPPLY, X(2)=RELEASED DATE/TIME
+2 ; DA - PRESCRIPTION file IEN
+3 ; NODE - "O":Original; "R":Refill; "P":Partial
+4 ; CMD - "S":Set; "K": Kill
+5 ;
+6 NEW D0,DAS,DATE,DFN,DRUG,Z
+7 SET D0=$SELECT(NODE="O":DA,1:DA(1))
+8 SET Z=$GET(^PSRX(D0,0))
SET DFN=$PIECE(Z,U,2)
SET DRUG=$PIECE(Z,U,6)
+9 IF DFN=""!(DRUG="")
QUIT
+10 SET DATE=+$$FMADD^XLFDT(X(2),X(1))
+11 SET DAS=DA_";2"
+12 if NODE="R"
SET DAS=DA(1)_";1;"_DA_";0"
+13 if NODE="P"
SET DAS=DA(1)_";P;"_DA_";0"
+14 ;
+15 IF CMD="S"
Begin DoDot:1
+16 SET ^PXRMINDX(52,"IP",DRUG,DFN,X(2),DATE,DAS)=""
+17 SET ^PXRMINDX(52,"PI",DFN,DRUG,X(2),DATE,DAS)=""
End DoDot:1
+18 IF CMD="K"
Begin DoDot:1
+19 KILL ^PXRMINDX(52,"IP",DRUG,DFN,X(2),DATE,DAS)
+20 KILL ^PXRMINDX(52,"PI",DFN,DRUG,X(2),DATE,DAS)
End DoDot:1
+21 QUIT
+22 ;
+23 ;=============================================
KNVA(X,DA) ;Delete index for NVA node.
+1 NEW DAS,START,STOP
+2 ;Reference to ^PXRMINDX("55NVA" is supported by DBIA# 4114.
+3 SET START=$SELECT(X(3)'="":X(3),1:X(2))
+4 SET STOP=$SELECT(X(4)'="":X(4),1:"U"_DA(1))
+5 SET DAS=DA(1)_";NVA;"_DA_";0"
+6 KILL ^PXRMINDX("55NVA","IP",X(1),DA(1),START,STOP,DAS)
+7 KILL ^PXRMINDX("55NVA","PI",DA(1),X(1),START,STOP,DAS)
+8 QUIT
+9 ;
+10 ;=============================================
SNVA(X,DA) ;Set index for NVA node
+1 ;X(1)=PHARMACY ORDERABLE ITEM,X(2)=DOCUMENTED DATE,
+2 ;X(3)=START DATE (optional), X(4)=DISCONTINUED DATE (optional)
+3 ;Reference to ^PXRMINDX(55 is supported by DBIA# 4114.
+4 NEW DAS,START,STOP
+5 SET START=$SELECT(X(3)'="":X(3),1:X(2))
+6 SET STOP=$SELECT(X(4)'="":X(4),1:"U"_DA(1))
+7 SET DAS=DA(1)_";NVA;"_DA_";0"
+8 SET ^PXRMINDX("55NVA","IP",X(1),DA(1),START,STOP,DAS)=""
+9 SET ^PXRMINDX("55NVA","PI",DA(1),X(1),START,STOP,DAS)=""
+10 QUIT
+11 ;