PXRRLCSC ;ISL/PKR - PCE reports locations selection criteria routines. ;4/8/97
;;1.0;PCE PATIENT CARE ENCOUNTER;**12,18,20,72,189**;Aug 12, 1996;Build 13
;;Reference to FileMan call Institution file (#4) supported by DBIA 10090.
;;Reference to ^DIC(40.7 supported by DBIA 93-C.
;
;=======================================================================
BYLOC ;Ask if the report should be broken down by clinic location or clinic
;stop
N X,Y
K DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="S"_U_"L:Location;"
S DIR(0)=DIR(0)_"S:Stop"
S DIR("A")="Do you want totals by Clinic Location or Clinic Stop?"
S DIR("B")="L"
D ^DIR K DIR
I Y="L" S $P(PXRRLCSC,U,3)=1
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
Q
;
;=======================================================================
CSTOP ;Get a list of clinic stop codes.
K DTOUT,DUOUT
S NCS=0
S DIC("A")="Select CLINIC STOP: "
W !
NSTOP ;Select the clinic stop codes.
S DIC=40.7
S DIC(0)="AEMQZ"
I NCS'<1 S DIC("A")="Select another CLINIC STOP: "
D ^DIC K DIC
I X=(U_U) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
I (NCS=0)&(+Y=-1) W !,"You must select a clinic stop!" G CSTOP
I +Y'=-1 D G NSTOP
. S NCS=NCS+1
.;Save the external form of the name, the IEN, and the stop code.
. S PXRRCS(NCS)=$P(Y(0,0),U,1)_U_$P(Y,U,1)_U_$P(Y(0),U,2)
;Sort the clinic stop list into alphabetical order.
S NCS=$$SORT^PXRRUTIL(NCS,"PXRRCS",2)
Q
;
;=======================================================================
FACILITY ;Get the facility list.
N IC,STATION,X,Y
K DIRUT,DTOUT,DUOUT
S NFAC=0
S DIC("B")=+$P($$SITE^VASITE,U,3)
S DIC("A")="Select FACILITY: "
W !
FAC ;Select the facilities.
S DIC=4
S DIC(0)="AEMQZ"
I NFAC'<1 S DIC("A")="Select another FACILITY: "
D ^DIC K DIC
I X=(U_U) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
I +Y'=-1 D G FAC
. S NFAC=NFAC+1
. S PXRRFAC(NFAC)=Y_U_Y(0,0)
;
;Save the facility names and station.
F IC=1:1:NFAC D
. S X=$P(PXRRFAC(IC),U,1)
. ;S STATION=$P($G(^DIC(4,X,99)),U,1)
. S STATION=$$GET1^DIQ(4,X_",",99,"I")
. S PXRRFACN(X)=$P(PXRRFAC(IC),U,2)_U_STATION
;
;Ask user whether they want to display non-va sites
S DIR(0)="Y"_U_"N:No;"
S DIR(0)=DIR(0)_"Y:Yes"
W !
S DIR("A")="Do you want to display encounters at Non-VA sites "
S DIR("B")="NO" ; Changed from N to NO - *189
D ^DIR K DIR
I +Y=1 D
. S NFAC=NFAC+1
. S PXRRFACN("*")="NON-VA^*"
. S PXRRFAC(NFAC)="*^NON-VA^NON-VA"
. S NONVA=1
;
;Sort the facility list into alphabetical order.
S NFAC=$$SORT^PXRRUTIL(NFAC,"PXRRFAC",2)
Q
;
;=======================================================================
HLOC ;Build a list of hospital locations.
N IEN,SC,X,Y
K DTOUT,DUOUT
S NHL=0
S DIC="^SC("
S DIC(0)="AEQMZ"
S DIC("A")="Select HOSPITAL LOCATION: "
W !
NHLOC I NHL'<1 S DIC("A")="Select another HOSPITAL LOCATION: "
D ^DIC
I X=(U_U) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
I +Y'=-1 D G NHLOC
. S NHL=NHL+1
. S IEN=$P(Y,U,1)
.;Get the stop code.
. S X=$P(^SC(IEN,0),U,7)
. I +X>0 S SC=$P(^DIC(40.7,X,0),U,2)
. E S SC="Unknown"
. I $L(SC)=0 S SC="Unknown"
.;Save the IEN, the external form of the name, and the stop code.
. S PXRRLCHL(NHL)=IEN_U_$P(Y(0,0),U,1)_U_SC
.;Save the external form of the name, then IEN, and the stop code.
. S PXRRLCHL(NHL)=$P(Y(0,0),U,1)_U_IEN_U_SC
E K DIC
I $D(DUOUT) G HLOC
I (NHL=0)&(+Y=-1) W !,"You must select a hospital location!" G HLOC
;Sort the hospital location list into alphabetical order.
S NHL=$$SORT^PXRRUTIL(NHL,"PXRRLCHL",2)
Q
;
;=======================================================================
LOC(ADEF,BDEF) ;Establish the location selection criteria.
N X,Y
LOC0 K DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="S"_U_"HA:All Hospital Locations (with encounters);"
S DIR(0)=DIR(0)_"HS:Selected Hospital Locations;"
S DIR(0)=DIR(0)_"CA:All Clinic Stops (with encounters);"
S DIR(0)=DIR(0)_"CS:Selected Clinic Stops"
S DIR("A")=ADEF
S DIR("B")=BDEF
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S PXRRLCSC=Y_U_Y(0)
;
;If locations are to be selected individually get the list.
I Y="HS" D HLOC
I $D(DTOUT) Q
I $D(DUOUT) G LOC0
I Y="CS" D CSTOP
I $D(DTOUT) Q
I $D(DUOUT) G LOC0
Q
;
;=======================================================================
NEWPAGE ;Allow the user to decide if they want each location to start on a new
;page.
N X,Y
K DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="YA0"
S DIR("A")="Want to start each location on a new page: "
S DIR("B")="Y"
W !
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S PXRRLCNP=Y_U_Y(0)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRRLCSC 4713 printed Dec 13, 2024@02:30:48 Page 2
PXRRLCSC ;ISL/PKR - PCE reports locations selection criteria routines. ;4/8/97
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**12,18,20,72,189**;Aug 12, 1996;Build 13
+2 ;;Reference to FileMan call Institution file (#4) supported by DBIA 10090.
+3 ;;Reference to ^DIC(40.7 supported by DBIA 93-C.
+4 ;
+5 ;=======================================================================
BYLOC ;Ask if the report should be broken down by clinic location or clinic
+1 ;stop
+2 NEW X,Y
+3 KILL DIROUT,DIRUT,DTOUT,DUOUT
+4 SET DIR(0)="S"_U_"L:Location;"
+5 SET DIR(0)=DIR(0)_"S:Stop"
+6 SET DIR("A")="Do you want totals by Clinic Location or Clinic Stop?"
+7 SET DIR("B")="L"
+8 DO ^DIR
KILL DIR
+9 IF Y="L"
SET $PIECE(PXRRLCSC,U,3)=1
+10 IF $DATA(DIROUT)
SET DTOUT=1
+11 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+12 QUIT
+13 ;
+14 ;=======================================================================
CSTOP ;Get a list of clinic stop codes.
+1 KILL DTOUT,DUOUT
+2 SET NCS=0
+3 SET DIC("A")="Select CLINIC STOP: "
+4 WRITE !
NSTOP ;Select the clinic stop codes.
+1 SET DIC=40.7
+2 SET DIC(0)="AEMQZ"
+3 IF NCS'<1
SET DIC("A")="Select another CLINIC STOP: "
+4 DO ^DIC
KILL DIC
+5 IF X=(U_U)
SET DTOUT=1
+6 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+7 IF (NCS=0)&(+Y=-1)
WRITE !,"You must select a clinic stop!"
GOTO CSTOP
+8 IF +Y'=-1
Begin DoDot:1
+9 SET NCS=NCS+1
+10 ;Save the external form of the name, the IEN, and the stop code.
+11 SET PXRRCS(NCS)=$PIECE(Y(0,0),U,1)_U_$PIECE(Y,U,1)_U_$PIECE(Y(0),U,2)
End DoDot:1
GOTO NSTOP
+12 ;Sort the clinic stop list into alphabetical order.
+13 SET NCS=$$SORT^PXRRUTIL(NCS,"PXRRCS",2)
+14 QUIT
+15 ;
+16 ;=======================================================================
FACILITY ;Get the facility list.
+1 NEW IC,STATION,X,Y
+2 KILL DIRUT,DTOUT,DUOUT
+3 SET NFAC=0
+4 SET DIC("B")=+$PIECE($$SITE^VASITE,U,3)
+5 SET DIC("A")="Select FACILITY: "
+6 WRITE !
FAC ;Select the facilities.
+1 SET DIC=4
+2 SET DIC(0)="AEMQZ"
+3 IF NFAC'<1
SET DIC("A")="Select another FACILITY: "
+4 DO ^DIC
KILL DIC
+5 IF X=(U_U)
SET DTOUT=1
+6 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+7 IF +Y'=-1
Begin DoDot:1
+8 SET NFAC=NFAC+1
+9 SET PXRRFAC(NFAC)=Y_U_Y(0,0)
End DoDot:1
GOTO FAC
+10 ;
+11 ;Save the facility names and station.
+12 FOR IC=1:1:NFAC
Begin DoDot:1
+13 SET X=$PIECE(PXRRFAC(IC),U,1)
+14 ;S STATION=$P($G(^DIC(4,X,99)),U,1)
+15 SET STATION=$$GET1^DIQ(4,X_",",99,"I")
+16 SET PXRRFACN(X)=$PIECE(PXRRFAC(IC),U,2)_U_STATION
End DoDot:1
+17 ;
+18 ;Ask user whether they want to display non-va sites
+19 SET DIR(0)="Y"_U_"N:No;"
+20 SET DIR(0)=DIR(0)_"Y:Yes"
+21 WRITE !
+22 SET DIR("A")="Do you want to display encounters at Non-VA sites "
+23 ; Changed from N to NO - *189
SET DIR("B")="NO"
+24 DO ^DIR
KILL DIR
+25 IF +Y=1
Begin DoDot:1
+26 SET NFAC=NFAC+1
+27 SET PXRRFACN("*")="NON-VA^*"
+28 SET PXRRFAC(NFAC)="*^NON-VA^NON-VA"
+29 SET NONVA=1
End DoDot:1
+30 ;
+31 ;Sort the facility list into alphabetical order.
+32 SET NFAC=$$SORT^PXRRUTIL(NFAC,"PXRRFAC",2)
+33 QUIT
+34 ;
+35 ;=======================================================================
HLOC ;Build a list of hospital locations.
+1 NEW IEN,SC,X,Y
+2 KILL DTOUT,DUOUT
+3 SET NHL=0
+4 SET DIC="^SC("
+5 SET DIC(0)="AEQMZ"
+6 SET DIC("A")="Select HOSPITAL LOCATION: "
+7 WRITE !
NHLOC IF NHL'<1
SET DIC("A")="Select another HOSPITAL LOCATION: "
+1 DO ^DIC
+2 IF X=(U_U)
SET DTOUT=1
+3 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+4 IF +Y'=-1
Begin DoDot:1
+5 SET NHL=NHL+1
+6 SET IEN=$PIECE(Y,U,1)
+7 ;Get the stop code.
+8 SET X=$PIECE(^SC(IEN,0),U,7)
+9 IF +X>0
SET SC=$PIECE(^DIC(40.7,X,0),U,2)
+10 IF '$TEST
SET SC="Unknown"
+11 IF $LENGTH(SC)=0
SET SC="Unknown"
+12 ;Save the IEN, the external form of the name, and the stop code.
+13 SET PXRRLCHL(NHL)=IEN_U_$PIECE(Y(0,0),U,1)_U_SC
+14 ;Save the external form of the name, then IEN, and the stop code.
+15 SET PXRRLCHL(NHL)=$PIECE(Y(0,0),U,1)_U_IEN_U_SC
End DoDot:1
GOTO NHLOC
+16 IF '$TEST
KILL DIC
+17 IF $DATA(DUOUT)
GOTO HLOC
+18 IF (NHL=0)&(+Y=-1)
WRITE !,"You must select a hospital location!"
GOTO HLOC
+19 ;Sort the hospital location list into alphabetical order.
+20 SET NHL=$$SORT^PXRRUTIL(NHL,"PXRRLCHL",2)
+21 QUIT
+22 ;
+23 ;=======================================================================
LOC(ADEF,BDEF) ;Establish the location selection criteria.
+1 NEW X,Y
LOC0 KILL DIROUT,DIRUT,DTOUT,DUOUT
+1 SET DIR(0)="S"_U_"HA:All Hospital Locations (with encounters);"
+2 SET DIR(0)=DIR(0)_"HS:Selected Hospital Locations;"
+3 SET DIR(0)=DIR(0)_"CA:All Clinic Stops (with encounters);"
+4 SET DIR(0)=DIR(0)_"CS:Selected Clinic Stops"
+5 SET DIR("A")=ADEF
+6 SET DIR("B")=BDEF
+7 DO ^DIR
KILL DIR
+8 IF $DATA(DIROUT)
SET DTOUT=1
+9 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+10 SET PXRRLCSC=Y_U_Y(0)
+11 ;
+12 ;If locations are to be selected individually get the list.
+13 IF Y="HS"
DO HLOC
+14 IF $DATA(DTOUT)
QUIT
+15 IF $DATA(DUOUT)
GOTO LOC0
+16 IF Y="CS"
DO CSTOP
+17 IF $DATA(DTOUT)
QUIT
+18 IF $DATA(DUOUT)
GOTO LOC0
+19 QUIT
+20 ;
+21 ;=======================================================================
NEWPAGE ;Allow the user to decide if they want each location to start on a new
+1 ;page.
+2 NEW X,Y
+3 KILL DIROUT,DIRUT,DTOUT,DUOUT
+4 SET DIR(0)="YA0"
+5 SET DIR("A")="Want to start each location on a new page: "
+6 SET DIR("B")="Y"
+7 WRITE !
+8 DO ^DIR
KILL DIR
+9 IF $DATA(DIROUT)
SET DTOUT=1
+10 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+11 SET PXRRLCNP=Y_U_Y(0)
+12 QUIT
+13 ;