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

PXCAPOV.m

Go to the documentation of this file.
  1. PXCAPOV ;ISL/dee & LEA/Chylton - Validates data from the PCE Device Interface into PCE's PXK format for POV ;3/20/97
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**24,27,33**;Aug 12, 1996
  1. Q
  1. ; Variables
  1. ; PXCADIAG Copy of a Diagnosis node of the PXCA array
  1. ; PXCAPRV Pointer to the provider (200)
  1. ; PXCANUMB Count of the number if POVs
  1. ; PXCAINDX Count of the number of Diagnoses for one provider
  1. ;
  1. DIAG(PXCA,PXCABULD,PXCAERRS) ;Validation routine for POV
  1. N PXCADIAG,PXCAPRV,PXCANUMB,PXCAINDX
  1. S PXCAPRV=""
  1. S PXCANUMB=0
  1. F S PXCAPRV=$O(PXCA("DIAGNOSIS",PXCAPRV)) Q:PXCAPRV']"" D
  1. . I PXCAPRV>0 D
  1. .. I '$$ACTIVPRV^PXAPI(PXCAPRV,PXCADT) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,0,0)="Provider is not active or valid^"_PXCAPRV
  1. .. E I PXCABULD!PXCAERRS D ANOTHPRV^PXCAPRV(PXCAPRV)
  1. . S PXCAINDX=0
  1. . F S PXCAINDX=$O(PXCA("DIAGNOSIS",PXCAPRV,PXCAINDX)) Q:PXCAINDX']"" D
  1. .. S PXCADIAG=$G(PXCA("DIAGNOSIS",PXCAPRV,PXCAINDX))
  1. .. S PXCANUMB=PXCANUMB+1
  1. .. I PXCADIAG="" S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,0)="DIAGNOSIS data missing" Q
  1. .. N PXCAITEM,PXCAITM2,PXCAPNAR,PXCANARC,PXCACLEX
  1. .. ;
  1. .. S PXCAITEM=$P(PXCADIAG,"^",1)
  1. .. D
  1. ... N DIC,DR,DA,DIQ,PXCADIQ1
  1. ... S DIC=80
  1. ... S DR=".01;102"
  1. ... S DA=$S(PXCAITEM'="":PXCAITEM,1:-1)
  1. ... S DIQ="PXCADIQ1("
  1. ... S DIQ(0)="I"
  1. ... D EN^DIQ1
  1. ... I $G(PXCADIQ1(80,DA,.01,"I"))="" S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,1)="ICD9 Code not in file 80^"_PXCAITEM
  1. ... E I $G(PXCADIQ1(80,DA,102,"I")),PXCADIQ1(80,DA,102,"I")'>+PXCADT S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,1)="ICD9 Code is INACTIVE^"_PXCAITEM
  1. .. S PXCAITEM=$P(PXCADIAG,"^",2)
  1. .. I '(PXCAITEM=""!(PXCAITEM="P")!(PXCAITEM="S")) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,2)="Diagnosis specification code must be P|S^"_PXCAITEM
  1. .. E I PXCAITEM="P" D
  1. ... I 'PXCAPDX S PXCAPDX=$P(PXCADIAG,"^",1)
  1. ... E I $P($G(^PX(815,1,"DI")),"^",2) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,2)="There is already a Primary Diagnosis for this encounter^"_PXCAITEM
  1. ... E D
  1. .... S PXCA("WARNING","DIAGNOSIS",PXCAPRV,PXCAINDX,2)="There is already a Primary Diagnosis. This one is changed to Secondary^"_PXCAITEM
  1. .... S $P(PXCADIAG,"^",2)="S"
  1. .. S PXCAITEM=$P(PXCADIAG,"^",3)
  1. .. I '(PXCAITEM=1!(PXCAITEM=0)!(PXCAITEM="")) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,3)="SC flag bad^"_PXCAITEM
  1. .. S PXCAITEM=$P(PXCADIAG,"^",4)
  1. .. I '(PXCAITEM=1!(PXCAITEM=0)!(PXCAITEM="")) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,4)="AO flag bad^"_PXCAITEM
  1. .. S PXCAITEM=$P(PXCADIAG,"^",5)
  1. .. I '(PXCAITEM=1!(PXCAITEM=0)!(PXCAITEM="")) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,5)="IR flag bad^"_PXCAITEM
  1. .. S PXCAITEM=$P(PXCADIAG,"^",6)
  1. .. I '(PXCAITEM=1!(PXCAITEM=0)!(PXCAITEM="")) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,6)="EC flag bad^"_PXCAITEM
  1. .. S PXCAITEM=$P(PXCADIAG,"^",7)
  1. .. I PXCAITEM]"" D
  1. ... I $G(^AUPNPROB(PXCAITEM,0))="" S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,7)="Problem not in file 9000011^"_PXCAITEM
  1. ... E I PXCAPAT'=$P($G(^AUPNPROB(PXCAITEM,0)),"^",2) S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,7)="Problem in file 9000011 is for a different Patient^"_PXCAITEM
  1. .. ;
  1. .. ;Clinical Lexicon Term
  1. .. S PXCAITEM=$P(PXCADIAG,"^",10)
  1. .. I PXCAITEM]"" D
  1. ... I $D(^LEX(757.01)) D
  1. .... I $D(^LEX(757.01,PXCAITEM,0))#2'=1 S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,10)="Lexicon Utility term is not in file 757.01^"_PXCAITEM
  1. .... E S PXCACLEX=PXCAITEM
  1. ... E I $D(^GMP(757.01)) D
  1. .... I $D(^GMP(757.01,PXCAITEM,0))#2'=1 S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,10)="Clinical Lexicon Utility term is not in file 757.01^"_PXCAITEM
  1. .... E S PXCACLEX=PXCAITEM
  1. ... E S PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX,10)="Lexicon Utility is not installed^"_PXCAITEM
  1. .. ;
  1. .. D PART1^PXCAPOV1
  1. .. ;
  1. .. I PXCABULD&'$D(PXCA("ERROR","DIAGNOSIS",PXCAPRV,PXCAINDX))!PXCAERRS D POV^PXCADX(PXCADIAG,PXCANUMB,PXCAPRV,PXCAERRS)
  1. Q
  1. ;