source: WorldVistAEHR/trunk/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMC23.m@ 702

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1QAMC23 ;HISC/DAD-CONDITION: MH SECLUSION/RESTRAINT ;9/3/93 13:24
2 ;;1.0;Clinical Monitoring System;;09/13/1993
3EN1 ; *** CONDITION CODE
4 S WARDGRP=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:+^("P1"),1:0)
5 S TYPEGRP=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:+^("P2"),1:0)
6 S REASGRP=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:+^("P3"),1:0)
7 S SRHOURS=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P4"))#2:+^("P4"),1:0)
8 D NOW^%DTC S QAMNOW=%
9 F QAMHDT=QAMTODAY-.0000001:0 S QAMHDT=$O(^YS(615.2,"B",QAMHDT)) Q:(QAMHDT'>0)!(QAMHDT>(QAMTODAY+.9999999))!(QAMHDT\1'?7N) F QAMHD0=0:0 S QAMHD0=$O(^YS(615.2,"B",QAMHDT,QAMHD0)) Q:QAMHD0'>0 D LOOP1
10 K DIC,DIR,DIRUT,FOUND,QAMHD0,QAMHDT,QAMHZERO,QAMPARAM,REAS,REASGRP,TYPE,TYPEGRP,WARD,WARDGRP,QAMAPPLY,QAMNOW,QAMRELAS,QAMDAY,QAMHRS,QAMSEC,SRHOURS
11 Q
12LOOP1 S QAMHZERO=$G(^YS(615.2,QAMHD0,0)) Q:QAMHZERO=""
13 I WARDGRP S WARD=$P(QAMHZERO,"^",4) Q:$O(^QA(743.5,WARDGRP,"GRP","AB",WARD,0))'>0
14 I TYPEGRP S FOUND=0 D Q:'FOUND
15 . F TYPE=0:0 S TYPE=$O(^YS(615.2,QAMHD0,5,"B",TYPE)) Q:TYPE'>0 I $O(^QA(743.5,WARDGRP,"GRP","AB",WARD,0)) S FOUND=1 Q
16 . Q
17 I REASGRP S FOUND=0 D Q:'FOUND
18 . F REAS=0:0 S REAS=$O(^YS(615.2,QAMHD0,10,"B",REAS)) Q:REAS'>0 I $O(^QA(743.5,REASGRP,"GRP","AB",REAS,0)) S FOUND=1 Q
19 . Q
20 S QAMDFN=+$P(QAMHZERO,"^",2),QAMAPPLY=+$P(QAMHZERO,"^",3),QAMRELAS=$P($G(^YS(615.2,QAMHD0,40)),"^",3),QAMRELAS=$S(QAMRELAS:QAMRELAS,1:QAMNOW)
21 S X=QAMAPPLY D H^%DTC S QAMAPPLY(1)=+%H,QAMAPPLY(2)=%T
22 S X=QAMRELAS D H^%DTC S QAMRELAS(1)=+%H,QAMRELAS(2)=%T
23 S QAMDAY=QAMRELAS(1)-QAMAPPLY(1),QAMSEC=QAMRELAS(2)-QAMAPPLY(2)
24 S QAMDAY=QAMDAY-(QAMSEC<0),QAMSEC=QAMSEC+$S(QAMSEC<0:86400,1:0)
25 S QAMHRS=24*QAMDAY+(QAMSEC/3600) Q:QAMHRS<SRHOURS
26 S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^(QAMDFN,QAMAPPLY)=QAMHD0
27 Q
28EN2 ; *** PARAMETER CODE
2921 K DIC,DIR,DIRUT S DIC=743.5,DIC(0)="EMNQZ",DIC("S")="I $P(^(0),""^"",2)=44",DIC("A")="HOSPITAL LOCATION GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:$P(^("P1"),"^",2),1:"") K:DIC("B")="" DIC("B")
30 S DIR("?",1)="Enter a GROUP name that contains MAS hospital locations.",DIR("?")="Press 'RETURN' for all hospital locations."
31 S QAMPARAM="P1" D EN2^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
32 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P1")=+Y_"^"_Y(0,0)
33 ;
3422 K DIC,DIR,DIRUT S DIC=743.5,DIC(0)="EMNQZ",DIC("S")="I $P(^(0),""^"",2)=615.6",DIC("A")="SECLUSION/RESTRAINT TYPE GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:$P(^("P2"),"^",2),1:"") K:DIC("B")="" DIC("B")
35 S DIR("?",1)="Enter a GROUP name that contains types of seclusion or restraints.",DIR("?")="Press 'RETURN' for all types of seclusion and restraints."
36 S QAMPARAM="P2" D EN2^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
37 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P2")=+Y_"^"_Y(0,0)
38 ;
3923 K DIC,DIR,DIRUT S DIC=743.5,DIC(0)="EMNQZ",DIC("S")="I $P(^(0),""^"",2)=615.5",DIC("A")="REASON FOR S/R GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:$P(^("P3"),"^",2),1:"") K:DIC("B")="" DIC("B")
40 S DIR("?",1)="Enter a GROUP name that contains reasons for seclusion/restraint.",DIR("?")="Press 'RETURN' for all reasons."
41 S QAMPARAM="P3" D EN2^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
42 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P3")=+Y_"^"_Y(0,0)
4324 ;
442 K DIR,DIRUT S DIR(0)="NO^1:96:0",DIR("A")="MAXIMUM TIME IN S/R (HOURS)",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:+^("P2"),1:24) K:DIR("B")'>0 DIR("B")
45 S DIR("?",1)="Enter the maximum number of hours the patient may be held"
46 S DIR("?",2)="in seclusion/restraint. Patients in S/R for more than"
47 S DIR("?",3)="this amount of time will be captured."
48 S DIR("?")="Enter a number from 1 to 96."
49 S QAMPARAM="P4" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
50 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P4")=Y
51EXIT K Y
52 K QAMPARAM
53Y Q
Note: See TracBrowser for help on using the repository browser.