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

PXAICPT.m

Go to the documentation of this file.
PXAICPT ;ISL/JVS,PKR,ISA/KWP,ESW,SCK - SET THE PROCEDURE(CPT) NODES ;01/26/2021
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**19,73,108,112,149,124,164,194,211**;Aug 12, 1996;Build 454
 ;
 Q
CPT ;
SET ;--SET AND NEW VARIABLES
 N AFTER0,AFTER1,AFTER12,AFTER801,AFTER802,AFTER811,AFTER812
 N BEFOR0,BEFOR1,BEFOR12,BEFOR801,BEFOR802,BEFOR811,BEFOR812
 N EVENTDT,PXAA,PXAB,SUB,PIECE,IENB,STOP
 K PXAERR
 S PXAERR(8)=PXAK
 S PXAERR(7)="PROCEDURE"
 ;
 S SUB="" F  S SUB=$O(@PXADATA@("PROCEDURE",PXAK,SUB)) Q:SUB=""  D
 .S PXAA(SUB)=$G(@PXADATA@("PROCEDURE",PXAK,SUB))
 ;Setup PXAA array for Modifiers
 S SUB=""
 F  S SUB=$O(@PXADATA@("PROCEDURE",PXAK,"MODIFIERS",SUB)) Q:SUB=""  D
 .S PXAA("MODIFIERS",SUB)=""
 ;
VAL ;--VALIDATE ENOUGH DATA
 D VAL^PXAICPTV Q:$G(STOP)
 ;
SETVARA ;--SET V CPT VARIABLES
 S $P(AFTER0,U,1)=$G(PXAA("PROCEDURE"))
 I $G(PXAA("DELETE")) S $P(AFTER0,U,1)="@"
 S $P(AFTER0,U,2)=$G(PATIENT)
 S $P(AFTER0,U,3)=$G(PXAVISIT)
 ;If Provider Narrative is not passed or is too long use the
 ;CPT short description.
 I ($G(PXAA("NARRATIVE"))="")!($L($G(PXAA("NARRATIVE")))>245) D
 .S EVENTDT=$G(PXAA("EVENT D/T"))
 .I EVENTDT="" S EVENTDT=$P(^AUPNVSIT(PXAVISIT,0),U,1)
 .S PXAA("NARRATIVE")=$P($$CPT^ICPTCOD($G(PXAA("PROCEDURE")),EVENTDT),U,3)
 ;Get the Provider Narrative pointer.
 S $P(AFTER0,U,4)=+$$PROVNARR^PXAPI($G(PXAA("NARRATIVE")),9000010.18)
 I $P(AFTER0,U,4)'>0 D VAL04^PXAICPTV,ERR^PXAI("NARRATIVE",1) Q:$D(STOP)
 S $P(AFTER0,U,5)=$G(PXAA("DIAGNOSIS"))
 ;PX*1*124 - add dx
 S $P(AFTER0,U,9)=$G(PXAA("DIAGNOSIS 2"))
 S $P(AFTER0,U,10)=$G(PXAA("DIAGNOSIS 3"))
 S $P(AFTER0,U,11)=$G(PXAA("DIAGNOSIS 4"))
 S $P(AFTER0,U,12)=$G(PXAA("DIAGNOSIS 5"))
 S $P(AFTER0,U,13)=$G(PXAA("DIAGNOSIS 6"))
 S $P(AFTER0,U,14)=$G(PXAA("DIAGNOSIS 7"))
 S $P(AFTER0,U,15)=$G(PXAA("DIAGNOSIS 8"))
 I $G(PXAA("QTY"))="" S PXAA("QTY")=1
 S $P(AFTER0,U,16)=$G(PXAA("QTY")) I $G(PXAA("QTY"))<1 S PXAA("DELETE")=1
 S $P(AFTER0,U,17)=$G(PXAA("ORD REFERENCE"))
 I $$SWSTAT^IBBAPI() D  ;PX*1.0*164
 . S $P(AFTER0,U,19)=$G(PXAA("DEPARTMENT"))
 . I $P(AFTER0,U,19)="",$G(^AUPNVSIT(PXAVISIT,0)),$P(^AUPNVSIT(PXAVISIT,0),U,8) S $P(AFTER0,U,19)=$P($G(^DIC(40.7,$P(^AUPNVSIT(PXAVISIT,0),U,8),0)),U,2)
 ;
 S $P(AFTER12,U,1)=$G(PXAA("EVENT D/T"))
 ;PX*1*124 - add ord prv
 S $P(AFTER12,U,2)=$G(PXAA("ORD PROVIDER"))
 S $P(AFTER12,U,4)=$G(PXAA("ENC PROVIDER"))
 ;PX*1*108 - do not try to file a provider from a "DELETED" cpt
 I $G(PXAA("ENC PROVIDER"))]"",'$G(PXAA("DELETE")) D
 .S ^TMP("PXAIADDPRV",$J,$G(PXAA("ENC PROVIDER")))="ENC"
 ;PX*1*124 - do not try to file a provider from a "DELETED" cpt
 I $G(PXAA("ORD PROVIDER"))]"",'$G(PXAA("DELETE")) D
 .S ^TMP("PXAIADDPRV",$J,$G(PXAA("ORD PROVIDER")))="ORD"
 ;
 I $G(PXAA("CATEGORY"))="" S $P(AFTER802,U,1)=""
 E  D
 . S $P(AFTER802,U,1)=+$$PROVNARR^PXAPI(PXAA("CATEGORY"),9000010.18)
 . I $P(AFTER802,U,1)'>0 D
 .. D VAL802^PXAICPTV,ERR^PXAI("CATEGORY",1)
 .. S $P(AFTER802,U,1)=""
 ;
 S $P(AFTER811,U,1)=$G(PXAA("COMMENT"))
 ;
 ;--PACKAGE AND SOURCE
 S $P(AFTER812,U,2)=$S($G(PXAA("PKG"))'="":PXAA("PKG"),1:$G(PXAPKG))
 S $P(AFTER812,U,3)=$S($G(PXAA("SOURCE"))'="":PXAA("SOURCE"),1:$G(PXASOURC))
 ;
 N PXBKY,PXBSAM,PXBSKY,PXBCNT,PXI,PRV,ITEM
 D CPT^PXBGCPT(PXAVISIT)
 S ITEM=""
 I PXBCNT>0,$G(PXAA("PROCEDURE"))]"" S ITEM=$O(PXBKY(PXAA("PROCEDURE"),0))
 S IENB=+$S(ITEM'="":$O(PXBSKY(ITEM,"")),1:0)
 ;
SETPXKA ;--SET PXK ARRAY AFTER
 S ^TMP("PXK",$J,"CPT",PXAK,0,"AFTER")=AFTER0
 D SETPXKA^PXAIMOD(IENB,PXAK,.PXAA)
 S ^TMP("PXK",$J,"CPT",PXAK,12,"AFTER")=AFTER12
 S ^TMP("PXK",$J,"CPT",PXAK,802,"AFTER")=AFTER802
 S ^TMP("PXK",$J,"CPT",PXAK,811,"AFTER")=AFTER811
 S ^TMP("PXK",$J,"CPT",PXAK,812,"AFTER")=AFTER812
 ;
SETVARB ;--SET VARIABLES BEFORE
 I IENB>0 D
 .S ^TMP("PXK",$J,"CPT",PXAK,"IEN")=IENB
 .F PIECE=0,12,802,811,812 S ^TMP("PXK",$J,"CPT",PXAK,PIECE,"BEFORE")=$G(^AUPNVCPT(IENB,PIECE))
 E  D
 .S (BEFOR0,BEFOR12,BEFOR802,BEFOR811,BEFOR812)=""
 .;
SETPXKB .;--SET PXK ARRAY BEFORE
 .S ^TMP("PXK",$J,"CPT",PXAK,0,"BEFORE")=BEFOR0
 .S ^TMP("PXK",$J,"CPT",PXAK,12,"BEFORE")=BEFOR12
 .S ^TMP("PXK",$J,"CPT",PXAK,802,"BEFORE")=BEFOR802
 .S ^TMP("PXK",$J,"CPT",PXAK,811,"BEFORE")=BEFOR811
 .S ^TMP("PXK",$J,"CPT",PXAK,812,"BEFORE")=BEFOR812
 .S ^TMP("PXK",$J,"CPT",PXAK,"IEN")=$S(IENB>0:IENB,1:"")
 D SETPXKB^PXAIMOD(IENB,PXAK,.PXAA)
 ;
 ;Package and Data Source cannot be edited.
 S BEFOR812=^TMP("PXK",$J,"CPT",PXAK,812,"BEFORE")
 I BEFOR812'="" D
 . I AFTER812=BEFOR812 Q
 . I $P(BEFOR812,U,2)'="" S $P(AFTER812,U,2)=$P(BEFOR812,U,2)
 . I $P(BEFOR812,U,3)'="" S $P(AFTER812,U,3)=$P(BEFOR812,U,3)
 . S ^TMP("PXK",$J,"CPT",PXAK,812,"AFTER")=AFTER812
 ;
MISC ;--MISCELLANEOUS NODE
 ;
 Q