source: FOIAVistA/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMVSIT.m@ 1114

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

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1PXRMVSIT ; SLC/PKR - Visit related info for reminders. ;02/22/2007
2 ;;2.0;CLINICAL REMINDERS;**4,6**;Feb 04, 2005;Build 123
3 ;
4 ;======================================================
5GETDATA(DA,DATA,SVALUE) ;Return data for a specific Visit file entry.
6 ;DBIA #2028 for Visit file.
7 N DONE,IEN,HTEMP,LOE,TEMP
8 S TEMP=^AUPNVSIT(DA,0)
9 S DATA("VISIT")=DA
10 S DATA("DATE VISIT CREATED")=$P(TEMP,U,2)
11 S DATA("DFN")=$P(TEMP,U,5)
12 S (DATA("LOC. OF ENCOUNTER"),LOE)=$P(TEMP,U,6)
13 ;DBIA #10090
14 S DATA("STATION NUMBER")=$$GET1^DIQ(4,LOE,99)
15 S DATA("OFFICAL VA NAME")=$$GET1^DIQ(4,LOE,100)
16 S DATA("SERVICE CATEGORY")=$P(TEMP,U,7)
17 I $G(SVALUE) S DATA("VALUE")=$P(TEMP,U,7)
18 S DATA("HOSPITAL LOCATION")=$P(TEMP,U,22)
19 ;DBIA #10040, #2804
20 I $G(DATA("HOSPITAL LOCATION"))="" S HTEMP=""
21 E S HTEMP=^SC(DATA("HOSPITAL LOCATION"),0)
22 S DATA("HLOC")=$P(HTEMP,U,1)
23 S DATA("DSS ID")=$P(TEMP,U,8)
24 I DATA("DSS ID")="" S DATA("DSS ID")=$P(HTEMP,U,7)
25 ;DBIA #557
26 I DATA("DSS ID")'="" S DATA("STOP CODE")=$P(^DIC(40.7,DATA("DSS ID"),0),U,2)
27 S DATA("OUTSIDE LOCATION")=$G(^AUPNVSIT(DA,21))
28 S DATA("COMMENTS")=$G(^AUPNVSIT(DA,811))
29 ;DBIA #4850
30 S DATA("STATUS")=$$STATUS^SDPCE(DA)
31 ;Get the primary provider.
32 ;DBIA #3455 for V PROVIDER
33 S DATA("PRIMARY PROVIDER")="",IEN="",DONE=0
34 F S IEN=$O(^AUPNVPRV("AD",DA,IEN)) Q:(DONE)!(IEN="") D
35 . S TEMP=^AUPNVPRV(IEN,0)
36 . I $P(TEMP,U,4)="P" S DATA("PRIMARY PROVIDER")=$P(TEMP,U,1),DONE=1
37 Q
38 ;
39 ;======================================================
40GAPSTAT(VIEN) ;Return the status of the appointment associated with the
41 ;visit.
42 ;DBIA #4850
43 Q $$STATUS^SDPCE(VIEN)
44 ;
45 ;======================================================
46HENC(VIEN,INDENT,NLINES,TEXT) ;Display location and comment for historical
47 ;encounters associated with the V files.
48 N COMMENT,HLOC,LOCATION,OLOC,NIN,TEXTIN,VDATA
49 D GETDATA(VIEN,.VDATA) I VDATA("SERVICE CATEGORY")'="E" Q
50 S NIN=0
51 S LOCATION=VDATA("LOC. OF ENCOUNTER")
52 I LOCATION'="" D
53 . S LOCATION=$$GET1^DIQ(4,LOCATION,.01)_" "_$$GET1^DIQ(4,LOCATION,99)
54 . S NIN=NIN+1,TEXTIN(NIN)="Location of Encounter: "_LOCATION_"\\"
55 S HLOC=VDATA("HOSPITAL LOCATION")
56 I HLOC'="" D
57 . S HLOC=$$GET1^DIQ(44,HLOC,.01)
58 . S NIN=NIN+1,TEXTIN(NIN)="Hospital Location: "_HLOC_"\\"
59 S OLOC=VDATA("OUTSIDE LOCATION")
60 I OLOC'="" D
61 . S NIN=NIN+1,TEXTIN(NIN)="Outside Location: "_OLOC_"\\"
62 S COMMENT=VDATA("COMMENT")
63 I COMMENT'="" D
64 . S NIN=NIN+1,TEXTIN(NIN)="Comment: "_COMMENT
65 I NIN>0 D
66 . N JND,NOUT,TEXTOUT
67 . S NLINES=NLINES+1
68 . S TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Historical Encounter Information:"
69 . D FORMAT^PXRMTEXT(INDENT+2,PXRMRM,NIN,.TEXTIN,.NOUT,.TEXTOUT)
70 . F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
71 Q
72 ;
73 ;======================================================
74ISHIST(VIEN) ;Return true if the encounter was historical.
75 ;DBIA #2028
76 I $P($G(^AUPNVSIT(VIEN,0)),U,7)="E" Q 1
77 Q 0
78 ;
79 ;======================================================
80VAPSTAT(VIEN) ;Return true if the appointment associated with
81 ;the visit has a valid appointment status.
82 ;Return false if the status is one of the following:
83 ;CANCELLED BY CLINIC
84 ;CANCELLED BY CLINIC & AUTO RE-BOOK
85 ;CANCELLED BY PATIENT
86 ;CANCELLED BY PATIENT & AUTO-REBOOK
87 ;DELETED
88 ;NO ACTION TAKEN
89 ;NO-SHOW
90 ;NO-SHOW & AUTO RE-BOOK
91 ;NULL
92 N STATUS,VALID
93 ;DBIA #4850
94 S STATUS=$P($$STATUS^SDPCE(VIEN),U,2)
95 S VALID=$S(STATUS["CANCELLED":0,STATUS["DELETED":0,STATUS["NO ACTION":0,STATUS["NO-SHOW":0,STATUS="":0,1:1)
96 Q VALID
97 ;
Note: See TracBrowser for help on using the repository browser.