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

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1PXRHS14 ;ISL/SBW - PCE Visit data extract routine ;7/25/96 09:06
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;;Aug 12, 1996
3 ; Extract returns visit data in block of OCCLIM. Can be called multiple
4 ; times for a patient. Parameter passing by reference with FROM and
5 ; RECNO variables allows the routine to process multiple calls without
6 ; missing data.
7VISIT(DFN,FROM,RECNO,OCCLIM,CATCODE,PSTAT) ; Control branching
8 ;INPUT: DFN - Pointer to PATIENT file (#2).
9 ; FROM - Index entry from which to begin the list.
10 ; Passed by reference.
11 ; RECNO - Record number. Passed by reference.
12 ; - Should be null for 1st call to this entry point.
13 ; OCCLIM - Maximum number of visits to return.
14 ; CATCODE - Pattern Match which controls visit data that is
15 ; returned (Can include multiple codes).
16 ; A = AMBULATORY
17 ; H = HOSPITALIZATION
18 ; I = IN HOSPITAL
19 ; C = CHART REVIEW
20 ; T = TELECOMMUNICATIONS
21 ; N = NOT FOUND
22 ; S = DAY SURGERY
23 ; O = OBSERVATION
24 ; E = EVENT (HISTORICAL)
25 ; R = NURSING HOME
26 ; D = DAILY HOSPITALIZATION DATA
27 ; X = ANCILLARY PACKAGE DAILY DATA
28 ; PSTAT - Patient Status.
29 ; 1 = Inpatient
30 ; 0 or NULL = Outpatient
31 ;
32 ;OUTPUT:
33 ; Data from VISIT (9000010) file except for hosp. loc. abbr.
34 ; ^TMP("PXV",$J,InvExDt,RecNo,0) = VISIT/ADMIT DATE&TIME [I;.01]
35 ; ^ LOC. OF ENCOUNTER [E;.06] ^ SERVICE CATEGORY [E;.07]
36 ; ^ CLINIC [E;.08] ^ WALK IN/APPT (deleted field always null)[E;.16]
37 ; ^ EVALUATION AND MANAGEMENT CODE (deleted field always null)[E;.17]
38 ; ^ HOSPITAL LOCATION [E;.22]
39 ;
40 ; [] = [I(nternal)/E(xternal); Field #]
41 ; Subscripts:
42 ; InvExDt - Inverted Visit Date from "AA" x-ref
43 ; RecNo - Record Number
44 ;
45 ; Calling routine is required to delete ^TMP("PXV",$J). It can be
46 ; deleted between multiple calls to this entry point or after
47 ; the calling routine makes the last call depending on how the data
48 ; needs to be accumulated.
49 Q:$G(DFN)']""!'$D(^AUPNVSIT("AA",DFN))
50 N PXCNT,FIRST
51 N DIC,DIQ,DR,DA,VISIT,LOC,SERCAT,CLINIC,WALKAPT,LEVEL,HLOC
52 S FIRST=1
53 S:+$G(OCCLIM)'>0 OCCLIM=999
54 S:+$G(FROM)'>0 FROM=""
55 S:+$G(RECNO)'>0 RECNO=""
56 S PXCNT=0
57 F S:(RECNO=""!'FIRST) FROM=$O(^AUPNVSIT("AA",DFN,FROM)) Q:+FROM'>0 D Q:PXCNT'<OCCLIM
58 . I 'FIRST S RECNO=0
59 . S FIRST=0
60 . F S RECNO=$O(^AUPNVSIT("AA",DFN,FROM,RECNO)) Q:+RECNO'>0 D Q:PXCNT'<OCCLIM
61 . . N REC
62 . . S DIC=9000010,DA=RECNO,DIQ="REC(",DIQ(0)="IE"
63 . . S DR=".01;.06;.07;.08;.09;.11;.22;15002"
64 . . D EN^DIQ1
65 . . Q:'$D(REC)
66 . . Q:$G(CATCODE)'[REC(9000010,DA,.07,"I")!(REC(9000010,DA,.09,"I")'>0)!+(REC(9000010,DA,.11,"I"))!(+$G(PSTAT)'=+REC(9000010,DA,15002,"I"))
67 . . S VISIT=REC(9000010,DA,.01,"I")
68 . . S LOC=REC(9000010,DA,.06,"E")
69 . . S SERCAT=REC(9000010,DA,.07,"E")
70 . . S CLINIC=REC(9000010,DA,.08,"E")
71 . . ;- return null for deleted fields .16 and .17
72 . . S WALKAPT="" ;REC(9000010,DA,.16,"E")
73 . . S LEVEL="" ;REC(9000010,DA,.17,"E")
74 . . S HLOC=REC(9000010,DA,.22,"E")
75 . . S ^TMP("PXV",$J,FROM,RECNO)=VISIT_U_LOC_U_SERCAT_U_CLINIC_U_WALKAPT_U_HLOC
76 . . S PXCNT=PXCNT+1
77 Q
Note: See TracBrowser for help on using the repository browser.