source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSPXU2.m@ 1578

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1GMTSPXU2 ;SLC/KKA,SBW - PCE Drivers for visits ; 08/27/2002
2 ;;2.7;Health Summary;**2,56**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10141 $$VERSION^XPDUTL
6 ; DBIA 10026 ^DIR
7 ; DBIA 17 ^DGPM("ATID1")
8 ; DBIA 17 ^DGPM( file #405
9 ; DBIA 10103 $$FMTE^XLFDT
10 ; DBIA 1273 VISIT^PXRHS14
11 ;
12MENU(DFN,GMTSPX2,GMTSPX1) ; HS Selection Menu
13 ;
14 ; Allows user to choose Outpatient Visits based
15 ; on V files or Inpatient visits based on patient
16 ; movement file.
17 N DIR,SEL,DTOUT,DIRUT
18 S (GMTSPX2,GMTSPX1)=""
19 ;
20 ; If PCE not installed just allow for inpatient
21 ; range selection
22 I $$VERSION^XPDUTL("PX")'>0 D INPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1) Q
23 S DIR(0)="SO^1:Outpatient Visit Date;2:Admission Date"
24 S DIR("?")="Select 1 or 2 or ^ to exit"
25 D ^DIR
26 Q:$D(DIRUT)!(+$G(Y)'>0)
27 S SEL=+Y
28 D:SEL=1 OUTPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1)
29 D:SEL=2 INPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1)
30 Q
31 ;
32OUTPAT(DFN,DATEFROM,DATETO) ; Select by Outpatient Visit Date
33 N INPDATE,DIRUT,DTOUT
34 D OUTLOOK(DFN,.INPDATE)
35 Q:INPDATE']""
36 I INPDATE]"" S (DATEFROM,DATETO)=$P(INPDATE,".")
37 Q
38INPAT(DFN,DATEFROM,DATETO) ; Select by Inpatient Visit Date
39 N DIRUT,DTOUT
40 D INLOOK(DFN,.DATEFROM,.DATETO)
41 I DATEFROM']""!(DATETO']"") S (DATEFROM,DATETO)=""
42 Q
43INLOOK(DFN,GMTSADM,GMTSDC) ; Displays Patient's Admission Dates
44 N DIR,Y,X,ADT,RECNR,CTR,HIT,DCDT,ADMDT,SELNR
45 S (GMTSADM,GMTSDC)=""
46 I '$D(^DGPM("ATID1",DFN)) W !!,"No admissions on file for this patient" Q
47 K ^TMP("GMTSPX",$J)
48 S (CTR,HIT,ADT,SELNR)=0
49 F S ADT=$O(^DGPM("ATID1",DFN,ADT)) Q:+ADT'>0 D Q:$D(DIRUT)!+$G(Y)
50 . S RECNR=0
51 . F S RECNR=$O(^DGPM("ATID1",DFN,ADT,RECNR)) Q:RECNR'>0 D Q:$D(DIRUT)!+$G(Y)
52 . . S ADMDT=$P(^DGPM(RECNR,0),U)
53 . . S DCDT=$P($G(^DGPM(+$P(^DGPM(RECNR,0),U,17),0)),U)
54 . . D:'HIT INHDR S HIT=1,SELNR=SELNR+1,CTR=CTR+1
55 . . W !,?7,SELNR,?15,$$FMTE^XLFDT(ADMDT,"2P")
56 . . W:DCDT]"" ?45,$$FMTE^XLFDT(DCDT,"2P")
57 . . S ^TMP("GMTSPX",$J,SELNR)=ADMDT_U_DCDT
58 . . I CTR>9 D Q:$D(DTOUT)!$D(DUOUT)!(+$G(Y)>0)
59 . . . S DIR("A")="Enter a number between 1 and "_SELNR_", press return to continue or '^' to exit: "
60 . . . S DIR(0)="NOA^1:"_SELNR D ^DIR S CTR=0 W !
61 Q:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)
62 I SELNR>0,(CTR>0),(CTR'>9)&(+$G(Y)'>0) D
63 . S DIR("A")="Enter a number between 1 and "_SELNR_": "
64 . S DIR(0)="NOA^1:"_SELNR D ^DIR W !
65 Q:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!(+$G(Y)'>0)
66 S GMTSADM=$P($P($G(^TMP("GMTSPX",$J,+Y)),U),".")
67 S GMTSDC=$P($P($G(^TMP("GMTSPX",$J,+Y)),U,2),".")
68 I GMTSADM]"",GMTSDC="" S GMTSDC=DT
69 K ^TMP("GMTSPX",$J)
70 Q
71 ;
72INHDR ; Based on the VISIT File
73 W !!,?15,"ADMISSION DATE/TIME",?45,"DISCHARGE DATE/TIME",!
74 Q
75 ;
76OUTLOOK(DFN,OUT) ; Display Outpatient Visits
77 ;
78 ; This option displays outpatient visits from the
79 ; Visit (#9000010) file to the screen. Outpatient
80 ; visits = visits with a service category of:
81 ;
82 ; Ambulatory
83 ; Observation
84 ; Day Surgery
85 ; Nursing Home
86 ;
87 ; A number, the visit date, and the hospital location
88 ; or credit stop will be display on the screen. The
89 ; order of the display will be from most recent visits
90 ; to oldest visits. The user can pick the visit they
91 ; want and the visit date is passed back to the calling
92 ; routine by parameter passing by reference.
93 ;
94 N DIR,Y,X,VISITDT,CTR,SELNR,RECNR,CLINIC,HIT,VISIT,HLOC
95 S OUT=""
96 K ^TMP("HS",$J),^TMP("PXV",$J)
97 S (CTR,HIT,SELNR,VISITDT,RECNR)=0
98 S VISITDT="",RECNR=""
99 F D VISIT^PXRHS14(DFN,.VISITDT,.RECNR,1,"ASOR") Q:VISITDT'>0 D Q:$D(DUOUT)!$D(DTOUT)!(+$G(Y)>0)
100 . S NODE=$G(^TMP("PXV",$J,VISITDT,RECNR))
101 . K ^TMP("PXV",$J)
102 . Q:NODE']""
103 . S VISIT=$P(NODE,U)
104 . S CLINIC=$P(NODE,U,4)
105 . S HLOC=$P(NODE,U,6)
106 . D:'HIT OUTHDR S HIT=1 S SELNR=SELNR+1,CTR=CTR+1
107 . W !,?7,SELNR,?15,$$FMTE^XLFDT(VISIT,"2P"),?45,$S(HLOC]"":HLOC,1:CLINIC)
108 . S ^TMP("HS",$J,SELNR)=RECNR_U_VISIT_U_CLINIC_U_HLOC
109 . I CTR>9 D Q:$D(DTOUT)!$D(DUOUT)!(+$G(Y)>0)
110 . . S DIR("A")="Enter a number between 1 and "_SELNR_", press return to continue or '^' to exit: "
111 . . S DIR(0)="NOA^1:"_SELNR D ^DIR S CTR=0 W !
112 I SELNR>0&(CTR>0)&(CTR'>9) D
113 . S DIR("A")="Enter a number between 1 and "_SELNR_": "
114 . S DIR(0)="NOA^1:"_SELNR D ^DIR W !
115 I SELNR'>0 W !!,"No Outpatient visits for this patient" Q
116 S OUT=$P($G(^TMP("HS",$J,+$G(Y))),U,2)
117 K ^TMP("HS",$J),^TMP("PXV",$J)
118 Q
119OUTHDR ; Header for screen Display
120 W !!,?15,"VISIT DATE/TIME",?45,"HOSPITAL LOCATION/CLINIC",!
121 Q
Note: See TracBrowser for help on using the repository browser.