source: WorldVistAEHR/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/VSITOE.m@ 1651

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

move VSITOE.m

File size: 4.3 KB
Line 
1VSITOE ;ISL/ARS - VISIT TRACKING API UTILITIES FOR OE ;6/20/96
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**76**;Aug 12, 1996
3 ; Patch PX*1*76 changes the 2nd line of all VSIT* routines to reflect
4 ; the incorporation of the module into PCE. For historical reference,
5 ; the old (VISIT TRACKING) 2nd line is included below to reference VSIT
6 ; patches.
7 ;
8 ;;2.0;VISIT TRACKING;;Aug 12, 1996
9 Q
10 ;
11VSITAPI(DFN,SDT,EDT,HOSLOC,ENCTYPE,NENCTYPE,SERVCAT,NSERVCAT,LASTN) ;
12 ;pass (DFN, Start Date, End Date, Hospital Location,
13 ; Enounter types, Not Encounter types,
14 ; Service Categories, Not Service Categories,
15 ; How many starting with the End Date an going backwards)
16 ;ONLY THE DFN IS REQUIRED
17 ; Encounter types is a string of all the encounter types wanted.
18 ; e.g. "OA" for only Ancillary and Occasion of service
19 ; Not Encounter types is a string of all the encounter types not wanted.
20 ; e.g. "T" for do not include Telephone
21 ; If Encounter types and Not Encounter types are null or not passed
22 ; then all encounter types will be included.
23 ; Service Categories is a string of all the service categories to
24 ; include. If non is passed all is assumed.
25 ; e.g. "H" for just historical.
26 ; "T" for just Telephone.
27 ; "AIT" for ambulatory (in and out patient) and Telephone.
28 ; Not Service categories is a string of all the service categories to
29 ; not include.
30 ;Returns:: ^TMP("VSIT",$J,vsit ien,#)=
31 ;Piece 1:: Date and Time from the Vsit File Entry
32 ;Piece 2:: Hospital Location ien(pointer to file#44) ";" External Value
33 ; :: If service category = "H" then this Piece becomes the followi
34 ; :: Location of Encounter ien(Pointer to file #9999999.06) ";"
35 ; :: External Value
36 ;Piece 3:: Service Category (Value of field .07 set of codes)
37 ;Piece 4:: Service Connected (Value of field 80001 External Value)
38 ;Piece 5:: Patient Status in/out (Value of field 15002 set of codes)
39 ;Piece 6:: Clinic Stop ien (Pointer to file # 40.7) ";" External value)
40 ;
41 K ^TMP("VSIT",$J)
42 Q:'$G(DFN) ;-1
43 ;
44 N VSITPAT,VSITSDT,VSITEDT,VSITHLOC,VSITLAST
45 N VSITSTOP,VSITNUM,VSITODT,VSITLOC,VSITETYP,VSITIEN
46 ;
47 S VSITPAT=$G(DFN),VSITSDT=$G(SDT),VSITEDT=$G(EDT)
48 S VSITHLOC=+$G(HOSLOC),VSITLAST=+$G(LASTN)
49 ;if now encounter type then use "P"
50 S ENCTYPE=$G(ENCTYPE)
51 S NENCTYPE=$G(NENCTYPE)
52 S SERVCAT=$G(SERVCAT)
53 S NSERVCAT=$G(NSERVCAT)
54 I VSITSDT>.0001 S VSITSDT=VSITSDT-.0000001
55 E S VSITSDT=.0000001
56 I VSITEDT>0 S VSITEDT=VSITEDT+$S(VSITEDT#1:.0000001,1:.7)
57 E S VSITEDT=9999999
58 ;
59 S VSITSTOP=0
60 S VSITNUM=0
61 S VSITODT=VSITEDT
62 F S VSITODT=$O(^AUPNVSIT("AET",VSITPAT,VSITODT),-1) Q:VSITODT<VSITSDT D Q:VSITSTOP
63 .S VSITLOC=0
64 .F S VSITLOC=$O(^AUPNVSIT("AET",VSITPAT,VSITODT,VSITLOC)) Q:'VSITLOC D
65 ..I VSITHLOC'=0,VSITLOC'=VSITHLOC Q
66 ..S VSITETYP=""
67 ..F S VSITETYP=$O(^AUPNVSIT("AET",VSITPAT,VSITODT,VSITLOC,VSITETYP)) Q:VSITETYP="" D Q:VSITSTOP
68 ...I ENCTYPE'="",ENCTYPE'[VSITETYP Q
69 ...I NENCTYPE'="",NENCTYPE[VSITETYP Q
70 ...S VSITIEN=0
71 ...F S VSITIEN=$O(^AUPNVSIT("AET",VSITPAT,VSITODT,VSITLOC,VSITETYP,VSITIEN)) Q:'VSITIEN D Q:VSITSTOP
72 ....I NSERVCAT'="",NSERVCAT[$P($G(^AUPNVSIT(VSITIEN,0)),"^",7) Q
73 ....I SERVCAT'="",SERVCAT'[$P($G(^AUPNVSIT(VSITIEN,0)),"^",7) Q
74 ....S VSITNUM=VSITNUM+1
75 ....D OUTPUT(VSITIEN,VSITNUM)
76 ....I VSITLAST,VSITLAST'>VSITNUM S VSITSTOP=1
77 ;
78 Q ;VSITNUM
79 ;
80OUTPUT(VSITIEN,VSITNUM) ;
81 N VSIT0,VSITDILF,VSITDSS,VSITSCAT,VSITLOC,VSITSC
82 S VSIT0=$G(^AUPNVSIT(VSITIEN,0))
83 ;
84 ; -- Clinic
85 S VSITDSS=$$EXTERNAL^DILFD(9000010,.08,"",$P(VSIT0,"^",8),"VSITDILF")
86 I VSITDSS]"" S VSITDSS=$P(VSIT0,"^",8)_";"_VSITDSS
87 ;
88 ; -- Service Category
89 S VSITSCAT=$P(VSIT0,U,7)
90 ;
91 ; -- Location of Encounter
92 I VSITSCAT="H" D
93 . S VSITLOC=$$EXTERNAL^DILFD(9000010,.06,"",$P(VSIT0,"^",6),"VSITDILF")
94 . I VSITLOC]"" S VSITLOC=$P(VSIT0,"^",6)_";"_VSITLOC
95 E D
96 . ; -- Hospital Location
97 . S VSITLOC=$$EXTERNAL^DILFD(9000010,.22,"",$P(VSIT0,"^",22),"VSITDILF")
98 . I VSITLOC]"" S VSITLOC=$P(VSIT0,"^",22)_";"_VSITLOC
99 ;
100 ;--Service Connected
101 S VSITSC=$$EXTERNAL^DILFD(9000010,80001,"",$P($G(^AUPNVSIT(VSITIEN,800)),"^",1),"VSITDILF")
102 ;I VSITSC]"" S VSITSC=$P($G(^AUPNVSIT(VSITIEN,800)),"^",1)_";"_VSITSC
103 ;
104 ; -- Set Tmp node
105 S ^TMP("VSIT",$J,VSITIEN,VSITNUM)=$P(VSIT0,U,1)_"^"_VSITLOC_"^"_VSITSCAT_"^"_VSITSC_"^"_$P($G(^AUPNVSIT(VSITIEN,150)),U,2)_"^"_VSITDSS
106 ;
107 Q
108 ;
Note: See TracBrowser for help on using the repository browser.