Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APSPRV

APSPRV.m

Go to the documentation of this file.
APSPRV ; IHS/DSD/ENM - BACKFILL PROVIDERS TO V MEDICATION FILE ;  [ 09/03/97   1:30 PM ]
 ;;6.0;IHS PHARMACY MODIFICATIONS;;09/03/97
 ; This utility routine will fill the provider field of the V MEDICATION
 ; file with the provider from the PRESCRIPTION file for that
 ; prescription entry.
 ; It took 3 minutes to do 7600 entries in the V MEDICATION file on
 ; an Altos system using MSM.
 ;
 S %DT("A")="PLEASE ENTER BEGINNING DATE: "
 S %DT="AE"
 D ^%DT
 I Y=-1 G EXIT
 S APSPBD=Y
APSPDATE ;
 F APSPDATE=(APSPBD-1):0 S APSPDATE=$O(^PSRX("AD",APSPDATE)) Q:APSPDATE'=+APSPDATE  D
 . S APSPRXDA=0
 . F  S APSPRXDA=$O(^PSRX("AD",APSPDATE,APSPRXDA)) Q:APSPRXDA'=+APSPRXDA  S APSPCNT=$O(^(APSPRXDA,"")) D
 .. S:$D(^PSRX(APSPRXDA,0)) APSPRX0=^(0)
 .. Q:'$D(APSPRX0)
 .. S:$P(APSPRX0,U,4)]"" APSPRV=$P(APSPRX0,U,4)
 .. I '$D(APSPRV) K APSPRX0,APSPCNT Q
 .. I APSPCNT=0,$D(^PSRX(APSPRXDA,999999911))#2,^(999999911)]"" S APSPLINK=^(999999911)
 .. I APSPCNT'=0,$D(^PSRX(APSPRXDA,1,APSPCNT,999999911))#2,^(999999911)]"" S APSPLINK=^(999999911)
 .. I '$D(APSPLINK) K APSPRX0,APSPRV,APSPCNT Q
 .. I $D(^AUPNVMED(APSPLINK,0))#2 S $P(^(0),U,9)=APSPRV W "."
 .. K APSPRV,APSPCNT,APSPLINK,APSPRX0
EXIT ;
 K APSPCNT,APSPRX0,APSPLINK,APSPBD,APSPDATE,%DT,APSPRXDA,Y
 Q