[613] | 1 | PXCA0 ;ISL/dee - Main routine for PCE Device Interface Module ;11/20/96
|
---|
| 2 | ;;1.0;PCE PATIENT CARE ENCOUNTER;**5,14,33,124**;Aug 12, 1996
|
---|
| 3 | Q
|
---|
| 4 | ;
|
---|
| 5 | ;Variables:
|
---|
| 6 | ; PXCANPRV Count of the number of providers
|
---|
| 7 | ; PXCANPOV Count of the number of diagnoses
|
---|
| 8 | ; PXCADT Encounter Date/Time
|
---|
| 9 | ; PXCAPAT Pointer to the patient (9000001 & 2)
|
---|
| 10 | ; PXCAHLOC Pointer to Hospital Location (44)
|
---|
| 11 | ; PXCACSTP Pointer to the Credit Stop (40.7)
|
---|
| 12 | ; PXCAGLB First sub script of ^TMP(
|
---|
| 13 | ; is "PXK" to send to PXK*
|
---|
| 14 | ; is "PXCA" to use correct data errors
|
---|
| 15 | ; PXCAERRS Flag if
|
---|
| 16 | ; true then builds ^TMP(PXCAGLB,$J, even if there are
|
---|
| 17 | ; errors, used to build the input data so that the user
|
---|
| 18 | ; can fix the error and create or correct the entry.
|
---|
| 19 | ; false does not build ^TMP(PXCAGLB,$J, when there is an
|
---|
| 20 | ; error in the data need to build it.
|
---|
| 21 | ; PXCADNUM Index into ^TMP( for the diagnosis on a "DIAGNOSIS/PROBLEM"
|
---|
| 22 | ; node so that the problem number add after calling
|
---|
| 23 | ; Problem List
|
---|
| 24 | ;
|
---|
| 25 | EN ;Entry called form PXCAEP.
|
---|
| 26 | I '$D(PXCA) S PXCA("ERROR","ENCOUNTER",0,0,0)="Local data array is missing" Q
|
---|
| 27 | N PXCADT,PXCAPAT,PXCAHLOC,PXCACSTP,PXCAPPRV,PXCAPDX,PXKDUZ,PXCADNUM
|
---|
| 28 | S PXKDUZ=DUZ
|
---|
| 29 | D BUILD("PXK",0)
|
---|
| 30 | D:'$D(PXCA("ERROR")) FINISH("PXK")
|
---|
| 31 | D:$D(PXKERROR) PXKERROR^PXCAERR("PXK")
|
---|
| 32 | D EXIT("PXK")
|
---|
| 33 | Q
|
---|
| 34 | ;
|
---|
| 35 | BUILD(PXCAGLB,PXCAERRS) ;Takes an PXCA array and builds the ^TMP(PXCAGLB,$J, array.
|
---|
| 36 | ;
|
---|
| 37 | N PXCANPRV,PXCANPOV
|
---|
| 38 | K PXKERROR
|
---|
| 39 | K ^TMP(PXCAGLB,$J)
|
---|
| 40 | S PXCANPRV=0,PXCANPOV=0
|
---|
| 41 | ;
|
---|
| 42 | D PROCESS(.PXCA,1,PXCAERRS)
|
---|
| 43 | ;
|
---|
| 44 | I $D(ZTQUEUED),$D(PXCA("ERROR")) S PXKERROR("PXCA")="There were errors in the data validation in the tasked job, no data was stored."
|
---|
| 45 | Q
|
---|
| 46 | ;
|
---|
| 47 | PROCESS(PXCA,PXCABULD,PXCAERRS) ;
|
---|
| 48 | N PXCAEVAL S PXCAEVAL=0
|
---|
| 49 | I '($D(PXKDUZ)#2) N PXCAPAT,PXCAHLOC,PXCACSTP,PXCAPPRV,PXCAPDX,PXKDUZ,PXCADNUM,PXCADT S PXKDUZ=DUZ
|
---|
| 50 | N PXCAPKG,PXCASOR
|
---|
| 51 | S PXCAVSIT=""
|
---|
| 52 | S PXCAPKG=$$PKG2IEN^VSIT("PX")
|
---|
| 53 | S PXCASOR=$P($G(PXCA("SOURCE")),"^",1)
|
---|
| 54 | S (PXCAPPRV,PXCAPDX)=0
|
---|
| 55 | D
|
---|
| 56 | . N PXCAENC
|
---|
| 57 | . S PXCAENC=$G(PXCA("ENCOUNTER"))
|
---|
| 58 | . S PXCADT=+$P(PXCAENC,"^",1)
|
---|
| 59 | . S PXCAPAT=+$P(PXCAENC,"^",2)
|
---|
| 60 | . D:PXCAPAT PATINFO^PXCEPAT(.PXCAPAT)
|
---|
| 61 | . S PXCAHLOC=+$P(PXCAENC,"^",3)
|
---|
| 62 | . ; - ignore stop code passed in and always use the one for
|
---|
| 63 | . ; the Hospital Location
|
---|
| 64 | . S PXCACSTP=$P($G(^SC(PXCAHLOC,0)),"^",7)
|
---|
| 65 | . S PXCAVSIT=$$LOOKVSIT^PXUTLVST(PXCAPAT,PXCADT,PXCAHLOC,PXCACSTP,"","")
|
---|
| 66 | . S:PXCAVSIT<1 PXCAVSIT=""
|
---|
| 67 | ;
|
---|
| 68 | I PXCAVSIT>0 D
|
---|
| 69 | . ; - return error if trying to send data for a disposition
|
---|
| 70 | . I $$DISPOSIT^PXUTL1(PXCAPAT,PXCADT,PXCAVSIT) S PXCA("ERROR","ENCOUNTER",0,0,0)="Dispositions can only be done through the Disposition menu options"
|
---|
| 71 | . S PXCAPPRV=$$PRIMVPRV^PXUTL1(PXCAVSIT)
|
---|
| 72 | . S PXCAPDX=$$PRIMVPOV^PXUTL1(PXCAVSIT)
|
---|
| 73 | ;
|
---|
| 74 | D ENCOUNT^PXCAVST(.PXCA,PXCABULD,PXCAERRS,.PXCAEVAL)
|
---|
| 75 | D SOURCE^PXCASOR(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 76 | ;
|
---|
| 77 | D PROV^PXCAPRV(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 78 | D DIAG^PXCAPOV(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 79 | D PROC^PXCACPT(.PXCA,PXCABULD,PXCAERRS,PXCAEVAL)
|
---|
| 80 | ;
|
---|
| 81 | D HFACTORS^PXCAHF(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 82 | D IMMUN^PXCAVIMM(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 83 | D PATED^PXCAPED(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 84 | D SKINTEST^PXCASK(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 85 | D EXAM^PXCAXAM(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 86 | ;
|
---|
| 87 | ;Have Vitals validate its data.
|
---|
| 88 | D:$L($T(VALIDATE^GMRVPCE0)) VALIDATE^GMRVPCE0(.PXCA)
|
---|
| 89 | ;
|
---|
| 90 | D PROBLEM^PXCAPL(.PXCA,PXCABULD,PXCAERRS)
|
---|
| 91 | ;
|
---|
| 92 | D DXPL^PXCADXPL(.PXCA,PXCABULD,PXCAERRS) ;must be after DIAG^PXCAPOV
|
---|
| 93 | ;
|
---|
| 94 | ;Message if there are no Primary diagnoses
|
---|
| 95 | I 'PXCAPDX D
|
---|
| 96 | . I $P($G(^PX(815,1,"DI")),"^",3) S PXCA("ERROR","DIAGNOSIS",0,0,2)="There is no Primary Diagnosis for this encounter^"
|
---|
| 97 | . E S PXCA("WARNING","DIAGNOSIS",0,0,2)="There is no Primary Diagnosis for this encounter^"
|
---|
| 98 | ;
|
---|
| 99 | D KVA^VADPT
|
---|
| 100 | Q
|
---|
| 101 | ;
|
---|
| 102 | FINISH(PXCAGLB) ;
|
---|
| 103 | ;
|
---|
| 104 | ;Have Vitals process its data.
|
---|
| 105 | I $L($T(VALIDATE^GMRVPCE0)),$L($T(STORE^GMRVPCE0)) D STORE^GMRVPCE0(.PXCA)
|
---|
| 106 | ;
|
---|
| 107 | ;Now store the problems into Problem List
|
---|
| 108 | ; That are in the "PROBLEM" node
|
---|
| 109 | D PROBLIST^PXCAPL1
|
---|
| 110 | ; That are in the "DIAGNOSIS/PROBLEM" node
|
---|
| 111 | D PROBLIST^PXCAPL2
|
---|
| 112 | ;
|
---|
| 113 | ;Now store the rest of the information in the V-Files
|
---|
| 114 | ; - save PXKERRORs from problem list calls in PXCAPXKE
|
---|
| 115 | N PXCAPXKE
|
---|
| 116 | M PXCAPXKE=PXKERROR
|
---|
| 117 | D EN1^PXKMAIN
|
---|
| 118 | M PXKERROR=PXCAPXKE
|
---|
| 119 | ; - setting PXCAVSIT for use in PXCAERR
|
---|
| 120 | S PXCAVSIT=+$G(^TMP(PXCAGLB,$J,"VST",1,"IEN"))
|
---|
| 121 | ;Now do the event to tell the rest of the world about the new info.
|
---|
| 122 | D EVENT^PXKMAIN
|
---|
| 123 | ;
|
---|
| 124 | Q
|
---|
| 125 | ;
|
---|
| 126 | EXIT(PXCAGLB) ;Done clean up and exit.
|
---|
| 127 | K PXKERROR
|
---|
| 128 | K ^TMP(PXCAGLB,$J)
|
---|
| 129 | D PATKILL^PXCEPAT
|
---|
| 130 | Q
|
---|
| 131 | ;
|
---|