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

GMRCITPI.m

Go to the documentation of this file.
  1. GMRCITPI ;SLC/JFR - SET TEST PATIENT ICN'S ;10/2/02 12:10
  1. ;;3.0;CONSULT/REQUEST TRACKING;**22,28**;DEC 27, 1997
  1. ;
  1. ; This routine invokes IA #'s 3552, 3553
  1. ;
  1. ;
  1. ; WARNING: due to complications that may occur with the VA MPI, this
  1. ; routine should never be executed in a production VistA
  1. ; environment.
  1. ;
  1. EN ;set test patient ICN's based on SSN
  1. I '$$ENVOK Q ;don't continue if environment isn't right
  1. N DIR,X,Y,DIRUT,DIROUT,DUOUT,DTOUT,GMRCPT,VA,VAHOW,VAROOT,DFN,OK
  1. W !!
  1. S DIR(0)="PAO^2:EMQZ",DIR("A")="Select shared patient: "
  1. D ^DIR I $D(DIRUT) Q
  1. S DFN=+Y
  1. S VAROOT="GMRCPT",VAHOW=1 D DEM^VADPT
  1. I '$$PATOK($P(GMRCPT("SS"),U)) G EN
  1. W !!,"Trying to set test patient ICN..."
  1. S OK=$$SETICN^MPIF001(DFN,(9_+GMRCPT("SS")),$E(GMRCPT("SS"),3,8))
  1. I 'OK W !!,"Unable to set ICN for this patient. Try again or select another patient." Q
  1. W !!," Done.",!
  1. G EN
  1. Q
  1. ENVOK() ;check and quit if this could be a production environment
  1. ; checks PROCESSING ID (#.03) of file 869.3 to see if training
  1. N GMRCPID
  1. S GMRCPID=$P($$PARAM^HLCS2,U,3) ; new API to call
  1. I '$L(GMRCPID) D Q 0
  1. . W !!,"Unable to continue! VistA HL7 is not configured."
  1. . W !,"Check the HL COMMUNICATION SERVER PARAMETERS file to be sure this is "
  1. . W !,"configured as a test environment."
  1. I GMRCPID="P" D Q 0
  1. . W !!,$C(7),"This appears to be a production system!",!!
  1. . W "This option is only for use in training environments!",!
  1. . W !,"If this is indeed a training environment, Check the HL COMMUNICATION "
  1. . W !,"SERVER PARAMETERS file to be sure this is configured as a test environment."
  1. . W !,"Then access this option again."
  1. Q 1
  1. ;
  1. PATOK(GMRCSSN) ;make sure patient is only one with the SSN passed in
  1. ; Input:
  1. ; GMRCSSN = ssn of patient in question
  1. ;
  1. ; Output:
  1. ; 1 = patient has a unique SSN and can be assigned a pseudo-ICN
  1. ; 0 = already a patient on file with the SSN
  1. N GMRCPT,ICN,OK
  1. I $E(GMRCSSN,1,5)="00000" D Q 0
  1. . W !,"Patients having a SSN with 5 leading zeros cannot be used for inter-facility",!,"consult testing. Edit the SSN or choose a different patient."
  1. I GMRCSSN["P" D Q 0
  1. . W !!,"This patient has a pseudo-SSN. A pseudo-ICN cannot be assigned. Edit the SSN",!,"or choose a different patient.",!
  1. S GMRCPT=$$FIND1^DIC(2,"","X",GMRCSSN,"SSN")
  1. I GMRCPT'>0 D Q 0
  1. . W !,"There is more than one patient on file with the SSN of this patient. ",!,"A pseudo-ICN cannot be assigned. Edit the SSN or choose different patient."
  1. S ICN=$$GETICN^MPIF001(GMRCPT)
  1. I $L(ICN),+ICN=(9_GMRCSSN) D Q 0
  1. . W !!,"Test patient ICN already set using current SSN.",!
  1. I $L(ICN),'$$IFLOCAL^MPIF001(GMRCPT) D Q OK
  1. . S OK=1
  1. . W !!,"This patient appears to have a national ICN on file.",!
  1. . N DIR,X,Y,DTOUT,DIRUT,DUOUT
  1. . S DIR(0)="YA",DIR("A")="Are you sure you want to overwrite this ICN? "
  1. . D ^DIR
  1. . I Y'>0 S OK=0
  1. Q 1