GMTSPXU2 ;SLC/KKA,SBW - PCE Drivers for visits ; 08/27/2002
;;2.7;Health Summary;**2,56**;Oct 20, 1995
;
; External References
; DBIA 10141 $$VERSION^XPDUTL
; DBIA 10026 ^DIR
; DBIA 17 ^DGPM("ATID1")
; DBIA 17 ^DGPM( file #405
; DBIA 10103 $$FMTE^XLFDT
; DBIA 1273 VISIT^PXRHS14
;
;
; Allows user to choose Outpatient Visits based
; on V files or Inpatient visits based on patient
; movement file.
N DIR,SEL,DTOUT,DIRUT
S (GMTSPX2,GMTSPX1)=""
;
; If PCE not installed just allow for inpatient
; range selection
I $$VERSION^XPDUTL("PX")'>0 D INPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1) Q
S DIR(0)="SO^1:Outpatient Visit Date;2:Admission Date"
S DIR("?")="Select 1 or 2 or ^ to exit"
D ^DIR
Q:$D(DIRUT)!(+$G(Y)'>0)
S SEL=+Y
D:SEL=1 OUTPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1)
D:SEL=2 INPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1)
Q
;
OUTPAT(DFN,DATEFROM,DATETO) ; Select by Outpatient Visit Date
N INPDATE,DIRUT,DTOUT
D OUTLOOK(DFN,.INPDATE)
Q:INPDATE']""
I INPDATE]"" S (DATEFROM,DATETO)=$P(INPDATE,".")
Q
INPAT(DFN,DATEFROM,DATETO) ; Select by Inpatient Visit Date
N DIRUT,DTOUT
D INLOOK(DFN,.DATEFROM,.DATETO)
I DATEFROM']""!(DATETO']"") S (DATEFROM,DATETO)=""
Q
INLOOK(DFN,GMTSADM,GMTSDC) ; Displays Patient's Admission Dates
N DIR,Y,X,ADT,RECNR,CTR,HIT,DCDT,ADMDT,SELNR
S (GMTSADM,GMTSDC)=""
I '$D(^DGPM("ATID1",DFN)) W !!,"No admissions on file for this patient" Q
K ^TMP("GMTSPX",$J)
S (CTR,HIT,ADT,SELNR)=0
F S ADT=$O(^DGPM("ATID1",DFN,ADT)) Q:+ADT'>0 D Q:$D(DIRUT)!+$G(Y)
. S RECNR=0
. F S RECNR=$O(^DGPM("ATID1",DFN,ADT,RECNR)) Q:RECNR'>0 D Q:$D(DIRUT)!+$G(Y)
. . S ADMDT=$P(^DGPM(RECNR,0),U)
. . S DCDT=$P($G(^DGPM(+$P(^DGPM(RECNR,0),U,17),0)),U)
. . D:'HIT INHDR S HIT=1,SELNR=SELNR+1,CTR=CTR+1
. . W !,?7,SELNR,?15,$$FMTE^XLFDT(ADMDT,"2P")
. . W:DCDT]"" ?45,$$FMTE^XLFDT(DCDT,"2P")
. . S ^TMP("GMTSPX",$J,SELNR)=ADMDT_U_DCDT
. . I CTR>9 D Q:$D(DTOUT)!$D(DUOUT)!(+$G(Y)>0)
. . . S DIR("A")="Enter a number between 1 and "_SELNR_", press return to continue or '^' to exit: "
. . . S DIR(0)="NOA^1:"_SELNR D ^DIR S CTR=0 W !
Q:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)
I SELNR>0,(CTR>0),(CTR'>9)&(+$G(Y)'>0) D
. S DIR("A")="Enter a number between 1 and "_SELNR_": "
. S DIR(0)="NOA^1:"_SELNR D ^DIR W !
Q:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!(+$G(Y)'>0)
S GMTSADM=$P($P($G(^TMP("GMTSPX",$J,+Y)),U),".")
S GMTSDC=$P($P($G(^TMP("GMTSPX",$J,+Y)),U,2),".")
I GMTSADM]"",GMTSDC="" S GMTSDC=DT
K ^TMP("GMTSPX",$J)
Q
;
INHDR ; Based on the VISIT File
W !!,?15,"ADMISSION DATE/TIME",?45,"DISCHARGE DATE/TIME",!
Q
;
OUTLOOK(DFN,OUT) ; Display Outpatient Visits
;
; This option displays outpatient visits from the
; Visit (#9000010) file to the screen. Outpatient
; visits = visits with a service category of:
;
; Ambulatory
; Observation
; Day Surgery
; Nursing Home
;
; A number, the visit date, and the hospital location
; or credit stop will be display on the screen. The
; order of the display will be from most recent visits
; to oldest visits. The user can pick the visit they
; want and the visit date is passed back to the calling
; routine by parameter passing by reference.
;
N DIR,Y,X,VISITDT,CTR,SELNR,RECNR,CLINIC,HIT,VISIT,HLOC
S OUT=""
K ^TMP("HS",$J),^TMP("PXV",$J)
S (CTR,HIT,SELNR,VISITDT,RECNR)=0
S VISITDT="",RECNR=""
F D VISIT^PXRHS14(DFN,.VISITDT,.RECNR,1,"ASOR") Q:VISITDT'>0 D Q:$D(DUOUT)!$D(DTOUT)!(+$G(Y)>0)
. S NODE=$G(^TMP("PXV",$J,VISITDT,RECNR))
. K ^TMP("PXV",$J)
. Q:NODE']""
. S VISIT=$P(NODE,U)
. S CLINIC=$P(NODE,U,4)
. S HLOC=$P(NODE,U,6)
. D:'HIT OUTHDR S HIT=1 S SELNR=SELNR+1,CTR=CTR+1
. W !,?7,SELNR,?15,$$FMTE^XLFDT(VISIT,"2P"),?45,$S(HLOC]"":HLOC,1:CLINIC)
. S ^TMP("HS",$J,SELNR)=RECNR_U_VISIT_U_CLINIC_U_HLOC
. I CTR>9 D Q:$D(DTOUT)!$D(DUOUT)!(+$G(Y)>0)
. . S DIR("A")="Enter a number between 1 and "_SELNR_", press return to continue or '^' to exit: "
. . S DIR(0)="NOA^1:"_SELNR D ^DIR S CTR=0 W !
I SELNR>0&(CTR>0)&(CTR'>9) D
. S DIR("A")="Enter a number between 1 and "_SELNR_": "
. S DIR(0)="NOA^1:"_SELNR D ^DIR W !
I SELNR'>0 W !!,"No Outpatient visits for this patient" Q
S OUT=$P($G(^TMP("HS",$J,+$G(Y))),U,2)
K ^TMP("HS",$J),^TMP("PXV",$J)
Q
OUTHDR ; Header for screen Display
W !!,?15,"VISIT DATE/TIME",?45,"HOSPITAL LOCATION/CLINIC",!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPXU2 4748 printed Oct 16, 2024@18:00:42 Page 2
GMTSPXU2 ;SLC/KKA,SBW - PCE Drivers for visits ; 08/27/2002
+1 ;;2.7;Health Summary;**2,56**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 10141 $$VERSION^XPDUTL
+5 ; DBIA 10026 ^DIR
+6 ; DBIA 17 ^DGPM("ATID1")
+7 ; DBIA 17 ^DGPM( file #405
+8 ; DBIA 10103 $$FMTE^XLFDT
+9 ; DBIA 1273 VISIT^PXRHS14
+10 ;
+1 ;
+2 ; Allows user to choose Outpatient Visits based
+3 ; on V files or Inpatient visits based on patient
+4 ; movement file.
+5 NEW DIR,SEL,DTOUT,DIRUT
+6 SET (GMTSPX2,GMTSPX1)=""
+7 ;
+8 ; If PCE not installed just allow for inpatient
+9 ; range selection
+10 IF $$VERSION^XPDUTL("PX")'>0
DO INPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1)
QUIT
+11 SET DIR(0)="SO^1:Outpatient Visit Date;2:Admission Date"
+12 SET DIR("?")="Select 1 or 2 or ^ to exit"
+13 DO ^DIR
+14 if $DATA(DIRUT)!(+$GET(Y)'>0)
QUIT
+15 SET SEL=+Y
+16 if SEL=1
DO OUTPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1)
+17 if SEL=2
DO INPAT^GMTSPXU2(DFN,.GMTSPX2,.GMTSPX1)
+18 QUIT
+19 ;
OUTPAT(DFN,DATEFROM,DATETO) ; Select by Outpatient Visit Date
+1 NEW INPDATE,DIRUT,DTOUT
+2 DO OUTLOOK(DFN,.INPDATE)
+3 if INPDATE']""
QUIT
+4 IF INPDATE]""
SET (DATEFROM,DATETO)=$PIECE(INPDATE,".")
+5 QUIT
INPAT(DFN,DATEFROM,DATETO) ; Select by Inpatient Visit Date
+1 NEW DIRUT,DTOUT
+2 DO INLOOK(DFN,.DATEFROM,.DATETO)
+3 IF DATEFROM']""!(DATETO']"")
SET (DATEFROM,DATETO)=""
+4 QUIT
INLOOK(DFN,GMTSADM,GMTSDC) ; Displays Patient's Admission Dates
+1 NEW DIR,Y,X,ADT,RECNR,CTR,HIT,DCDT,ADMDT,SELNR
+2 SET (GMTSADM,GMTSDC)=""
+3 IF '$DATA(^DGPM("ATID1",DFN))
WRITE !!,"No admissions on file for this patient"
QUIT
+4 KILL ^TMP("GMTSPX",$JOB)
+5 SET (CTR,HIT,ADT,SELNR)=0
+6 FOR
SET ADT=$ORDER(^DGPM("ATID1",DFN,ADT))
if +ADT'>0
QUIT
Begin DoDot:1
+7 SET RECNR=0
+8 FOR
SET RECNR=$ORDER(^DGPM("ATID1",DFN,ADT,RECNR))
if RECNR'>0
QUIT
Begin DoDot:2
+9 SET ADMDT=$PIECE(^DGPM(RECNR,0),U)
+10 SET DCDT=$PIECE($GET(^DGPM(+$PIECE(^DGPM(RECNR,0),U,17),0)),U)
+11 if 'HIT
DO INHDR
SET HIT=1
SET SELNR=SELNR+1
SET CTR=CTR+1
+12 WRITE !,?7,SELNR,?15,$$FMTE^XLFDT(ADMDT,"2P")
+13 if DCDT]""
WRITE ?45,$$FMTE^XLFDT(DCDT,"2P")
+14 SET ^TMP("GMTSPX",$JOB,SELNR)=ADMDT_U_DCDT
+15 IF CTR>9
Begin DoDot:3
+16 SET DIR("A")="Enter a number between 1 and "_SELNR_", press return to continue or '^' to exit: "
+17 SET DIR(0)="NOA^1:"_SELNR
DO ^DIR
SET CTR=0
WRITE !
End DoDot:3
if $DATA(DTOUT)!$DATA(DUOUT)!(+$GET(Y)>0)
QUIT
End DoDot:2
if $DATA(DIRUT)!+$GET(Y)
QUIT
End DoDot:1
if $DATA(DIRUT)!+$GET(Y)
QUIT
+18 if $DATA(DUOUT)!$DATA(DTOUT)!$DATA(DIROUT)
QUIT
+19 IF SELNR>0
IF (CTR>0)
IF (CTR'>9)&(+$GET(Y)'>0)
Begin DoDot:1
+20 SET DIR("A")="Enter a number between 1 and "_SELNR_": "
+21 SET DIR(0)="NOA^1:"_SELNR
DO ^DIR
WRITE !
End DoDot:1
+22 if $DATA(DUOUT)!$DATA(DTOUT)!$DATA(DIROUT)!(+$GET(Y)'>0)
QUIT
+23 SET GMTSADM=$PIECE($PIECE($GET(^TMP("GMTSPX",$JOB,+Y)),U),".")
+24 SET GMTSDC=$PIECE($PIECE($GET(^TMP("GMTSPX",$JOB,+Y)),U,2),".")
+25 IF GMTSADM]""
IF GMTSDC=""
SET GMTSDC=DT
+26 KILL ^TMP("GMTSPX",$JOB)
+27 QUIT
+28 ;
INHDR ; Based on the VISIT File
+1 WRITE !!,?15,"ADMISSION DATE/TIME",?45,"DISCHARGE DATE/TIME",!
+2 QUIT
+3 ;
OUTLOOK(DFN,OUT) ; Display Outpatient Visits
+1 ;
+2 ; This option displays outpatient visits from the
+3 ; Visit (#9000010) file to the screen. Outpatient
+4 ; visits = visits with a service category of:
+5 ;
+6 ; Ambulatory
+7 ; Observation
+8 ; Day Surgery
+9 ; Nursing Home
+10 ;
+11 ; A number, the visit date, and the hospital location
+12 ; or credit stop will be display on the screen. The
+13 ; order of the display will be from most recent visits
+14 ; to oldest visits. The user can pick the visit they
+15 ; want and the visit date is passed back to the calling
+16 ; routine by parameter passing by reference.
+17 ;
+18 NEW DIR,Y,X,VISITDT,CTR,SELNR,RECNR,CLINIC,HIT,VISIT,HLOC
+19 SET OUT=""
+20 KILL ^TMP("HS",$JOB),^TMP("PXV",$JOB)
+21 SET (CTR,HIT,SELNR,VISITDT,RECNR)=0
+22 SET VISITDT=""
SET RECNR=""
+23 FOR
DO VISIT^PXRHS14(DFN,.VISITDT,.RECNR,1,"ASOR")
if VISITDT'>0
QUIT
Begin DoDot:1
+24 SET NODE=$GET(^TMP("PXV",$JOB,VISITDT,RECNR))
+25 KILL ^TMP("PXV",$JOB)
+26 if NODE']""
QUIT
+27 SET VISIT=$PIECE(NODE,U)
+28 SET CLINIC=$PIECE(NODE,U,4)
+29 SET HLOC=$PIECE(NODE,U,6)
+30 if 'HIT
DO OUTHDR
SET HIT=1
SET SELNR=SELNR+1
SET CTR=CTR+1
+31 WRITE !,?7,SELNR,?15,$$FMTE^XLFDT(VISIT,"2P"),?45,$SELECT(HLOC]"":HLOC,1:CLINIC)
+32 SET ^TMP("HS",$JOB,SELNR)=RECNR_U_VISIT_U_CLINIC_U_HLOC
+33 IF CTR>9
Begin DoDot:2
+34 SET DIR("A")="Enter a number between 1 and "_SELNR_", press return to continue or '^' to exit: "
+35 SET DIR(0)="NOA^1:"_SELNR
DO ^DIR
SET CTR=0
WRITE !
End DoDot:2
if $DATA(DTOUT)!$DATA(DUOUT)!(+$GET(Y)>0)
QUIT
End DoDot:1
if $DATA(DUOUT)!$DATA(DTOUT)!(+$GET(Y)>0)
QUIT
+36 IF SELNR>0&(CTR>0)&(CTR'>9)
Begin DoDot:1
+37 SET DIR("A")="Enter a number between 1 and "_SELNR_": "
+38 SET DIR(0)="NOA^1:"_SELNR
DO ^DIR
WRITE !
End DoDot:1
+39 IF SELNR'>0
WRITE !!,"No Outpatient visits for this patient"
QUIT
+40 SET OUT=$PIECE($GET(^TMP("HS",$JOB,+$GET(Y))),U,2)
+41 KILL ^TMP("HS",$JOB),^TMP("PXV",$JOB)
+42 QUIT
OUTHDR ; Header for screen Display
+1 WRITE !!,?15,"VISIT DATE/TIME",?45,"HOSPITAL LOCATION/CLINIC",!
+2 QUIT