AGCNVAOB ;IHS/SD/EFG - CONVERT AUPNPAT FIELDS .17 AND .18 TO 7101 ;
;;7.1;PATIENT REGISTRATION;;AUG 25,2005
;
AOB ;FIND OLD ENTRIES IN FIELD .17 AND .18 OF AUPNPAT TO USE
;TO POPULATE NEW MULTIPLE FIELD 7101 OF AUPNPAT
K AG("DFN"),AG("AOB17"),AG("AOB18")
S AG("DFN")=0
F S AG("DFN")=$O(^AUPNPAT(AG("DFN"))) Q:'AG("DFN") D
. Q:$D(^AUPNPAT(AG("DFN"),71,0)) ;QUIT IF ALREADY DON FOR THIS PATIENT
. S AG("AOB17")=$P($G(^AUPNPAT(AG("DFN"),0)),U,17) ;ASSIGN BENEFITS OBTAINED
. S AG("AOB18")=$P($G(^AUPNPAT(AG("DFN"),0)),U,18) ;ASSIGN BENEFITS EXPIRED DATE
. ;I +AG("AOB18")!(+AG("AOB18")) D AOBADD MR. ED'S CODE
.Q:'AG("AOB17") ;MY CODE
.D AOBADD
K AG("DFN"),AG("AOB17"),AG("AOB18")
Q
AOBADD ;ADD ENTRY FROM OLD FIELDS TO NEW FIELDS
K DD,DO,X,DA
S DA(1)=AG("DFN")
S DIC="^AUPNPAT("_DA(1)_",71,"
S DIC(0)="LZE"
S DLAYGO=9000001
S X=AG("AOB17")
K DD,DO
D FILE^DICN
S AG("AOBIEN")=+Y
K DIC
Q:AG("AOB18")=""
S DIE="^AUPNPAT("_DA(1)_",71,"
S DA(1)=AG("DFN")
S DA=AG("AOBIEN")
S DR=".02////^S X=AG(""AOB18"")"
D ^DIE
Q
AGCNVAOB ;IHS/SD/EFG - CONVERT AUPNPAT FIELDS .17 AND .18 TO 7101 ;
+1 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
+2 ;
AOB ;FIND OLD ENTRIES IN FIELD .17 AND .18 OF AUPNPAT TO USE
+1 ;TO POPULATE NEW MULTIPLE FIELD 7101 OF AUPNPAT
+2 KILL AG("DFN"),AG("AOB17"),AG("AOB18")
+3 SET AG("DFN")=0
+4 FOR
SET AG("DFN")=$ORDER(^AUPNPAT(AG("DFN")))
IF 'AG("DFN")
QUIT
Begin DoDot:1
+5 ;QUIT IF ALREADY DON FOR THIS PATIENT
IF $DATA(^AUPNPAT(AG("DFN"),71,0))
QUIT
+6 ;ASSIGN BENEFITS OBTAINED
SET AG("AOB17")=$PIECE($GET(^AUPNPAT(AG("DFN"),0)),U,17)
+7 ;ASSIGN BENEFITS EXPIRED DATE
SET AG("AOB18")=$PIECE($GET(^AUPNPAT(AG("DFN"),0)),U,18)
+8 ;I +AG("AOB18")!(+AG("AOB18")) D AOBADD MR. ED'S CODE
+9 ;MY CODE
IF 'AG("AOB17")
QUIT
+10 DO AOBADD
End DoDot:1
+11 KILL AG("DFN"),AG("AOB17"),AG("AOB18")
+12 QUIT
AOBADD ;ADD ENTRY FROM OLD FIELDS TO NEW FIELDS
+1 KILL DD,DO,X,DA
+2 SET DA(1)=AG("DFN")
+3 SET DIC="^AUPNPAT("_DA(1)_",71,"
+4 SET DIC(0)="LZE"
+5 SET DLAYGO=9000001
+6 SET X=AG("AOB17")
+7 KILL DD,DO
+8 DO FILE^DICN
+9 SET AG("AOBIEN")=+Y
+10 KILL DIC
+11 IF AG("AOB18")=""
QUIT
+12 SET DIE="^AUPNPAT("_DA(1)_",71,"
+13 SET DA(1)=AG("DFN")
+14 SET DA=AG("AOBIEN")
+15 SET DR=".02////^S X=AG(""AOB18"")"
+16 DO ^DIE
+17 QUIT