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

PXBSTOR.m

Go to the documentation of this file.
PXBSTOR ;ISL/JVS - PASSING THE DATA TO THE V FILES ;7/24/96  10:29
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**73,88**;Aug 12, 1996
 ;
 ;
 ;  VARIABLE LIST
 ;  PEICE   1        2     3     4      5     6       7       8       9
 ;  REQ*=PROVDER^PRIMARY^CPT^QUANTITY^POV^PRIMARY^PRV IEN^CPT IEN^POV IEN
 ;  PEICE   10       11
 ;  REQ  STOPCODE^STOPCODE IEN
 ;  REQ(1,MODIFIER)*=""
 ;  REQ("IEN")=V CPT file IEN
 ;  REQI=Internal Values
 ;  REQE=External Values
 ;  PXBVST=Visit Ien
 ;  PRVIEN=Provider IEN in V Provider file
 ;  CPTIEN=CPT IEN in the V CPT file
 ;  POVIEN=POV INE in the V POV file
 ;  patient is defined form the visit
 ;
EN0(PXBVST,PATIENT,REQI,REQ) ;--Main Entry point
EN1 ;
 Q:'$D(REQI)
 K ^TMP("PXK",$J) ;--MUST BE MOVED TO AFTER THE EVENT
 N PRVIEN,CPTIEN,POVIEN,PRVBEF,CPTBEF,POVBEF,PPRNARR,CPRNARR
 N POVBEF12,PRVAFT,PRVAFT12,PRVBEF12
 N CPTAFT,CPTAFT1,CPTBEF1,CPTAFT12,CPTBEF12
 N POVAFT12,POVAFT,POVI
 N PRVBF812,CPTBF812,POVBF812,PRVAF812,CPTAF812,POVAF812
 N SEQ
IEN ;--SET IENS OF EACH FILE
 S PRVIEN=$P(REQI,"^",7) I PRVIEN]"" D
 .S PRVBEF=$G(^AUPNVPRV($P(REQI,"^",7),0))
 .S PRVBEF12=$G(^AUPNVPRV($P(REQI,"^",7),12))
 .S PRVBF812=$G(^AUPNVPRV($P(REQI,"^",7),812))
 E  S (PRVBEF,PRVBEF12,PRVBF812)=""
 S CPTIEN=$P(REQI,"^",8)
 I CPTIEN]"" D
 .S CPTBEF=$G(^AUPNVCPT($P(REQI,"^",8),0))
 .;Build array for cpt modifiers
 .N SUBIEN
 .S SUBIEN=0
 .F  S SUBIEN=$O(^AUPNVCPT($P(REQI,"^",8),1,SUBIEN)) Q:'SUBIEN  D
 ..S CPTBEF1(SUBIEN)=$G(^AUPNVCPT($P(REQI,"^",8),1,SUBIEN,0))
 .S CPTBEF12=$G(^AUPNVCPT($P(REQI,"^",8),12))
 .S CPTBF812=$G(^AUPNVCPT($P(REQI,"^",8),812))
 E  S (CPTBEF,CPTBEF12,CPTBF812)=""
 S POVIEN=$P(REQI,"^",9) I POVIEN]"" D
 .S POVBEF=$G(^AUPNVPOV($P(REQI,"^",9),0))
 .S POVBEF12=$G(^AUPNVPOV($P(REQI,"^",9),12))
 .S POVBF812=$G(^AUPNVPOV($P(REQI,"^",9),812))
 E  S (POVBEF,POVBEF12,POVBF812)=""
 ;
SET ;--SET TEMP GLOBALS
 D MISC
 I '$D(^TMP("PXBSTOR",$J,"SEQ")) S SEQ=1
 I $D(^TMP("PXBSTOR",$J,"SEQ")) S SEQ=^TMP("PXBSTOR",$J,"SEQ")
 D:$P(REQI,"^",1) PRV S SEQ=SEQ+1
 D:$P(REQI,"^",3) CPT S SEQ=SEQ+1
 D:$P(REQI,"^",5) POV S SEQ=SEQ+1
 S ^TMP("PXBSTOR",$J,"SEQ")=SEQ+1
 Q
MISC ;--SET MISCELLANEOUS TEMP NODES
 ;--*** CONDITION THE SOURCE
 I '$G(SOURCE) S ^TMP("PXK",$J,"SOR")=$O(^PX(839.7,"B","SD/PCE-INTERFACE-PROMPTS",0))
 ;-------------
 S ^TMP("PXK",$J,"VST",1,"IEN")=PXBVST
 S ^TMP("PXK",$J,"VST",1,0,"AFTER")=$G(^AUPNVSIT(PXBVST,0))
 S ^TMP("PXK",$J,"VST",1,0,"BEFORE")=$G(^AUPNVSIT(PXBVST,0))
 Q
 ;
PRV ;--PROVIDER PIECE 1 AND 2
 S PRVAFT=PRVBEF,PRVAFT12=PRVBEF12,PRVAF812=PRVBF812
 I $D(DELM),$P(DELM,"^",1)=1 S (PRVAFT,PRVAFT12)="" G PRV1
 S $P(PRVAFT,"^",1)=$P(REQI,"^",1) ;--PROVIDER IEN
 S $P(PRVAFT,"^",4)=$P(REQI,"^",2) ;--PRIMARY/SECONDARY
 S $P(PRVAFT,"^",2)=PATIENT ;--PATIENT
 S $P(PRVAFT,"^",3)=PXBVST ;--VISIT POINTER
 I PRVBF812']"" D
 .;-***POPULATE VERIFIED FIELD IN FUTURE
 .S $P(PRVAF812,"^",2)=$G(PXBPKG)
 .S $P(PRVAF812,"^",3)=$G(PXBSOURC)
PRV1 S ^TMP("PXK",$J,"PRV",SEQ,0,"AFTER")=PRVAFT
 S ^TMP("PXK",$J,"PRV",SEQ,0,"BEFORE")=PRVBEF
 S ^TMP("PXK",$J,"PRV",SEQ,12,"AFTER")=PRVAFT12
 S ^TMP("PXK",$J,"PRV",SEQ,12,"BEFORE")=PRVBEF12
 S ^TMP("PXK",$J,"PRV",SEQ,812,"AFTER")=PRVAF812
 S ^TMP("PXK",$J,"PRV",SEQ,812,"BEFORE")=PRVBF812
 S ^TMP("PXK",$J,"PRV",SEQ,"IEN")=PRVIEN
 Q
 ;
CPT ;--CPT PROCDEURE PIECE 3 AND 4 AND
 N PXMODIEN
 S CPTAFT=CPTBEF,CPTAFT12=CPTBEF12,CPTAF812=CPTBF812
 I $D(DELM),$P(DELM,"^",2)=1 S (CPTAFT,CPTAFT12)="" G CPT1
 S $P(CPTAFT,"^",1)=$P(REQI,"^",3) ;--PROCEDURE IEN 
 S $P(CPTAFT,"^",2)=PATIENT ;--PATIENT
 S $P(CPTAFT,"^",3)=PXBVST ;--VISIT POINTER
 S $P(CPTAFT12,"^",4)=$P(REQI,"^",1) ;--PROVIDER POINTER
 S CPRNARR=$$EXTTEXT^PXUTL1($P(REQI,"^",3),1,81,2) ;--TEXT PROV NARR
 S $P(CPTAFT,"^",4)=+$$PROVNARR^PXAPI($G(CPRNARR),9000010.18) ;--PROV NAR
 S $P(CPTAFT,"^",16)=$P(REQI,"^",4) ;--QUANTITY
 I $P(REQI,"^",4)=0 S (CPTAFT,CPTAFT12)=""
 I $P(REQI,"^",4)="@" S (CPTAFT,CPTAFT12)=""
 ;--------------------
 ;I $G(CPTIEN),$D(^AUPNVCPT(CPTIEN,12)),$P(REQI,"^",1)'=$P(^AUPNVCPT(CPTIEN,12),"^",4),'$D(DELM) S (CPTIEN,CPTBEF,CPTBEF12)=""
 ;---------------
 I CPTBF812']"" D
 .;-***POPULATE VERIFIED FIELD IN FUTURE
 .S $P(CPTAF812,"^",2)=$G(PXBPKG)
 .S $P(CPTAF812,"^",3)=$G(PXBSOURC)
 S PXMODIEN=""
 F  S PXMODIEN=$O(REQ(1,PXMODIEN)) Q:PXMODIEN=""  D
 .S CPTAFT1(PXMODIEN)=REQ(1,PXMODIEN)
CPT1 ;
 S ^TMP("PXK",$J,"CPT",SEQ,0,"AFTER")=CPTAFT
 S ^TMP("PXK",$J,"CPT",SEQ,0,"BEFORE")=CPTBEF
 S ^TMP("PXK",$J,"CPT",SEQ,12,"AFTER")=CPTAFT12
 S ^TMP("PXK",$J,"CPT",SEQ,12,"BEFORE")=CPTBEF12
 S ^TMP("PXK",$J,"CPT",SEQ,812,"AFTER")=CPTAF812
 S ^TMP("PXK",$J,"CPT",SEQ,812,"BEFORE")=CPTBF812
 S ^TMP("PXK",$J,"CPT",SEQ,"IEN")=CPTIEN
 ;Set modifiers into ^TMP
 S PXMODIEN=""
 F  S PXMODIEN=$O(CPTAFT1(PXMODIEN)) Q:PXMODIEN=""  D
 .S ^TMP("PXK",$J,"CPT",SEQ,1,PXMODIEN,"AFTER")=CPTAFT1(PXMODIEN)
 S PXMODIEN=""
 F  S PXMODIEN=$O(CPTBEF1(PXMODIEN)) Q:PXMODIEN=""  D
 .S ^TMP("PXK",$J,"CPT",SEQ,1,PXMODIEN,"BEFORE")=CPTBEF1(PXMODIEN)
 ;Set ^TMP file with V CPT IEN
 I $G(REQ)]"" D
 . S ^TMP("PXK",$J,"CPT",SEQ,"IEN")=REQ
 Q
 ;
POV ;--POV PIECE 5 AND 6 AND
 S POVAFT=POVBEF,POVAFT12=POVBEF12,POVAF812=PRVBF812
 I $D(DELM),$P(DELM,"^",3)=1 S (POVAFT,POVAFT12)="" G POV1
 S $P(POVAFT,"^",1)=$P(REQI,"^",5) ;--POV IEN 
 S $P(POVAFT,"^",12)=$P(REQI,"^",6) ;--PRI/SECONDARY
 S $P(POVAFT,"^",2)=PATIENT ;--PATIENT
 S $P(POVAFT,"^",3)=PXBVST ;--VISIT POINTER
 S PPRNARR=$$EXTTEXT^PXUTL1($P(REQI,"^",5),1,80,10) ;--TEXT PROV NARR
 S $P(POVAFT,"^",4)=+$$PROVNARR^PXAPI($G(PPRNARR),9000010.07) ;--POI PROV NARR
 I $P($G(REQI),"^",7) S $P(POVAFT12,"^",4)=$P(^AUPNVPRV($P(REQI,"^",7),0),"^",1) ;--PROVIDER
 I $G(PXBRES) S $P(POVAFT,"^",16)=PXBRES ;-PROBLEM LIST ENTRY
 I POVBF812']"" D
 .;-**POPULATE VERIFIED FIELD IN FUTURE
 .S $P(POVAF812,"^",2)=$G(PXBPKG)
 .S $P(POVAF812,"^",3)=$G(PXBSOURC)
POV1 S ^TMP("PXK",$J,"POV",SEQ,0,"AFTER")=POVAFT
 S ^TMP("PXK",$J,"POV",SEQ,0,"BEFORE")=POVBEF
 S ^TMP("PXK",$J,"POV",SEQ,12,"AFTER")=POVAFT12
 S ^TMP("PXK",$J,"POV",SEQ,12,"BEFORE")=POVBEF12
 S ^TMP("PXK",$J,"POV",SEQ,812,"AFTER")=POVAF812
 S ^TMP("PXK",$J,"POV",SEQ,812,"BEFORE")=POVBF812
 S ^TMP("PXK",$J,"POV",SEQ,"IEN")=POVIEN
 Q