source: FOIAVistA/trunk/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMC8.m@ 1608

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1QAMC8 ;HISC/DAD-CONDITION: LENGTH OF STAY ON A WARD ;2/10/92 07:33
2 ;;1.0;Clinical Monitoring System;;09/13/1993
3EN1 ; *** CONDITION CODE
4 S LOS=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:+^("P1"),1:0)
5 S WARDGRP=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:+^("P2"),1:0)
6 S X1=QAMTODAY,X2=-LOS D C^%DTC S (X1,START)=X,X2=1 D C^%DTC S END=X,START=START-.0000001 K ^UTILITY($J,"QAM TEMP")
7 F WARDDT=START:0 S WARDDT=$O(^DGPM("AMV1",WARDDT)) Q:(WARDDT'>0)!(WARDDT'<END)!(WARDDT\1'?7N) F QAMDFN=0:0 S QAMDFN=$O(^DGPM("AMV1",WARDDT,QAMDFN)) Q:QAMDFN'>0 F IEN=0:0 S IEN=$O(^DGPM("AMV1",WARDDT,QAMDFN,IEN)) Q:IEN'>0 D LOOP1
8 F WARDDT=START:0 S WARDDT=$O(^DGPM("AMV2",WARDDT)) Q:(WARDDT'>0)!(WARDDT'<END)!(WARDDT\1'?7N) F QAMDFN=0:0 S QAMDFN=$O(^DGPM("AMV2",WARDDT,QAMDFN)) Q:QAMDFN'>0 F IEN=0:0 S IEN=$O(^DGPM("AMV2",WARDDT,QAMDFN,IEN)) Q:IEN'>0 D LOOP1
9 F QAMDFN=0:0 S QAMDFN=$O(^UTILITY($J,"QAM TEMP",QAMDFN)) Q:QAMDFN'>0 F WARDDT=0:0 S WARDDT=$O(^UTILITY($J,"QAM TEMP",QAMDFN,WARDDT)) Q:WARDDT'>0 D LOOP2
10 K ^UTILITY($J,"QAM TEMP"),LOS,WARDGRP,X1,X2,X,END,START,WARDDT,IEN
11 Q
12LOOP1 I WARDGRP S WARD=+$S($D(^DGPM(IEN,0))#2:$P(^(0),"^",6),1:0) Q:$O(^QA(743.5,WARDGRP,"GRP","AB",WARD,0))'>0
13 K ^UTILITY($J,"QAM TEMP",QAMDFN) S ^UTILITY($J,"QAM TEMP",QAMDFN,WARDDT)=IEN
14 Q
15LOOP2 S X=$O(^DGPM("APTT3",QAMDFN,WARDDT)) Q:(X'>QAMTODAY)&X S X=$O(^DGPM("APTT2",QAMDFN,WARDDT)) Q:(X'>QAMTODAY)&X
16 S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN,QAMTODAY)=^UTILITY($J,"QAM TEMP",QAMDFN,WARDDT)
17 Q
18EN2 ; *** PARAMETER CODE
19 K DIR,DIRUT S DIR(0)="NO^1:365:0",DIR("A")="LENGTH OF STAY",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),1:"") K:DIR("B")="" DIR("B")
20 S DIR("?",1)="Enter the LOS from the date of the patient's transfer onto a ward.",DIR("?")="Enter the ward length of stay from 1-365 days."
21 S QAMPARAM="P1" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
22 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P1")=Y
232 K DIC,DIR,DIRUT S DIC=743.5,DIC(0)="EMNQZ",DIC("S")="I $P(^(0),""^"",2)=42",DIC("A")="WARD GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:$P(^("P2"),"^",2),1:"") K:DIC("B")="" DIC("B")
24 S DIR("?",1)="Enter a GROUP name that contains MAS ward locations.",DIR("?")="press 'RETURN' for all ward locations."
25 S QAMPARAM="P2" D EN2^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
26 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P2")=+Y_"^"_Y(0,0)
27EXIT K Y
28 K QAMPARAM
29Y Q
Note: See TracBrowser for help on using the repository browser.