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

PXCA0.m

Go to the documentation of this file.
  1. PXCA0 ;ISL/dee - Main routine for PCE Device Interface Module ;11/20/96
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**5,14,33,124**;Aug 12, 1996
  1. Q
  1. ;
  1. ;Variables:
  1. ; PXCANPRV Count of the number of providers
  1. ; PXCANPOV Count of the number of diagnoses
  1. ; PXCADT Encounter Date/Time
  1. ; PXCAPAT Pointer to the patient (9000001 & 2)
  1. ; PXCAHLOC Pointer to Hospital Location (44)
  1. ; PXCACSTP Pointer to the Credit Stop (40.7)
  1. ; PXCAGLB First sub script of ^TMP(
  1. ; is "PXK" to send to PXK*
  1. ; is "PXCA" to use correct data errors
  1. ; PXCAERRS Flag if
  1. ; true then builds ^TMP(PXCAGLB,$J, even if there are
  1. ; errors, used to build the input data so that the user
  1. ; can fix the error and create or correct the entry.
  1. ; false does not build ^TMP(PXCAGLB,$J, when there is an
  1. ; error in the data need to build it.
  1. ; PXCADNUM Index into ^TMP( for the diagnosis on a "DIAGNOSIS/PROBLEM"
  1. ; node so that the problem number add after calling
  1. ; Problem List
  1. ;
  1. EN ;Entry called form PXCAEP.
  1. I '$D(PXCA) S PXCA("ERROR","ENCOUNTER",0,0,0)="Local data array is missing" Q
  1. N PXCADT,PXCAPAT,PXCAHLOC,PXCACSTP,PXCAPPRV,PXCAPDX,PXKDUZ,PXCADNUM
  1. S PXKDUZ=DUZ
  1. D BUILD("PXK",0)
  1. D:'$D(PXCA("ERROR")) FINISH("PXK")
  1. D:$D(PXKERROR) PXKERROR^PXCAERR("PXK")
  1. D EXIT("PXK")
  1. Q
  1. ;
  1. BUILD(PXCAGLB,PXCAERRS) ;Takes an PXCA array and builds the ^TMP(PXCAGLB,$J, array.
  1. ;
  1. N PXCANPRV,PXCANPOV
  1. K PXKERROR
  1. K ^TMP(PXCAGLB,$J)
  1. S PXCANPRV=0,PXCANPOV=0
  1. ;
  1. D PROCESS(.PXCA,1,PXCAERRS)
  1. ;
  1. I $D(ZTQUEUED),$D(PXCA("ERROR")) S PXKERROR("PXCA")="There were errors in the data validation in the tasked job, no data was stored."
  1. Q
  1. ;
  1. PROCESS(PXCA,PXCABULD,PXCAERRS) ;
  1. N PXCAEVAL S PXCAEVAL=0
  1. I '($D(PXKDUZ)#2) N PXCAPAT,PXCAHLOC,PXCACSTP,PXCAPPRV,PXCAPDX,PXKDUZ,PXCADNUM,PXCADT S PXKDUZ=DUZ
  1. N PXCAPKG,PXCASOR
  1. S PXCAVSIT=""
  1. S PXCAPKG=$$PKG2IEN^VSIT("PX")
  1. S PXCASOR=$P($G(PXCA("SOURCE")),"^",1)
  1. S (PXCAPPRV,PXCAPDX)=0
  1. D
  1. . N PXCAENC
  1. . S PXCAENC=$G(PXCA("ENCOUNTER"))
  1. . S PXCADT=+$P(PXCAENC,"^",1)
  1. . S PXCAPAT=+$P(PXCAENC,"^",2)
  1. . D:PXCAPAT PATINFO^PXCEPAT(.PXCAPAT)
  1. . S PXCAHLOC=+$P(PXCAENC,"^",3)
  1. . ; - ignore stop code passed in and always use the one for
  1. . ; the Hospital Location
  1. . S PXCACSTP=$P($G(^SC(PXCAHLOC,0)),"^",7)
  1. . S PXCAVSIT=$$LOOKVSIT^PXUTLVST(PXCAPAT,PXCADT,PXCAHLOC,PXCACSTP,"","")
  1. . S:PXCAVSIT<1 PXCAVSIT=""
  1. ;
  1. I PXCAVSIT>0 D
  1. . ; - return error if trying to send data for a disposition
  1. . I $$DISPOSIT^PXUTL1(PXCAPAT,PXCADT,PXCAVSIT) S PXCA("ERROR","ENCOUNTER",0,0,0)="Dispositions can only be done through the Disposition menu options"
  1. . S PXCAPPRV=$$PRIMVPRV^PXUTL1(PXCAVSIT)
  1. . S PXCAPDX=$$PRIMVPOV^PXUTL1(PXCAVSIT)
  1. ;
  1. D ENCOUNT^PXCAVST(.PXCA,PXCABULD,PXCAERRS,.PXCAEVAL)
  1. D SOURCE^PXCASOR(.PXCA,PXCABULD,PXCAERRS)
  1. ;
  1. D PROV^PXCAPRV(.PXCA,PXCABULD,PXCAERRS)
  1. D DIAG^PXCAPOV(.PXCA,PXCABULD,PXCAERRS)
  1. D PROC^PXCACPT(.PXCA,PXCABULD,PXCAERRS,PXCAEVAL)
  1. ;
  1. D HFACTORS^PXCAHF(.PXCA,PXCABULD,PXCAERRS)
  1. D IMMUN^PXCAVIMM(.PXCA,PXCABULD,PXCAERRS)
  1. D PATED^PXCAPED(.PXCA,PXCABULD,PXCAERRS)
  1. D SKINTEST^PXCASK(.PXCA,PXCABULD,PXCAERRS)
  1. D EXAM^PXCAXAM(.PXCA,PXCABULD,PXCAERRS)
  1. ;
  1. ;Have Vitals validate its data.
  1. D:$L($T(VALIDATE^GMRVPCE0)) VALIDATE^GMRVPCE0(.PXCA)
  1. ;
  1. D PROBLEM^PXCAPL(.PXCA,PXCABULD,PXCAERRS)
  1. ;
  1. D DXPL^PXCADXPL(.PXCA,PXCABULD,PXCAERRS) ;must be after DIAG^PXCAPOV
  1. ;
  1. ;Message if there are no Primary diagnoses
  1. I 'PXCAPDX D
  1. . I $P($G(^PX(815,1,"DI")),"^",3) S PXCA("ERROR","DIAGNOSIS",0,0,2)="There is no Primary Diagnosis for this encounter^"
  1. . E S PXCA("WARNING","DIAGNOSIS",0,0,2)="There is no Primary Diagnosis for this encounter^"
  1. ;
  1. D KVA^VADPT
  1. Q
  1. ;
  1. FINISH(PXCAGLB) ;
  1. ;
  1. ;Have Vitals process its data.
  1. I $L($T(VALIDATE^GMRVPCE0)),$L($T(STORE^GMRVPCE0)) D STORE^GMRVPCE0(.PXCA)
  1. ;
  1. ;Now store the problems into Problem List
  1. ; That are in the "PROBLEM" node
  1. D PROBLIST^PXCAPL1
  1. ; That are in the "DIAGNOSIS/PROBLEM" node
  1. D PROBLIST^PXCAPL2
  1. ;
  1. ;Now store the rest of the information in the V-Files
  1. ; - save PXKERRORs from problem list calls in PXCAPXKE
  1. N PXCAPXKE
  1. M PXCAPXKE=PXKERROR
  1. D EN1^PXKMAIN
  1. M PXKERROR=PXCAPXKE
  1. ; - setting PXCAVSIT for use in PXCAERR
  1. S PXCAVSIT=+$G(^TMP(PXCAGLB,$J,"VST",1,"IEN"))
  1. ;Now do the event to tell the rest of the world about the new info.
  1. D EVENT^PXKMAIN
  1. ;
  1. Q
  1. ;
  1. EXIT(PXCAGLB) ;Done clean up and exit.
  1. K PXKERROR
  1. K ^TMP(PXCAGLB,$J)
  1. D PATKILL^PXCEPAT
  1. Q
  1. ;