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

IBY652P.m

Go to the documentation of this file.
  1. IBY652P ;AITC/TAZ-Post Install Routine for Patch 652;10 Jun 19
  1. ;;2.0;INTEGRATED BILLING;**652**;21-MAR-94;Build 23
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. N IBXPD,XPDIDTOT
  1. S XPDIDTOT=1
  1. ;
  1. ;
  1. ; Task PROC
  1. D PROC(1)
  1. ;
  1. ; Done...
  1. D MES^XPDUTL("")
  1. D MES^XPDUTL("POST-Install Completed.")
  1. Q
  1. ;
  1. PROC(IBXPD) ;Process the MBI File
  1. ;Read File into the ^TMP($J) global
  1. N CNT,CCNT,FILENAME,INSTCMP,IOC,GREF,PROD,RCNT,SCNT,SITE,SITESYS,SUB,TCNT
  1. ;
  1. D BMES^XPDUTL(" STEP "_IBXPD_" of "_XPDIDTOT)
  1. D MES^XPDUTL("-------------")
  1. D MES^XPDUTL("Processing MBI Crosswalk ... ")
  1. ;
  1. K ^TMP($J)
  1. ;
  1. S SITESYS=$$SITE^VASITE
  1. ;
  1. I (DT>3200131) G PROCQ ;Past the compliance date, no longer processing files.
  1. ;
  1. I $P(SITESYS,U,3)=358 G PROCQ ;If site is Manila, DO NOT process
  1. ;
  1. S PROD=$$PROD^XUPROD(1)
  1. S INSTCMP=$$GET1^DIQ(9.7,$O(^XPD(9.7,"B","IB*2.0*652",""),-1)_",",.02,"I")=3
  1. F SITE=405,515,518,585,662 S IOC(SITE)=""
  1. ;
  1. I 'PROD,'$D(IOC($P(SITESYS,U,3))) G PROCQ ;Test account and not an IOC site
  1. ; Only IOC TEST sites and all PROD sites get here
  1. I INSTCMP,'$D(IOC($P(SITESYS,U,3))) G PROCQ ;Already installed once and not an IOC site
  1. ;
  1. S GREF=$NA(^TMP($J,"IN",1,0))
  1. S SUB=3
  1. ;Note: PATH is set up in IBY652E and killed in PROCQ
  1. S FILENAME="va"_$P(SITESYS,U,3)_".txt"
  1. I '$$FTG^%ZISH(PATH,FILENAME,GREF,SUB) G PROCQ
  1. ;
  1. ;Process MBI Data
  1. S CNT=1,(CCNT,RCNT,SCNT,TCNT)=0
  1. S RCNT=RCNT+1,^TMP($J,"OUT",RCNT,0)="Site:"_$P(SITESYS,U,3)_U_$P(SITESYS,U,2,3)_"^Results of IB*2.0*652 installed on "_$$FMTE^XLFDT(DT)
  1. F S CNT=$O(^TMP($J,"IN",CNT)) Q:'CNT S DATA=^(CNT,0) D
  1. . I '$L(DATA) Q ; blank line at end of file.
  1. . S TCNT=TCNT+1 I '(TCNT#100) U 0 W "."
  1. . N DFN,DOB,ERROR,ICN,ICNT,IEN,INSIEN,MBI,MCNT,SKIP,SSN
  1. . S ICN=$P(DATA,U,1),SSN=$$NOPUNCT^IBCEF($P(DATA,U,2),1),DOB=$$HL7TFM^XLFDT($P(DATA,U,3)),MBI=$P(DATA,U,6)
  1. . S (IEN,MCNT,SKIP)=0
  1. . I MBI']"" D ERROR(DATA,"Patient Not Found") Q
  1. . ;Match on ICN
  1. . I '$D(^DPT("AICN",ICN)) D ERROR(DATA,"Patient Not Found") Q
  1. . S DFN="" F ICNT=0:1 S DFN=$O(^DPT("AICN",ICN,DFN)) I DFN="" Q
  1. . I ICNT'=1 D ERROR(DATA,"Patient Not Found") Q
  1. . S DFN=$O(^DPT("AICN",ICN,""))
  1. . L +^DPT(DFN,.312,0):DILOCKTM E D ERROR(DATA,"Record Locked") Q
  1. . ; Match on SSN
  1. . I $$NOPUNCT^IBCEF($$GET1^DIQ(2,DFN_",",.09),1)'=SSN D ERROR(DATA,"Patient Not Found",1) Q
  1. . ; Match on DOB
  1. . I $$GET1^DIQ(2,DFN_",",.03,"I")'=DOB D ERROR(DATA,"Patient Not Found",1) Q
  1. . ; Check for Medicare policies
  1. . S INSIEN=0
  1. . F S INSIEN=$O(^DPT(DFN,.312,INSIEN)) Q:'INSIEN D
  1. .. N FDA,IENS,INSNM,PATID,SUBID
  1. .. S IENS=INSIEN_","_DFN_","
  1. .. S INSNM=$TR($$GET1^DIQ(2.312,IENS,.01)," ")
  1. .. I ",MEDICARE(WNR),MEDICAREPARTD(WNR),"'[(","_INSNM_",") Q
  1. .. S MCNT=MCNT+1
  1. .. S SUBID=$$GET1^DIQ(2.312,IENS,7.02)
  1. .. S PATID=$$GET1^DIQ(2.312,IENS,5.01)
  1. .. I SUBID=MBI S SKIP=1 Q ;No need to update
  1. .. S SKIP=0
  1. .. ;Set Subscriber ID and Patient ID to MBI,Rollback fields to SUBID AND PATID
  1. .. S FDA(2.312,IENS,5.01)=MBI
  1. .. S FDA(2.312,IENS,7.02)=MBI
  1. .. S FDA(2.312,IENS,7.03)=SUBID
  1. .. S FDA(2.312,IENS,7.04)=PATID
  1. .. S FDA(2.312,IENS,1.05)=DT
  1. .. S FDA(2.312,IENS,1.06)=.5
  1. .. D FILE^DIE(,"FDA","ERROR") I $D(ERROR) D ERROR(DATA,$G(ERROR)) Q
  1. . I SKIP S SCNT=SCNT+1
  1. . I 'MCNT D ERROR(DATA,"No Medicare Found")
  1. . I 'SKIP,MCNT S CCNT=CCNT+1
  1. . L -^DPT(DFN,.312,0)
  1. ;
  1. ;Write Result file to HMS Directory
  1. S GREF=$NA(^TMP($J,"OUT",1,0))
  1. S FILENAME="va"_$P(SITESYS,U,3)_"-results.txt"
  1. I '$$GTF^%ZISH(GREF,SUB,PATH,FILENAME) G PROCQ
  1. ;
  1. N MSG,SUB,XMY
  1. S MSG(1)="On "_$$FMTE^XLFDT(DT)_" the MBI Crosswalk was run at site "_$P(SITESYS,U,3)_" - "_$P(SITESYS,U,2)
  1. S MSG(2)=""
  1. S MSG(3)="Total Records: "_TCNT
  1. S MSG(4)=""
  1. S MSG(5)="Successful Patient Update Records: "_CCNT
  1. S MSG(6)=""
  1. S MSG(7)="Patient Error Records: "_(RCNT-1) ;subtract 1 to account for the header record.
  1. S MSG(8)=""
  1. S MSG(9)="Patient Skipped (MBI correct on file) Records: "_SCNT
  1. S MSG(10)=""
  1. S MSG(11)="File "_FILENAME_" was created in the "_PATH_" directory by user "_$$GET1^DIQ(200,DUZ_",",.01)_"."
  1. ;
  1. S SUB="MBI CROSSWALK ("_$P(SITESYS,U,3)_" - "_$P(SITESYS,U,2)_")"
  1. ;
  1. S XMY("VHAeInsuranceRapidResponse@domain.ext")=""
  1. ;
  1. D MSG^IBCNEUT5(,SUB,"MSG(",1,.XMY)
  1. ;
  1. PROCQ ;End of routine.
  1. K PATH,XPDQUIT
  1. Q
  1. ;
  1. ERROR(DATA,ERROR,UNLOCK) ;Set the Error in the results file
  1. S RCNT=RCNT+1
  1. S ^TMP($J,"OUT",RCNT,0)=DATA_U_ERROR
  1. I $G(UNLOCK) L -^DPT(DFN,.312,0)
  1. Q