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

LJFVHFIX.m

Go to the documentation of this file.
  1. LJFVHFIX ;IHS/ANMC/LJF - FIX VHOSP PATIENT POINTERS ; [ 10/21/92 8:21 AM ]
  1. ;;cleanup rtn for ADT v4.2 patch #
  1. ;
  1. W !!,"CLEANUP PATIENT POINTERS IN V HOSPITALIZATION FILE",!!
  1. ASK ;>> ask user if he/she wants to run cleanup
  1. K DIR S DIR(0)="YO",DIR("B")="NO"
  1. S DIR("A")="Do you wish to begin the cleanup"
  1. S DIR("A",1)="This program will cleanup any bad patient pointers in "
  1. S DIR("A",2)="your V HOSPITALIZATION file. It will check the patient"
  1. S DIR("A",3)="pointer for the visit and make sure the same patient is"
  1. S DIR("A",4)="is set in the V HOSPITALIZATION file. This routine has"
  1. S DIR("A",5)="been created in conjunction with ADT Patch 4.2*__"
  1. S DIR("A",6)=" "
  1. S DIR("A",7)="Please turn on your auxport to get a printout of what"
  1. S DIR("A",8)="has been fixed."
  1. S DIR("A",9)=" "
  1. D ^DIR G END:$D(DIRUT),END:Y=0
  1. ;
  1. BDATE ;>> ask user for the starting date for this cleanup; oldest discharge
  1. S %DT="AEP",%DT("A")="Enter beginning discharge date for cleanup: "
  1. W !! S X="" D ^%DT G END:Y=-1 S LJFBDT=Y
  1. ;
  1. EDIT ;>> make vhosp pat field editable
  1. W !!,"MAKING PATIENT FIELD IN V HOSPITALIZATION FILE EDITABLE. . .",!!
  1. S $P(^DD(9000010.02,.02,0),U,2)="RP9000001'"
  1. ;
  1. LOOP ;>> loop thru ^aupnvinp by date, check pointers, fix if don't match
  1. W !!,"LOOKING FOR ENTRIES TO FIX. . .",!
  1. S LJFDT=LJFBDT-.0001
  1. F S LJFDT=$O(^AUPNVINP("B",LJFDT)) Q:LJFDT'=+LJFDT D
  1. .S LJFH=0
  1. .F S LJFH=$O(^AUPNVINP("B",LJFDT,LJFH)) Q:LJFH="" D
  1. ..Q:'$D(^AUPNVINP(LJFH,0)) S LJFHS=^(0) ;vhosp node
  1. ..S LJFV=$P(LJFHS,U,3) Q:LJFV="" ;visit ifn
  1. ..Q:'$D(^AUPNVSIT(LJFV,0)) S LJFVS=^(0) ;visit node
  1. ..Q:$P(LJFHS,U,2)=$P(LJFVS,U,5) ;pt pointers match
  1. ..S DIE="^AUPNVINP(",DA=LJFH,DR=".02////"_$P(LJFVS,U,5) D ^DIE ;fix
  1. ..S Y=LJFDT X ^DD("DD")
  1. ..W !,"Fixed entry #",LJFH," for discharge date of ",Y
  1. ;
  1. UNEDIT ;>> make vhosp pat field uneditable
  1. W !!,"COMPLETED SEARCH; NOW MAKING PATIENT FIELD UNEDITABLE AGAIN",!!
  1. S $P(^DD(9000010.02,.02,0),U,2)="RP9000001'I"
  1. ;
  1. W !!,"CLEANUP COMPLETE!!",!
  1. END ;>> eoj
  1. K DIR,LJFBDT,LJFDT,LJFH,LJFHS,LJFV,LJFVS,DIE,DA Q