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

PSJCLOR1.m

Go to the documentation of this file.
  1. PSJCLOR1 ;BIR/JCH - SHOW NON-VERFIED CLINIC ORDERS GATHERED IN PSJCLOR1 ; 2/28/12 9:11am
  1. ;;5.0;INPATIENT MEDICATIONS;**275**;DEC 16, 1997;Build 157
  1. ;
  1. ; Reference to ^PSSLOCK is supported by DBIA #2789
  1. ; Reference to ^DIR is supported by DBIA 10026
  1. ; Reference to ^VALM is supported by DBIA 10118
  1. ;
  1. START ;
  1. N PSJHLIN S PSGOEA=$G(PSGOEA),$P(PSJHLIN,"-",81)="" S PSGPXN=$G(PSGPXN)
  1. K ^TMP("PSJLIST",$J) D:PSGSS'="P" DISPLAYW Q:'$O(^TMP("PSJSELECT",$J,0))
  1. PROCESS ; Loop through selected patients and display profile/orders.
  1. N PSJCNT K DIR,PSJPNV S PSJPNV=1
  1. F PSJCNT=0:0 S PSJCNT=$O(^TMP("PSJSELECT",$J,PSJCNT)) Q:'PSJCNT D PROCESS1 S PSGOP=PSGP D ENQL^PSGLW:$P(PSJSYSL,"^",2)]"" Q:$G(PSJGOTO)="E" I $D(^TMP("PSJSELECT",$J,+$G(PSJGOTO))) S PSJCNT=PSJGOTO-1
  1. D DONE
  1. Q
  1. PROCESS1 ; Process patient
  1. N PSJTMPN,PSJCURCL,PSJCLN,PSJPAD,PSJPAGE,PSJPDD,PSJPDOB,PSJPDX,PSJPHT,PSJPHTD,PSJPRB,PSJPSEX,PSJPSSN,PSJPTD,PSJPWDN,PSJPWT,PSJPWTD,RMORDAT
  1. S PSJCURCL=$G(^TMP("PSJSELECT",$J,"C",$G(PSJCNT)))
  1. S PSJPN=$G(^TMP("PSJSELECT",$J,PSJCNT)),PSJTMPN=PSJPN K PSJGOTO
  1. S PSJLK=$$L^PSSLOCK($P(PSJPN,U,2),1) I 'PSJLK W !,$C(7),$P(PSJLK,U,2) D CONT^PSJOE0 Q
  1. I $G(PSJTMPED),$P(PSJTMPED,"^",2) S PSJEND=$S($P(PSJTMPED,"^",2)'=$P(PSJPN,"^",2):+PSJTMPED,1:+PSJEND)
  1. I $G(PSJTMPBG),$P(PSJTMPBG,"^",2) S PSJBEG=$S($P(PSJTMPBG,"^",2)'=$P(PSJPN,"^",2):+PSJTMPBG,1:+PSJBEG)
  1. K PSJGOTO D:PSJPN]"" GTORDERS
  1. I PSJLK D UL^PSSLOCK($P(PSJTMPN,U,2))
  1. S PSGPXN=$G(PSGPXN)
  1. Q
  1. DISPLAYW ; Allow selection of patients on each ward selected.
  1. K ^TMP("PSJSELECT",$J) S PSJCNT=1,PSGWORP1="" F S PSGWORP1=$O(^TMP("PSGVBW",$J,PSGWORP1)) Q:PSGWORP1="" D DISPLAYP
  1. K PSJASK
  1. Q
  1. DISPLAYP ; Display WORP1 (Ward or Priority)
  1. N PSGPICK
  1. S PSGVBWN=PSGWORP1
  1. D HEADER
  1. S PSGWORP2="" F S PSGWORP2=$O(^TMP("PSGVBW",$J,PSGWORP1,PSGWORP2)) Q:PSGWORP2="" S PSGPRIN=PSGWORP2 D DISPLAYT
  1. I $G(PSJASK),(PSGVBY>0) D ASK
  1. Q
  1. DISPLAYT ;
  1. ;NEW PSGPICK ;PSGPICK=1-->user selected order, stop display the profile
  1. S PSGPRIN=PSGWORP2
  1. S:$G(PSGPRIF) PSGVBWN=PSGWORP2,PSGPRIN=PSGWORP1
  1. S PSGVBTM="" F S PSGVBTM=$O(^TMP("PSGVBW",$J,PSGWORP1,PSGWORP2,PSGVBTM)) Q:(PSGVBTM=""!$G(PSGPICK)) D V2
  1. I $G(PSJPRIF),$G(PSJASK),(PSGVBY>0) D ASK
  1. Q
  1. GTORDERS ;
  1. S (PSGP,DFN)=$P(PSJPN,U,2),PSGOL="S" K PSJACNWP D ^PSJAC
  1. S:$G(PSJTMPBG) PSJBEG=PSJTMPBG S:$G(PSJTMPED) PSJEND=PSJTMPED K PSJTMPBG,PSJTMPED
  1. D PROFILE Q
  1. Q
  1. PROFILE ; Display the patient's profile and allow order selection.
  1. S PSGP=DFN,PSJOL=PSGOL F Q:$G(PSJVALQ) D EN^VALM("PSJ LM CLINIC ORDERS") Q:'$G(PSJORD)&'$G(PSJNEWOE)!$G(PSJVALQ) S PSJNEWOE=0
  1. S PSJVALQ=0
  1. Q
  1. DONE ; Clean up
  1. K PSGOP,PSJLK,PSJNEWOE,PSJPN,VALMBCK,PSGP
  1. Q
  1. V2 ;
  1. S PSGVBPN="" F S PSGVBPN=$O(^TMP("PSGVBW",$J,PSGWORP1,PSGWORP2,PSGVBTM,PSGVBPN)) Q:(PSGVBPN=""!$G(PSGPICK)) S PSGP=$P(PSGVBPN,"^",2),PPN=$P(PSGVBPN,"^") S:PPN="" PPN=PSGP_";DPT(" D WRT
  1. Q
  1. WRT ;
  1. S PSGVBY=PSGVBY+1,PSJASK=1
  1. S PSGVBWN=PSGWORP1,PSGPRD=PSGWORP2
  1. W !,$J(PSGVBY,4),?8,PPN," (",$P(PSGVBPN,U,3),")" S ^TMP("PSJLIST",$J,PSGVBY)=PSGVBWN_U_PSGVBTM_U_PPN_U_PSGP
  1. I $Y+1>IOSL,(PSGVBY>0) NEW DIR S DIR(0)="EA",DIR("A")=" '^' TO QUIT " D ^DIR D
  1. . I X="^" S PSGPICK=1 Q
  1. . S PSJASK=0 W @IOF
  1. Q
  1. ASK ;
  1. N DIR,PSGDFN,PSGASKX S DIR(0)="LOA^1:"_PSGVBY,DIR("A")="Select 1 - "_PSGVBY_": " D ^DIR I $D(DUOUT)!$D(DTOUT) K ^TMP("PSGVBW",$J) Q
  1. S:Y]"" PSGPICK=1
  1. F PSJINDEX=1:1:$L(Y,",")-1 D
  1. . S PSGASKX=$G(^TMP("PSJLIST",$J,$P(Y,",",PSJINDEX))),PSGDFN=$P(PSGASKX,"^",4)_"^"_$P(PSGASKX,"^",3)
  1. . D CHK^PSJDPT(.PSGDFN,1) I PSGDFN=-1 Q
  1. . S:PSGASKX]"" ^TMP("PSJSELECT",$J,PSJCNT)=$P(PSGASKX,U,3,4),^TMP("PSJSELECT",$J,"B",$P(PSGASKX,U,3),PSJCNT)="",^TMP("PSJSELECT",$J,"C",PSJCNT)=$G(^TMP("PSGVBW3",$J,$P(PSGASKX,U),PSGP)),PSJCNT=PSJCNT+1
  1. K PSJINDEX,Y
  1. Q
  1. H2 ;
  1. W !!?2,"Select patients either singularly separated by commas (1,2,3), by a range of",!,"patients separated by a dash (1-3), or a combination (1,2,4-6). To select all",!,"patients, enter 'ALL' or a dash ('-'). You can also enter '-n' to"
  1. W " select the",!,"first patient through the 'nth' patient or enter 'n-' to select the 'nth'",!,"patient through the last patient. If a patient is selected more than once,"
  1. W !,"only the first selection is used. (Entering '1,2,1' would return '1,2'.)" Q
  1. ;
  1. W:$Y @IOF W !,"CLINIC ORDERS - "
  1. I $G(PSGPRIF) W $S($G(PRD)=1:"STAT",$G(PRD)=2:"ASAP",1:"ROUTINE")
  1. I '$G(PSGPRIF) W $S(PSGVBWN="ZZ":"^OTHER",1:PSGVBWN)
  1. W !!," No.",?8,"PATIENT",!,PSJHLIN K PSGVBY S PSGVBY=0 Q
  1. Q
  1. NP ;
  1. W $C(7) R !!,"ENTER AN '^' TO SELECT ORDERS NOW, OR PRESS THE RETURN KEY TO CONTINUE. ",NP:DTIME E S NP="^"
  1. Q
  1. DISPORD(DFN,ON) ;Display the order that being lock by another user
  1. NEW PSJLINE,PSJOC,X
  1. S PSJLINE=1
  1. D DSPLORDU^PSJLMUT1(DFN,ON)
  1. W ! F X=0:0 S X=$O(PSJOC(ON,X)) Q:'X W !,PSJOC(ON,X)
  1. Q
  1. HELP ;
  1. D FULL^VALM1
  1. W !!,"ES Edit Start Date"
  1. W !," Select the medication orders you wish to edit. "
  1. W !," After selecting orders, a new Start Date/Time may be entered."
  1. W !
  1. W !,"VD View Order Detail"
  1. W !," Select the medication orders you wish to view. "
  1. W !," Details for selected orders will be displayed."
  1. W !
  1. W !,"VP View Profile"
  1. W !," View order profile that shows all medication orders."
  1. W !," No edits allowed at this view. "
  1. W !
  1. W !,"CD Change Date Range"
  1. W !," Change the search date range for the current patient's"
  1. W !," Clinic Orders. The search date range will revert to the"
  1. W !," initial search date range for subsequent patients. ",!
  1. D CONT^PSJOE0 S VALMBCK="R"
  1. Q
  1. IMPATPR ; View Profile Entry
  1. D ^PSJHVARS N VAIN,VADM,PSJLM D FULL^VALM1,ENOR^PSJCLOR4(PSGP) D RESTORE^PSJHVARS S VALMBCK="R"
  1. Q
  1. PSJREVFY() ; Ask if Active orders should be re-verified
  1. D FULL^VALM1 W !
  1. K Y,DIR S Y=0 S DIR("A",1)=""
  1. S DIR("A",2)=" ATTENTION: One or more selected orders have an ACTIVE status. "
  1. S DIR("A",3)=" You may choose to have ACTIVE orders remain ACTIVE after editing, or "
  1. S DIR("A",4)=" you may choose to have the status of ACTIVE orders changed to NON-VERIFIED."
  1. S DIR("A",5)=" "
  1. S DIR("?")="^D VFYHELP^PSJCLOR1",DIR(0)="Y",DIR("A")="Should ACTIVE orders remain ACTIVE after editing" D ^DIR W !!
  1. I 'Y,'$G(DUOUT) W !," All selected orders will have a status of NON-VERIFIED after editing",!
  1. Q +Y
  1. VFYHELP ; Help text for auto-reverify
  1. W !?5,"Yes - ACTIVE orders will remain ACTIVE after they are modified.",!
  1. W !?5,"No - The status of ACTIVE orders will be changed to NON-VERIFIED"
  1. W !?5,"after they are modified. The orders must be re-verified, via"
  1. W !?5,"Inpatient Order Entry or other order entry options, in order"
  1. W !?5,"to change the status back to ACTIVE."
  1. Q
  1. SURE() ; Non-Pharmacist can't auto-reverify
  1. D FULL^VALM1 W !
  1. K Y,DIR S Y=0
  1. S DIR("A",1)=" ATTENTION: One or more selected orders have an ACTIVE status. "
  1. S DIR("A",2)=" If you continue, the status of ACTIVE orders will be changed to NON-VERIFIED."
  1. S DIR("A",3)=" "
  1. S DIR("?")="^D SUREHELP^PSJCLOR1",DIR(0)="Y",DIR("A")="Continue editing selected orders" D ^DIR W !
  1. I Y>0,'$G(DUOUT) W !," All selected orders will have a status of NON-VERIFIED after editing",!
  1. Q $S(Y>0:0,1:-1)
  1. SUREHELP ; Help text for non-pharmacists
  1. W !?5,"The status of ACTIVE orders will be changed to NON-VERIFIED"
  1. W !?5,"after they are modified. The orders must be re-verified, via"
  1. W !?5,"Inpatient Order Entry or other order entry options, in order"
  1. W !?5,"to change the status back to ACTIVE."
  1. Q
  1. HDR ; HEADER code for PSJ LM ECO protocol
  1. D A^PSJ200(21,19),SHOW^VALM
  1. S XQORM("#")=+$O(^ORD(101,"B","PSJ LM VIEW ORDER DETAIL",0))_"^1:"_+$G(^TMP("PSJPRO",$J,0))
  1. Q