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

PXBPCPT2.m

Go to the documentation of this file.
PXBPCPT2 ;WASH/BDB - PROMPT PROCEDURE DIAGNOSES ;10 Jun 2013  1:58 PM
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**124,170,199**;Aug 12, 1996;Build 51
 ;
 Q  ;not an entry
 ;
CDX(PXN) ;--Diagnosis for Procedure
 N CDX,CPTDX,DIC,POS,PXACS,PXC,PXCEAFTR,PXCEVIEN,PXD,PXDISV,PXDXDATE,PXICDDATA,TIMED,VAL,X
CPT1 K PXBUT,EDATA,LEXVDT
 S PXDXDATE=$$CSDATE^PXDXUTL(PXBVST)
 S PXACSREC=$$ACTDT^PXDXUTL(PXDXDATE),PXACS=$P(PXACSREC,U,3)
 I PXACS["-" S PXACS=$P(PXACS,"-",1,2)
 S POS=PXN+11,CPTDX=$P($P(REQE,U,POS)," "),PXDISV="PXBCPTDX-"_POS
 S TIMED="I '$T!(DATA[""^"")",PXD=$P(REQI,U,POS),PXC=$P(REQI,U,3)
 S DIC("S")="I $P($$ICDDATA^ICDXCODE(""DIAG"",Y,PXDXDATE,""E""),U,10)"
PCPT1 ;SECOND ENTRY POINT
 W !," What is ",PXACS," DIAGNOSIS "_PXN_" for this procedure: "_$S($L(CPTDX):CPTDX_"//",1:""),IOELEOL
 R DATA:DTIME S:DATA="" DATA=CPTDX S EDATA=DATA G:DATA="" CDXX1
P1CPT1 ;--
 X TIMED I  S PXBUT=1,LEAVE=1 G CDXX1
 I DATA="^D" G CDXX1
 I DATA="^"!(DATA="^^") S PXBEXIT=0 G CDXX1
 I DATA="@",'$G(PXD) S DATA="?"
 I DATA="@" K PXBREQ(PXD) S $P(REQI,U,POS)="@" G CDXX1
 ;I DATA="",PXN=1 W !,"PRIMARY DIAGNOSIS IS REQUIRED!" G CPT1
 I DATA="?" D EN1^PXBHLP0("PXB","POV",1,"",1) G CPT1
 ;I DATA="??" S DOUBLEQQ=1 D EN1^PXBHLP0("PXB","POV",1,"",2) S:$L(DATA,"^")>1 (Y,DATA,EDATA)=$P($P(DATA,"^",2),"--",1) G:Y>1 PFINCPT1 G:Y?1A1.NP PFINCPT1
 I DATA="??" D EN1^PXBHLP0("PXB","POV",1,"",2) G CPT1
 I $L(DATA)>200 S (DATA,EDATA)=$E(DATA,1,199)
 ;---SPACE BAR---
 I DATA=" ",$D(^DISV(DUZ,PXDISV)) S (DATA,EDATA)=^DISV(DUZ,PXDISV) W DATA
 I DATA=" " S (DATA,EDATA)="" G CDXX1
 ;-----
 ;--Do a DIC lookup on data if a "?" is NOT entered
 D CLEAR^VALM1,FULL^VALM1  ; added in *199 to allow full scrolling of long lists
 W "Searching for diagnosis codes...",! ; added in *199
 K X,DIC
 S X=EDATA
 I $P(PXACSREC,U,1)'="ICD" D
 . S PXDATE=PXDXDATE,PXDEF=$G(X),PXAGAIN=0 D ^PXDSLK I PXXX=-1 S Y=-1 Q
 . S Y($P(PXACSREC,U,2))=$P($P(PXXX,U,1),";",2)
 . S Y=$P(PXXX,";",1)_U_$P(PXXX,U,2)
 I $P(PXACSREC,U,1)="ICD" D
 . D CONFIG^LEXSET($P(PXACSREC,U,1),,PXDXDATE)
 . S DIC("A")="Select "_PXACS_" Diagnosis: "
 . S DIC="^LEX(757.01,",DIC(0)=$S('$L(X):"A",1:"")_"EQM"
 . D ^DIC
 I $G(X)="@" Q
 I Y=-1 S DATA="^P" G P1CPT1
 S WHAT=$G(Y($P(PXACSREC,U,2)))
 S (DATA,EDATA)=WHAT K Y
 S PXICDDATA=$$ICDDATA^ICDXCODE("DIAG",WHAT,PXDXDATE,"E")
 S Y=$S($P(PXICDDATA,U,10)=0:-1,1:$P(PXICDDATA,U,1,2))
 S Y(0)=$P(PXICDDATA,U,2,99)
 ;
PFINCPT1 ;--Finish DIAGNOSIS
 I $L(Y,U)'>1 S X=Y,DIC=80,DIC(0)="IZM" D ^DIC
 I +Y<0 D HELP1^PXBUTL1("POV") G CPT1
 I $$DUP(+Y) W !,$P(Y,U,2)," IS ALREADY A DIAGNOSIS!" G PCPT1
 S CDX=Y(0),^DISV(DUZ,PXDISV)=DATA,$P(REQI,U,POS)=+Y
 S $P(REQE,U,POS)=$P(CDX,U,1)_" --"_$P(CDX,U,3)
 I $D(PXBREQ(+Y,"I")) G CDXX1
 I 'PXBDXPRI D
 .D PRI^PXBPPOV1 ;PRI/SEC
 .I '$D(DIRUT),$P(REQI,U,6)="P" S PXBDXPRI=+Y
 S PXCEVIEN=PXBVST,PXDX=Y
 D WIN17^PXBCC(PXBCNT),GET800^PXCEC800 ;CI's
 I $G(PXCEQUIT) S $P(REQE,U,POS)=""
 I '$G(PXCEQUIT) S PXBREQ(+PXDX,"I")=PXCEAFTR(800)
 I '$G(PXCEQUIT) D EN0^PXBSTOR(PXBVST,PATIENT,REQI,.PXMREQ),EN1^PXKMAIN
CDXX1 ;--EXIT AND CLEAN UP
 I '$D(REQE) S REQE=""
 I $P(REQE,U,POS)="" S $P(REQI,U,POS)=""
 D CLEAR^VALM1 S VALMBCK="R"
 Q
 ;
DUP(CD) ;DUPLICATE?
 N ANS,CTR
 S ANS=0
 F CTR=12:1:19 I CTR'=POS,$P(REQI,U,CTR)=CD S ANS=1 Q
 Q ANS
 ;