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

PXKFCPT1.m

Go to the documentation of this file.
PXKFCPT1 ;ISL/JVS,SCK - PROCEDURES Routine #2 ;10/20/2071
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**11,73,124,194,209,215,211**;Aug 12, 1996;Build 454
 ;
 ;
IMM ;
 N PXKSEQ1
 I PXKFGAD=1 D IMMADD
 I PXKFGDE=1 D IMMDEL
 Q
IMMADD ;
 S PXKKK=""
 S PXKSEQ1=PXKSEQ+PXKXX
 S PXKCPT=$P($P(PXKPXD(PXKX),"^",2),";")
POVNAR ;
 N EVENTDT,PXK1
 ;K ^UTILITY("DIQ1",$J) 
 ;S DIC=81,DA=PXKCPT,DR=2 D EN^DIQ1
 ;S PXKCPTN=$G(^UTILITY("DIQ1",$J,81,DA,2))
 ;K ^UTILITY("DIQ1",$J),DIC,DA,DR D
 S EVENTDT=$G(PXKAV(12,0))
 I EVENTDT="" S EVENTDT=$P(^AUPNVSIT(PXKAV(0,3),0),U,1)
 S PXK1=$$CPT^ICPTCOD(PXKCPT,EVENTDT)
 S PXKCPTN=$P(PXK1,U,3) D
 .Q:PXKCPTN=""  I $D(^AUTNPOV("B",PXKCPTN)) S PXKCPTN=$O(^AUTNPOV("B",PXKCPTN,0))
 ;
QUANTIT S PXKQUN=1,PXSTOP=0
 S PXXX=0
 F  S PXXX=$O(^AUPNVCPT("AD",PXKAV(0,3),PXXX)) Q:PXXX=""  D  Q:$G(PXSTOP)
 .I +$P(^AUPNVCPT(PXXX,0),"^")=PXKCPT D
 ..; PX*1*215 - If code already exists, quit; don't increment qty
 ..;S PXKQUN=($P(^AUPNVCPT(PXXX,0),"^",16)+1)
 ..S PXSTOP=1
 ..;S PXKKK=PXXX
 ..;S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,0,"BEFORE")=$G(^AUPNVCPT(PXXX,0))
 I $G(PXST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PXKAV(12,1))_"^"_$G(PXKAV(12,2))_"^^"_$G(PXKAV(12,4))
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,802,"AFTER")=$G(PXKCA)
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,812,"AFTER")=$G(PXKAFT(812))
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,"IEN")=PXKKK
 K PXKQUN,PXKCPTN,PXKCA,PXXX,PXKKK
 Q
IMMDEL ;Retrieve all CPT information for VISIT from V CPT file
 S PXKSEQ1=PXKSEQ+PXKXX
 S (XPFG,XP)=0 F  Q:XPFG  S XP=$O(^AUPNVCPT("AD",PXKVST,XP)) Q:XP=""  D
 .I $P(^AUPNVCPT(XP,0),"^",1)=$P($P(PXKPXD(PXKX),"^",2),";") D  S XPFG=1
 ..I $P($G(^AUPNVCPT(XP,0)),"^",16)=1 D IMMDEL1
 ..I $D(XP),$P($G(^AUPNVCPT(XP,0)),"^",16)>1 D IMMDEL2
 Q
IMMDEL1 ;
 N PXKSEQ2,PXKMOD
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,0,"BEFORE")=$G(^AUPNVCPT(XP,0))
 S PXKSEQ2=0
 F  S PXKSEQ2=$O(^AUPNVCPT(XP,1,PXKSEQ2)) Q:'PXKSEQ2  D
 .S PXKMOD=^AUPNVCPT(XP,1,PXKSEQ2,0)
 .S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,1,PXKSEQ2,"BEFORE")=PXKMOD
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,12,"BEFORE")=$G(^AUPNVCPT(XP,12))
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,802,"BEFORE")=$G(^AUPNVCPT(XP,802))
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,812,"BEFORE")=$G(^AUPNVCPT(XP,812))
 S ^TMP("PXKSAVE",$J,"CPT",PXKSEQ1,"IEN")=XP
 S ^TMP("PXKSAVE",$J,"CPT",PXK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