Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSJPDIR

PSJPDIR.m

Go to the documentation of this file.
  1. PSJPDIR ;BIR/MLM-PATIENT PROFILE CALLS ;10 MAY 96 / 9:56 AM
  1. ;;5.0; INPATIENT MEDICATIONS ;**53,111**;16 DEC 97
  1. ;
  1. ; Reference to ^DIC is supported by DBIA 10006
  1. ; Reference to ^DIR is supported by DBIA 10026
  1. ; Reference to ^VADPT is supported by DBIA 10061
  1. ;
  1. GWP ; Ask for seletion by WARD GROUP,WARD or PATIENT.
  1. K PSJSEL,DIR S PSJSTOP="",DIR(0)="SAO^G:Ward Group;W:Ward;P:Patient",DIR("A")="Select by WARD GROUP (G), WARD (W), or PATIENT (P): "
  1. S DIR("?")="To select by PATIENT, enter a 'P'."
  1. S DIR("?",1)="To select the entire WARD GROUP, enter a 'G'."
  1. S DIR("?",2)="To select a single WARD, enter a 'W'."
  1. W !! D ^DIR K DIR S PSJSTOP=$S(Y="":1,Y<0:1,$$STOP:1,1:0)
  1. I 'PSJSTOP S PSJSEL("SELECT")=Y D @Y Q:($G(PSJSEL("WG"))="^OTHER") G:PSJSTOP GWP D:PSJSEL("SELECT")'="P" RBPPN G:PSJSTOP GWP
  1. Q
  1. ;
  1. P ;*** Select by Patient
  1. N PSJACNWP,PSGDICA,PSGPAT S PSJACNWP=""
  1. F PFLG=0:1 S:PFLG PSGDICA="another" D ^PSJP Q:PSGP<0 S PSJSEL("P",PSGP(0),PSGP)="" S:'$G(PSJPWDO) (PSGWD,PSJPWDO)=PSJPWD S PSGWD=$S('$G(PSGWD):0,PSJPWDO=PSJPWD:PSJPWD,1:0)
  1. S PSJSTOP=$S($D(DTOUT):1,$D(DUOUT):1,(Y<0)&'$D(PSGDICA):1,1:0)
  1. Q
  1. ;
  1. W ;*** Select by WARD
  1. K DIC S DIC="^DIC(42,",DIC(0)="QEAMIZ",DIC("A")="Select a Ward: " W !! D ^DIC
  1. S PSJSTOP=$S(Y="":1,Y<0:1,$$STOP:1,1:0)
  1. I 'PSJSTOP S PSJSEL("W")=Y D ADMTM
  1. Q
  1. ;
  1. G ;***Select by WARD GROUP
  1. K DIC S DIC="^PS(57.5,",DIC(0)="QEAMI",DIC("A")="Select a Ward Group: " W !! D ^DIC
  1. S PSJSTOP=$S(X="^OTHER":2,Y="":1,Y<0:1,$$STOP:1,1:0)
  1. ;I PSJSTOP=2 S PSJSTOP=0,PSJSEL("WG")="^OTHER" Q
  1. I PSJSTOP=2 S PSJSEL("WG")="^OTHER" Q
  1. I 'PSJSTOP S PSJSEL("WG")=Y
  1. Q
  1. ;
  1. ADMTM ;*** Askif user want to sort by admin team
  1. N DIR S DIR(0)="YO",DIR("A")="Do you want to sort by Administration Team (Y/N)",DIR("B")="NO",DIR("?")="Enter ""YES"" to sort this report by Administration Team." W !! D ^DIR Q:$$STOP!'+Y
  1. ;
  1. ;*** Because "ALL" is not a team, must use DIR to include "ALL"
  1. ; default and then call DIC to look up the selected team
  1. ;
  1. F Q:$$STOP!(X="")!$D(PSJSEL("TM","ALL")) D ADMTM2
  1. Q
  1. ADMTM2 ;
  1. K DIR S DIR(0)="FAO",DIR("A")="Select Administration Team: ",DIR("B")="ALL",DIR("?")="^D TM2HLP^PSJPDIR,DICTM^PSJPDIR"
  1. W !! D ^DIR Q:$$STOP I Y="ALL" S PSJSEL("TM","ALL")="" Q
  1. D DICTM
  1. S PSJSTOP=$S($D(DTOUT):1,$D(DUOUT):1,(Y<0)&'$D(PFLG):1,1:0)
  1. Q
  1. TM2HLP W !!,"Enter the name of an Administration Team that you want",!,"to include on the report."," Enter ""ALL"" (or accept the",!,"default) to include all teams on the report.",!
  1. Q
  1. ;
  1. DICTM ;*** LooK up a team.
  1. ;
  1. K DIC S DIC="^PS(57.7,"_+PSJSEL("W")_",1,",DIC(0)="QEMIZ"
  1. F PFLG=0:1 D ^DIC Q:Y<0 I PFLG S DIC(0)=DIC(0)_"A",DIC("A")="Select another Administration Team: " S PSJSEL("TM",+Y)=Y(0,0)
  1. Q
  1. ;
  1. RBPPN ;*** Sort by ROOM-BED or PATIENT
  1. ;
  1. K DIR S DIR(0)="SAO^R:Room-Bed;P:Patient",DIR("A")="Do you wish to sort by Room-Bed (R), Patient (P): ",DIR("B")="Patient"
  1. W !! D ^DIR Q:$$STOP S PSJSEL("RBP")=Y
  1. Q
  1. ENL ;
  1. F W !!,"SHORT, LONG, or NO Profile? ",$S('$D(PSJPWD):"SHORT",PSJPWD:"SHORT",1:"LONG"),"// " R PSJOL:DTIME W:'$T $C(7) S:'$T PSJOL="^" Q:PSJOL="^" D LCHK Q:"^SLN"[PSJOL&($L(PSJOL)=1)
  1. Q
  1. ;
  1. LCHK ;
  1. I PSJOL?1."?" D LM Q
  1. I PSJOL="" S PSJOL=$S('$D(PSJPWD):"S",PSJPWD:"S",1:"L") W $P(" SHORT^ LONG","^",PSJOL="L"+1) Q
  1. I PSJOL?.ANP,PSJOL?.E1L.E F Q=1:1:$L(PSJOL) I $E(PSJOL,Q)?.L S PSJOL=$E(PSJOL,1,Q-1)_$C($A(PSJOL,Q)-32)_$E(PSJOL,Q+1,$L(PSJOL))
  1. I PSJOL?.ANP F X="NO PROFILE","LONG","SHORT" I $P(X,PSJOL)="" W $P(X,PSJOL,2) S PSJOL=$E(PSJOL) Q
  1. W:'$T $C(7)," ??" Q
  1. ;
  1. LM ;Profile Type
  1. W !!?2,"Enter 'SHORT' (or 'S', or press the RETURN key) to exclude this patient's",!,"discontinued and expired orders in the following profile. Enter 'LONG' (or 'L') to include those orders."
  1. W " Enter 'NO' (or 'N') to bypass the profile com-",!,"pletely. Enter '^' if you wish to go no further with this patient." Q
  1. ENDPT ;*** get patient ***
  1. K DIC,PSGP,Y W !!,"Select "_$S($D(PSGDICA):PSGDICA_" ",1:"")_"PATIENT: " R X:DTIME I "^"[X S (Y,PSGP)=-1 G DONE
  1. D EN^PSJDPT
  1. I Y'>0 G ENDPT
  1. K DIC
  1. ;
  1. CHK ;*** Check patient status ***
  1. S PPN=$P(Y,U,2),(DFN,PSGP)=+Y,VA200=1 D INP^VADPT Q:VAIN(4)
  1. S PSJPCAF="",VAIP("D")="L" D IN5^VADPT I 'VAIP(13,1) W $C(7),!!?3,"PATIENT HAS NEVER BEEN ADMITTED." G ENDPT
  1. S X=+VAIP(4)=12!(+VAIP(4)=38) W $C(7),!!?3,"PATIENT IS FOUND TO BE D",$P("ISCHARG^ECEAS",U,X+1),"ED AS OF ",$$ENDTC^PSGMI(+VAIP(3)),"." G ENDPT
  1. Q
  1. ;
  1. STOP() ;
  1. ;
  1. S PSJSTOP=$S($D(DTOUT):1,$D(DUOUT):1,$D(DIRUT):1,1:0)
  1. Q PSJSTOP
  1. ;
  1. DONE ;
  1. K DA,DIC,DIK
  1. Q