source: WorldVistAEHR/trunk/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMC7.m@ 949

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

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1QAMC7 ;HISC/DAD-CONDITION: LENGTH OF STAY IN A TREATING SPECIALTY ;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 TXSPGRP=$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 TXSPDT=START:0 S TXSPDT=$O(^DGPM("AMV6",TXSPDT)) Q:(TXSPDT'>0)!(TXSPDT'<END)!(TXSPDT\1'?7N) F QAMDFN=0:0 S QAMDFN=$O(^DGPM("AMV6",TXSPDT,QAMDFN)) Q:QAMDFN'>0 D LOOP0
8 F QAMDFN=0:0 S QAMDFN=$O(^UTILITY($J,"QAM TEMP",QAMDFN)) Q:QAMDFN'>0 F TXSPDT=0:0 S TXSPDT=$O(^UTILITY($J,"QAM TEMP",QAMDFN,TXSPDT)) Q:TXSPDT'>0 D LOOP2
9 K ^UTILITY($J,"QAM TEMP"),LOS,TXSPGRP,X1,X2,END,START,TXSPDT,TXSP,IEN,X
10 Q
11LOOP0 F IEN=0:0 S IEN=$O(^DGPM("AMV6",TXSPDT,QAMDFN,IEN)) Q:IEN'>0 D LOOP1
12 Q
13LOOP1 I TXSPGRP S TXSP=+$S($D(^DGPM(IEN,0))#2:$P(^(0),"^",9),1:0) Q:$O(^QA(743.5,TXSPGRP,"GRP","AB",TXSP,0))'>0
14 K ^UTILITY($J,"QAM TEMP",QAMDFN) S ^UTILITY($J,"QAM TEMP",QAMDFN,TXSPDT)=IEN
15 Q
16LOOP2 S X=$O(^DGPM("APTT3",QAMDFN,TXSPDT)) Q:(X'>QAMTODAY)&X S X=$O(^DGPM("APTT6",QAMDFN,TXSPDT)) Q:(X'>QAMTODAY)&X
17 S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN,QAMTODAY)=^UTILITY($J,"QAM TEMP",QAMDFN,TXSPDT)
18 Q
19EN2 ; *** PARAMETER CODE
20 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")
21 S DIR("?",1)="Enter the LOS from the date of the patient's transfer into",DIR("?",2)="a treating specialty.",DIR("?")="Enter the treating specialty length of stay from 1-365 days."
22 S QAMPARAM="P1" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
23 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P1")=Y
242 K DIC,DIR,DIRUT S DIC=743.5,DIC(0)="EMNQZ",DIC("S")="I $P(^(0),""^"",2)=45.7",DIC("A")="TREATING SPECIALTY GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:$P(^("P2"),"^",2),1:"") K:DIC("B")="" DIC("B")
25 S DIR("?",1)="Enter a GROUP name that contains MAS treating specialties.",DIR("?")="press 'RETURN' for all treating specialties."
26 S QAMPARAM="P2" D EN2^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
27 S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P2")=+Y_"^"_Y(0,0)
28EXIT K Y
29 K QAMPARAM
30Y Q
Note: See TracBrowser for help on using the repository browser.