source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSCUP.m@ 1261

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

initial load of WorldVistAEHR

File size: 5.3 KB
Line 
1YSCUP ;DALISC/LJA - MH Patient Movement Driver ;9/12/94 12:04
2 ;;5.01;MENTAL HEALTH;**2,11,20,29**;Dec 30, 1994
3 ;
4 QUIT
5 ;
6BEGIN ; Called by [YS PATIENT MOVEMENT] Protocol in [DG MOVEMENT EVENTS]
7 ; Called by RERUN^YSCUP, also... (An undocumented call point)
8 ;
9 ;D TRACE
10 ;
11 I '$G(DGQUIET) W !,"MAS Patient Movement - Activating Mental Health Update"
12 I $P($G(^YSA(602,1,0)),U,6)="Y" D
13 . S ZTRTN="CTRL^YSCUP000"
14 . S ZTDTH=$HOROLOG
15 . ;
16 . ;VARIABLES TO BE SAVED IN ZTSAVE
17 . S ZTSAVE("*")=""
18 . ;
19 . S ZTDESC="MENTAL HEALTH - YS PAT MOVEMENT"
20 . S ZTIO=""
21 . D ^%ZTLOAD
22 I $P($G(^YSA(602,1,0)),U,6)="Y" D QUIT
23 . I '$G(DGQUIET) W !!,"The Mental Health Update has been Tasked, job# ",ZTSK,"...",!
24 ;
25 I '$G(DGQUIET) W !!,"Starting Mental Health Update..."
26 D CTRL^YSCUP000
27 D END
28 I '$G(DGQUIET) D
29 . W:$X>(IOM-10) ! W " done..."
30 QUIT
31 ;
32END ;
33 ;Kill variables at end of updating
34 K %,%X,%Y,A,ARR,ARR1,DA,DIC,DIE,DIK,DIR,DLAYGO,DR,END,I,LP
35 K MH0,MH7,MHIEN,MHNO,MOVE,MOVNO,MT,NO,NODE,P,TA,TIEN,TP
36 K VAIP,WIEN,WN,X,X1,X2,Y
37 K YS0,YS5,YS7,YSACTS,YSAMH,YSAMV,YSBEDT,YSC,YSDFN,YSDT,YSEND
38 K YSFEDT,YSFMTMH,YSIEN,YSLADM,YSLAST,YSLMHA,YSLMOMH
39 K YSLP,YSLR,YSLTRSF,YSMH,YSMHAN,YSMHDT,YSMHMOV
40 K YSMOVES,YSMOVN,YSMOVOK,YSMT,YSMV,YSNM,YSNMH,YSNO,YSNOW,YSOK,YSPM,YSPMA
41 K YSPMT,YSPURDT,YST,YSTRIP,YSVDT,YSX,YSXEC,YSXTMP,YSY
42 KILL ^TMP("YSMH",$J),^TMP("YSPM",$J)
43 QUIT
44 ;
45TRACE ;
46 ;S X1=DT,X2=7 D C^%DTC S PURGEDT=X
47 ;S ^XTMP("MHINP",$J)=PURGEDT_U_$G(DFN)_U_"***"_U_DGPMA
48 ;QUIT
49 ;
50RERUN ;
51 I '$G(DGQUIET) W !!,"This utility will evaluate and correct the inpatient status of a patient...",!
52 D END
53R1 K DA,DIC,Y,YSDFN
54 S DIC(0)="AEMQ",DIC=2,DIC("A")="Select Patient: "
55 D ^DIC
56 QUIT:+Y'>0 ;->
57 S YSDFN=+Y
58 D CHKMOV^YSCUP000
59 D END
60 I '$G(DGQUIET) W !
61 S DIR(0)="EA",DIR("A")="Press RETURN to continue, or '^' to exit..."
62 D ^DIR
63 KILL DIR
64 QUIT:X[U ;->
65 G R1 ;->
66 ;
67RTNS ; List of routines used by YSCUP
68 ;
69 ;YSCUP Call point by DGPM MOVEMENT EVENTS protocol.
70 ;YSCUP003 Gets MH Movements into ^TMP("YSMH",$J,.
71 ; Gets Movements into ^TMP("YSPM",$J, via ^VADPT calls.
72 ; Establishes matches between ^TMP("YSPM",$J, and ^TMP("YSMH",$J,.
73 ;YSCUP001 Updates MH Inpt entry data.
74 ;YSCUP000 Master logic which establishes variables,
75 ; determines where to call, etc.
76 ;YSCUP004 Creates, deletes ^XTMP data.
77 ;YSCUP002 Adds new MH Inpt entries using ^TMP("YSPM",$J, data.
78 ; Deletes MH Inpt entries.
79 QUIT
80 ;
81CALLS ; Undocumented and unsupported "internal use" calls...
82 ; (These calls are NOT used by package!!)
83 ;
84 ; RERUN^YSCUP Resubmits patient for update.
85 ; SHOWPT^YSCUP004 Show all XTMP data for one patient
86 ;
87 QUIT
88 ;
89VARDOC ; Documentation of variable structures
90 ;
91 ; YSLADM = Last Admit in YSMP( array format
92 ; YSLTRSF = Last Transfer in ^TMP("YSPM",$J, array format
93 ; YSMH = Admission IEN responsible for current MH Inpt entry.
94 ;
95 ; ------- Below, # = 999-Sequential number of MH Inpt Entry -------
96 ; -------------- contained in the YSMH array ------------------
97 ; ^TMP("YSMH",$J,#,0) = MH Inpt IEN ~ Node 0 (Ie., ^YSG("INP",MH Inpt IEN,0))
98 ; ^TMP("YSMH",$J,#,7) = Node 7 (Ie., ^YSG("INP",MH Inpt IEN,7)
99 ; ^TMP("YSMH",$J,"M",Admission IEN of MH Inpt entry) = # ^ MH Inpt IEN
100 ; -----------------------------------------------------------------
101 ;
102 ; YSMHMOV = 0 ->
103 ; 1 ->
104 ;
105 ; YSMOVES = p(3) of last ^YSG("INP",ien,7) found...
106 ; Note: if = 328~328, it is changed to 328.
107 ; if = 328~395, it is left.
108 ;
109 ; YSMV = IEN of last YSPM movement found...
110 ; YSNM = Number of movements found and contained in ^TMP("YSPM",$J,#)...
111 ; YSNMH = Number of MH Inpt entries found and in ^TMP("YSMH",$J,#,0-7)...
112 ;
113 ; ------- Below, # = 999-Sequential number of Movement -------
114 ; -------------- contained in the YSPM array ------------------
115 ; ^TMP("YSPM",$J,#) = MH Move? (0/1) ^ Ward IEN ^ Default Team IEN ^ Move Type (1-3) ^ Move IEN ^ D/T of movement
116 ;
117 ; ^TMP("YSPM",$J,"M",Movement IEN) = # ^ Admit DT
118 ; -----------------------------------------------------------------
119 ;
120 ; YST = 5 pieces as explained below... (All answers are 0 or 1)
121 ; p(1) = Does any ^TMP("YSMH",$J, data exist for patient?
122 ; p(2) = Is there any Movement data in ^TMP("YSPM",$J,? ... which is found via ^VADPT calls.
123 ; p(3) = Any MH moves in ^TMP("YSPM",$J, movement data?
124 ; p(4) = Does +^TMP("YSMH",$J,"M",Admit IEN) = +$O(^TMP("YSPM",$J,"M",0))? See var explanation above.
125 ; p(5) = Are there any MH wards in the ^UTILITY("DGPM" data. (Usually, not viewed...)
126 ; p(6) = Does any ^YSG("INP" data exist for patient?
127 ;
128 ; ------------------------- Sample data ------------------------------
129 ; YSMH=328
130 ; ^TMP("YSMH",$J,997,0)=2~2940829.1013^5^2940829.092857^3
131 ; ^TMP("YSMH",$J,997,7)=7^2940829.092857^328~328^
132 ; ^TMP("YSMH",$J,998,0)=1~2940829.0929^5^2940829.092857^3
133 ; ^TMP("YSMH",$J,998,7)=7^2940829.10124^328~332^
134 ; ^TMP("YSMH",$J,"M",328)=997^2
135 ; YSMHMOV=0
136 ; YSMOVES=328
137 ; YSMV=328
138 ; YSNM=4
139 ; YSNMH=2
140 ; ^TMP("YSPM",$J,995)=0^10^^3^332^2940829.10124
141 ; ^TMP("YSPM",$J,996)=0^10^^2^331^2940829.094158
142 ; ^TMP("YSPM",$J,997)=1^1^1^2^330^2940829.093201
143 ; ^TMP("YSPM",$J,998)=1^7^3^1^328^2940829.092857
144 ; ^TMP("YSPM",$J,"M",328)=998
145 ; YST=1^1^0^1^0
146 QUIT
147 ;
148EOR ;YSCUP - MH Patient Movement Driver ;9/12/94 12:04
Note: See TracBrowser for help on using the repository browser.