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

PXVRPC9.m

Go to the documentation of this file.
  1. PXVRPC9 ;BPFO/LMT - PCE RPCs for Imm Disclosures ;06/21/16 16:08
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**216**;Aug 12, 1996;Build 11
  1. ;
  1. ;
  1. SETDIS(PXRSLT,PXVIMM,PXAGENCY,PXDT,PXTMZONE) ;
  1. ;
  1. ; Save immunization disclosure information.
  1. ;
  1. ;Input:
  1. ; PXRSLT - Return value passed by reference (Required)
  1. ; PXVIMM - V Immunization IEN (Required)
  1. ; PXAGENCY - Agency Name this record was disclosed to (Required)
  1. ; PXDT - Date/Time this record was disclosed (Required)
  1. ; PXTMZONE - Time Zone of the Date/Time (Required)
  1. ;
  1. ;Returns:
  1. ; 0^error message - If we could not save the disclosure information (either the RPC was called
  1. ; incorrectly, or the V Immunization IEN did not exist).
  1. ; 1 - Successfully saved the disclosure information
  1. ; 2^error message - We attempted to save the disclosure information, but encountered an error
  1. ; when filing the data to the database.
  1. ;
  1. N PXDTI,PXERR,PXFDA,PXFDAIEN,PXFILE,PXFILESUB,PXHR,PXIEN,PXIENS,PXMIN
  1. ;
  1. S PXRSLT="0"
  1. ;
  1. I '$G(PXVIMM) D Q
  1. . S PXRSLT="0^V Immunization IEN is not valid"
  1. I $G(PXAGENCY)="" D Q
  1. . S PXRSLT="0^Agency is not valid"
  1. I '$G(PXDT) D Q
  1. . S PXRSLT="0^Date/Time is not valid"
  1. D DT^DILF("TX",$G(PXDT),.PXDTI)
  1. I $G(PXDTI)'>0 D Q
  1. . S PXRSLT="0^Date/Time is not valid"
  1. I $G(PXTMZONE)="" D Q
  1. . S PXRSLT="0^Time zone is not valid"
  1. I PXTMZONE?3A,$$GMTDIFF^XMXUTIL1(PXTMZONE)="" D Q
  1. . S PXRSLT="0^Time zone is not valid"
  1. I PXTMZONE'?3A,PXTMZONE'?1(1"-",1"+")4N D Q
  1. . S PXRSLT="0^Time zone is not valid"
  1. ;
  1. S PXIEN=+PXVIMM
  1. S PXFILE=$E(PXVIMM,$L(PXVIMM))
  1. S PXFILE=$S(PXFILE="D":9000080.11,1:9000010.11)
  1. ; maybe it was deleted after we sent it to DAS
  1. I PXFILE=9000010.11,'$D(^AUPNVIMM(PXIEN,0)) S PXFILE=9000080.11
  1. I PXFILE=9000080.11,'$D(^AUPDVIMM(PXIEN,0)) D Q
  1. . S PXRSLT="0^V Immunization IEN does not exist"
  1. S PXAGENCY=$$AGENCY(PXAGENCY)
  1. I 'PXAGENCY D Q
  1. . S PXRSLT="0^"_$P(PXAGENCY,U,2)
  1. S PXAGENCY=+PXAGENCY
  1. ;
  1. ; Update date/time, based off timezone differences
  1. D ZONEDIFF^XMXUTIL1(PXTMZONE,.PXHR,.PXMIN)
  1. S PXDTI=$$FMADD^XLFDT(PXDTI,,PXHR,PXMIN)
  1. ;
  1. S PXFILESUB=9000010.1182
  1. I PXFILE=9000080.11 S PXFILESUB=9000080.1182
  1. S PXIENS="+1,"_PXIEN_","
  1. S PXFDA(1,PXFILESUB,PXIENS,.01)=PXAGENCY
  1. S PXFDA(1,PXFILESUB,PXIENS,.02)=PXDTI
  1. D UPDATE^DIE("","PXFDA(1)","PXFDAIEN","PXERR")
  1. I $G(PXFDAIEN(1))>0 D Q
  1. . S PXRSLT=1
  1. ;
  1. S PXRSLT="2^"_$G(PXERR("DIERR",1,"TEXT",1))
  1. Q
  1. ;
  1. AGENCY(PXNAME) ;Get IEN of agency; allow LAYGO
  1. ;
  1. N PXERR,PXFDA,PXFDAIEN,PXIEN
  1. ;
  1. S PXFDA(1,920.71,"?+1,",.01)=PXNAME
  1. D UPDATE^DIE("E","PXFDA(1)","PXFDAIEN","PXERR")
  1. S PXIEN=$G(PXFDAIEN(1))
  1. I PXIEN>0 Q PXIEN
  1. Q "0^"_$G(PXERR("DIERR",1,"TEXT",1))