PSO520PO ;ALB/BLB - eRx utilities ; 3/29/2018 4:00pm
;;7.0;OUTPATIENT PHARMACY;**520**;DEC 1997;Build 52
;
N EIEN,IENS,QIEN,ODOSORD,NEWDOSE,ONOUND,ODOSE,FDA,POO,POQIEN,POQIENS,PO,PODOSE,PONOUN,PODOSORD,DOSORD,ONOUN
N PNEWDOSE,PFDA
D EN^DDIOL("Correcting dosing data for inbound electronic prescriptions")
D EN^DDIOL("and pending outpatient orders. Please be patient.")
S EIEN=0 F S EIEN=$O(^PS(52.49,EIEN)) Q:'EIEN D
.S QIEN=0 F S QIEN=$O(^PS(52.49,EIEN,21,QIEN)) Q:'QIEN D
..S IENS=QIEN_","_EIEN_","
..I $$GET1^DIQ(52.4921,IENS,.01)'="&" Q
..S ODOSORD=$$GET1^DIQ(52.4921,IENS,9,"E")
..S ODOSE=$$GET1^DIQ(52.4921,IENS,8,"E")
..S ONOUN=$$GET1^DIQ(52.4921,IENS,12,"E")
..I ODOSORD]"" S NEWDOSE=ODOSORD_"&"_ONOUN,FDA(52.4921,IENS,.01)=NEWDOSE D FILE^DIE(,"FDA") K FDA Q
..S NEWDOSE=ODOSE,FDA(52.4921,IENS,.01)=NEWDOSE D FILE^DIE(,"FDA") K FDA Q
.S POO=$$GET1^DIQ(52.49,EIEN,25.2,"I") I 'POO Q
.I '$D(^PS(52.41,POO)) Q
.S POQIEN=0 F S POQIEN=$O(^PS(52.41,POO,1,POQIEN)) Q:'POQIEN D
..S POQIENS=POQIEN_","_POO_","
..I $$GET1^DIQ(52.413,POQIENS,.01)'="&" Q
..S PODOSORD=$$GET1^DIQ(52.413,POQIENS,9,"E")
..S PODOSE=$$GET1^DIQ(52.413,POQIENS,8,"E")
..S PONOUN=$$GET1^DIQ(52.413,POQIENS,12,"E")
..I PODOSORD]"" S PNEWDOSE=PODOSORD_"&"_PONOUN,PFDA(52.413,POQIENS,.01)=PNEWDOSE D FILE^DIE(,"PFDA") K PFDA Q
..S PNEWDOSE=PODOSE,PFDA(52.413,POQIENS,.01)=PNEWDOSE D FILE^DIE(,"PFDA") K PFDA Q
D CLEANREC
Q
CLEANREC ;
N EXIEN,FDA
S EXIEN=0 F S EXIEN=$O(^PS(52.49,EXIEN)) Q:'EXIEN D
.I '$$GET1^DIQ(52.49,EXIEN,2.1,"I"),$$GET1^DIQ(52.49,EXIEN,1,"E")="N" D
..S FDA(52.49,EXIEN_",",.01)="@" D FILE^DIE(,"FDA") K FDA
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSO520PO 1674 printed Dec 13, 2024@02:23:02 Page 2
PSO520PO ;ALB/BLB - eRx utilities ; 3/29/2018 4:00pm
+1 ;;7.0;OUTPATIENT PHARMACY;**520**;DEC 1997;Build 52
+2 ;
+3 NEW EIEN,IENS,QIEN,ODOSORD,NEWDOSE,ONOUND,ODOSE,FDA,POO,POQIEN,POQIENS,PO,PODOSE,PONOUN,PODOSORD,DOSORD,ONOUN
+4 NEW PNEWDOSE,PFDA
+5 DO EN^DDIOL("Correcting dosing data for inbound electronic prescriptions")
+6 DO EN^DDIOL("and pending outpatient orders. Please be patient.")
+7 SET EIEN=0
FOR
SET EIEN=$ORDER(^PS(52.49,EIEN))
if 'EIEN
QUIT
Begin DoDot:1
+8 SET QIEN=0
FOR
SET QIEN=$ORDER(^PS(52.49,EIEN,21,QIEN))
if 'QIEN
QUIT
Begin DoDot:2
+9 SET IENS=QIEN_","_EIEN_","
+10 IF $$GET1^DIQ(52.4921,IENS,.01)'="&"
QUIT
+11 SET ODOSORD=$$GET1^DIQ(52.4921,IENS,9,"E")
+12 SET ODOSE=$$GET1^DIQ(52.4921,IENS,8,"E")
+13 SET ONOUN=$$GET1^DIQ(52.4921,IENS,12,"E")
+14 IF ODOSORD]""
SET NEWDOSE=ODOSORD_"&"_ONOUN
SET FDA(52.4921,IENS,.01)=NEWDOSE
DO FILE^DIE(,"FDA")
KILL FDA
QUIT
+15 SET NEWDOSE=ODOSE
SET FDA(52.4921,IENS,.01)=NEWDOSE
DO FILE^DIE(,"FDA")
KILL FDA
QUIT
End DoDot:2
+16 SET POO=$$GET1^DIQ(52.49,EIEN,25.2,"I")
IF 'POO
QUIT
+17 IF '$DATA(^PS(52.41,POO))
QUIT
+18 SET POQIEN=0
FOR
SET POQIEN=$ORDER(^PS(52.41,POO,1,POQIEN))
if 'POQIEN
QUIT
Begin DoDot:2
+19 SET POQIENS=POQIEN_","_POO_","
+20 IF $$GET1^DIQ(52.413,POQIENS,.01)'="&"
QUIT
+21 SET PODOSORD=$$GET1^DIQ(52.413,POQIENS,9,"E")
+22 SET PODOSE=$$GET1^DIQ(52.413,POQIENS,8,"E")
+23 SET PONOUN=$$GET1^DIQ(52.413,POQIENS,12,"E")
+24 IF PODOSORD]""
SET PNEWDOSE=PODOSORD_"&"_PONOUN
SET PFDA(52.413,POQIENS,.01)=PNEWDOSE
DO FILE^DIE(,"PFDA")
KILL PFDA
QUIT
+25 SET PNEWDOSE=PODOSE
SET PFDA(52.413,POQIENS,.01)=PNEWDOSE
DO FILE^DIE(,"PFDA")
KILL PFDA
QUIT
End DoDot:2
End DoDot:1
+26 DO CLEANREC
+27 QUIT
CLEANREC ;
+1 NEW EXIEN,FDA
+2 SET EXIEN=0
FOR
SET EXIEN=$ORDER(^PS(52.49,EXIEN))
if 'EXIEN
QUIT
Begin DoDot:1
+3 IF '$$GET1^DIQ(52.49,EXIEN,2.1,"I")
IF $$GET1^DIQ(52.49,EXIEN,1,"E")="N"
Begin DoDot:2
+4 SET FDA(52.49,EXIEN_",",.01)="@"
DO FILE^DIE(,"FDA")
KILL FDA
End DoDot:2
End DoDot:1
+5 QUIT