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

BPSUSCR2.m

Go to the documentation of this file.
BPSUSCR2 ;ALB ISC/SS - STRANDED SUBMISSIONS SCREEN (cont) ;02-MAY-2008
 ;;1.0;E CLAIMS MGMT ENGINE;**7,10,11**;JUN 2004;Build 27
 ;;Per VHA Directive 2004-038, this routine should not be modified.
 ;
 Q
 ;
 ;Stranded requests with BPS TRANSACTION record
 ;   Input:
 ;     BPARR - Date Range
 ;   Output:
 ;     ^TMP("BPSUSCR",$J)
 ;     ^TMP($J,2)
COLACTRQ(BPARR) ;
 N KEY1,KEY2,BPIEN77,BPRX,FILL,COB
 N TFILE,CFILE,STATUS,IEN59,VART,LSTUDT,CD0
 N NAME,SSN,INSCO,DOS,BPTYPE
 N BPBDT,BPEDT
 S TFILE=9002313.59,CFILE=9002313.02
 S BPBDT=BPARR("BDT") ;start date and time
 S BPEDT=BPARR("EDT") ;end date and time
 S KEY1=0
 F  S KEY1=$O(^BPS(9002313.77,"AC",2,KEY1)) Q:+KEY1=0  D
 .S KEY2=""
 .F  S KEY2=$O(^BPS(9002313.77,"AC",2,KEY1,KEY2)) Q:KEY2=""  D
 .. S BPIEN77=+$O(^BPS(9002313.77,"AC",2,KEY1,KEY2,0))
 .. S COB=$$GET1^DIQ(9002313.77,BPIEN77,.03,"I")
 .. S IEN59=$$IEN59^BPSOSRX(KEY1,KEY2,COB)
 .. S VART=$G(^BPST(IEN59,0))
 .. ; If the transaction is missing, get the data from the request
 .. I VART="" D REQSTTMP Q
 .. ; If the Request pointer in the transaction is not the same as the
 .. ;   original request from the request file, get the data from the request
 .. S BPTYPE=$P(VART,"^",15)
 .. I BPIEN77'=0,BPIEN77'=+$$GETRQST^BPSUTIL2(IEN59) D REQSTTMP Q
 .. S LSTUDT=$$GET1^DIQ(TFILE,IEN59,7,"I")
 .. I LSTUDT<BPBDT!(LSTUDT>BPEDT) Q
 .. S LSTUDT=$P(LSTUDT,".",1)
 .. I LSTUDT="" Q
 .. S BPTYPE=$P(VART,"^",15)
 .. S BPTYPE=$S(BPTYPE="C":1,BPTYPE="U":2,BPTYPE="E":3,1:4)
 .. I $D(^TMP("BPSUSCR-1",$J,BPTYPE,LSTUDT,+IEN59)) Q  ;already has it
 .. S BPRX=$$GET1^DIQ(TFILE,IEN59,1.11,"E")
 .. S FILL=$$GET1^DIQ(TFILE,IEN59,9)
 .. S STATUS=$P(VART,"^",2)
 .. S CD0=$$GET1^DIQ(TFILE,IEN59,3,"I")
 .. I CD0'="" D
 ... S DOS=$$HL7TFM^XLFDT($$GET1^DIQ(CFILE,CD0,401))
 .. I CD0="" D
 ... S DOS=$P($G(^BPST(IEN59,12)),"^",2)
 .. S NAME=$$GET1^DIQ(TFILE,IEN59,5,"E")
 .. S SSN=""
 .. I $P(VART,"^",6)]"" S SSN=$P($G(^DPT($P(VART,"^",6),0)),"^",9),SSN=$E(SSN,$L(SSN)-3,$L(SSN))
 .. S INSCO=$P($G(^BPST(IEN59,10,1,0)),"^",7)
 .. S ^TMP("BPSUSCR-1",$J,BPTYPE,LSTUDT,IEN59)=NAME_U_SSN_U_BPRX_U_FILL_U_DOS_U_INSCO_U_STATUS
 Q
 ;
 ;Stranded requests without BPS TRANSACTION record
 ;Note the IEN59 here is a calculated ien only - the record doesn't exist
REQSTTMP ;
 N BPDFN,BPIEN78,BPX
 I BPIEN77=0 Q
 S STATUS=-96
 S LSTUDT=$$GET1^DIQ(9002313.77,BPIEN77,6.05,"I")
 I LSTUDT<BPBDT!(LSTUDT>BPEDT) Q
 S LSTUDT=$P(LSTUDT,".",1)
 I LSTUDT="" Q
 S BPTYPE=$$GET1^DIQ(9002313.77,BPIEN77,1.04,"I")
 S BPTYPE=$S(BPTYPE="C":1,BPTYPE="U":2,BPTYPE="E":3,1:4)
 I $D(^TMP("BPSUSCR-1",$J,BPTYPE,LSTUDT,+IEN59)) Q  ;already has it
 S BPRX=$$GET1^DIQ(9002313.77,BPIEN77,1.13,"E")
 S FILL=$$GET1^DIQ(9002313.77,BPIEN77,1.14)
 S DOS=$$GET1^DIQ(9002313.77,BPIEN77,2.01,"I")
 S NAME=$$GET1^DIQ(9002313.77,BPIEN77,1.15,"E")
 S BPDFN=$$GET1^DIQ(9002313.77,BPIEN77,1.15,"I")
 ; Older request might not have the Patient Name so get it from
 ;   the RX
 I BPDFN="",BPRX D
 . S NAME=$$RXAPI1^BPSUTIL1(BPRX,2,"E")
 . S BPDFN=$$RXAPI1^BPSUTIL1(BPRX,2,"I")
 S SSN=""
 I BPDFN>0 S SSN=$P($G(^DPT(BPDFN,0)),"^",9),SSN=$E(SSN,$L(SSN)-3,$L(SSN))
 S BPX=$O(^BPS(9002313.77,BPIEN77,5,0))
 I BPX>0 S BPIEN78=+$P($G(^BPS(9002313.77,BPIEN77,5,BPX,0)),U,3),INSCO=$$GET1^DIQ(9002313.78,BPIEN78,.07,"E")
 E  S INSCO="UNKNOWN"
 S ^TMP("BPSUSCR-1",$J,BPTYPE,LSTUDT,IEN59)=NAME_U_SSN_U_BPRX_U_FILL_U_DOS_U_INSCO_U_STATUS_U_BPIEN77
 Q