source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPMOBS.m@ 1397

Last change on this file since 1397 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1DGPMOBS ;ALB/MM - Observation API;11/25/98
2 ;;5.3;Registration;**212**;Aug 13 1993
3 ;
4 ;This routine provides 3 entry points to obtain observation statuses.
5 ;Line labels MVT, PT, and SPEC document required input variables and
6 ;output values.
7 ;
8MVT(IFN) ;This entry point returns the observation status based on
9 ;a specified Patient Movement (#405) file entry
10 ;
11 ;Input:
12 ; Patient Movement (#405) file IFN (Required)
13 ;
14 ;Output:
15 ; If an obseration treating specialty return:
16 ; 1^Facility Treating Specialty (#45.7)file IFN^Facility
17 ; Treating Specialty (#45.7) file name^Specialty (#42.4)
18 ; file IFN^Specialty (#42.4) file name
19 ;
20 ; If not an observation treating specialty return:
21 ; 0^Facility Treating Specialty (#45.7) file IFN^Facility
22 ; Treating Specialty (#45.7) file name^Specialty (#42.4)
23 ; file IFN^Specialty (#42.4) file name
24 ;
25 ; If Patient (#2) file DFN, Patient Movement (#405) IFN, or
26 ; Specialty (#42.4) file IFN not defined or invalid return:
27 ; -1^Error condition
28 ;
29 N DFN,OBS,SPIFN,VAIP
30 S OBS=0
31 I '$D(IFN) S OBS="-1^Patient Movement (#405) file IFN undefined" Q OBS
32 I '$G(^DGPM(+IFN,0)) S OBS="-1^No Patient Movement (#405) file entry" Q OBS
33 S DFN=+$P($G(^DGPM(+IFN,0)),U,3)
34 I 'DFN S OBS="-1^Patient (#2) file DFN not defined" Q OBS
35 ;VAIP("E") contains the Patient Movement (#405) file IFN
36 S VAIP("E")=+IFN
37 D INP
38 Q OBS
39PT(DFN,MVTDT) ;This entry point returns observation status for a patient
40 ;based on the treating specialty associated for a designated date/time.
41 ;If not defined, defaults to status for the current date/time.
42 ;
43 ;Input:
44 ; DFN from Patient (#2) file
45 ; MVTDT (optional) if not defined defaults to current date/time
46 ;
47 ;Output:
48 ; Same as output documented for MVT entry point
49 ;
50 N OBS,SPIFN,VAIP
51 S OBS=0
52 ;If date not defined, defaults to current date/time
53 S:'$D(MVTDT) MVTDT=$$NOW^XLFDT
54 ;MVTDT must contain a time
55 I $P(MVTDT,".",2)']"" S OBS="-1^Time required" Q OBS
56 I '$D(DFN) S OBS="-1^Patient (#2) file DFN not defined" Q OBS
57 I '$D(^DPT(+DFN,0)) S OBS="-1^No Patient (#2) file entry" Q OBS
58 S VAIP("D")=MVTDT
59 D INP
60 Q OBS
61INP ;Get inpatient data based on criteria from MVT and PT entry points
62 D IN5^VADPT
63 ;VAIP(8) returned by IN5^VADPT call is the treating specialty from
64 ;the Facility Treating Specialty (#45.7) file in internal^external
65 ;format
66 ;SPIFN is a pointer to the SPECIALTY (#42.4) file from the SPECIALTY
67 ;(#1) field
68 S SPIFN=$P($G(^DIC(45.7,+VAIP(8),0)),U,2)
69 S OBS=$$SPEC(SPIFN)
70 I +OBS'=-1 S OBS=OBS_U_VAIP(8)_U_SPIFN_U_$P($G(^DIC(42.4,+SPIFN,0)),U)
71 Q
72SPEC(SPIFN) ;This entry point determines if the Specialty file (#42.4)
73 ;is an observation specialty.
74 ;
75 ;Observation specialties from the Specialty (#42.4) file are:
76 ;
77 ; 18 - Neurology Observation
78 ; 23 - Spinal Cord Injury Observation
79 ; 24 - Medical Observation
80 ; 36 - Blind Rehab Observation
81 ; 41 - Rehab Medicine Observation
82 ; 65 - Surgical Observation
83 ; 94 - Psychiatric Observation
84 ;
85 ;Input:
86 ; SPIFN - Specialty (#42.4) IFN
87 ;
88 ;Output:
89 ; 1 observation treating specialty
90 ; 0 not an observation specialty
91 ; -1 no treating specialty IFN defined or
92 ; IFN not found in Specialty (#42.4) file
93 ;
94 N SPEC,TX
95 S TX=0
96 I '$D(SPIFN) S TX="-1^Specialty (#42.4) IFN not defined" Q TX
97 I '$D(^DIC(42.4,+SPIFN,0)) S TX="-1^No Specialty (#42.4) file entry" Q TX
98 ;SPEC=observation treating specialty IFNs
99 F SPEC=18,23,24,36,41,65,94 I SPEC=SPIFN S TX=1 Q
100 Q TX
Note: See TracBrowser for help on using the repository browser.