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

QAOC1011.m

Go to the documentation of this file.
QAOC1011 ;HISC/DAD-OCCURRENCE SCREEN AUTO ENROLLMENT ; 6/9/14 1:13pm
 ;;3.0;Occurrence Screen;**9**;09/14/1993;Build 4
 ;SCREEN 101.1 -- READMISSION WITHIN 10 DAYS
 Q:$$INACTIVE^QAOC0(101.1)
 F QAOSDT=(QAMTODAY-.0000001):0 S QAOSDT=$O(^DGPM("AMV1",QAOSDT)) Q:QAOSDT'>0!(QAOSDT>(QAMTODAY+.24))!(QAOSDT\1'?7N)  F QAOSDFN=0:0 S QAOSDFN=$O(^DGPM("AMV1",QAOSDT,QAOSDFN)) Q:QAOSDFN'>0  D
 . F QAOSD0=0:0 S QAOSD0=$O(^DGPM("AMV1",QAOSDT,QAOSDFN,QAOSD0)) Q:QAOSD0'>0  S QAOSZERO=$G(^DGPM(QAOSD0,0)) I QAOSZERO]"" D MAIN
 . Q
 Q
MAIN ;
 ;Q:$$SCHED^QAOC0(QAOSDFN,QAOSDT)
 ; Check date and time to see if scheduled or unscheduled admit (QAO*3*9)
 Q:$$SCHED2^QAOC0(QAOSDFN,QAOSDT)
 S INTYP(0)=$P(QAOSZERO,"^",18)
 S INTYP=$S(INTYP(0)'>0:"",$D(^DG(405.2,INTYP(0),0))#2:^(0),1:"")
 S SPECDT=+$O(^DGPM("APTT6",QAOSDFN,+QAOSZERO-.0000001))
 S SPECD0=$O(^DGPM("APTT6",QAOSDFN,SPECDT,0))
 S TXSP=$S(SPECD0'>0:"",$D(^DGPM(SPECD0,0))#2:$P(^(0),"^",9),1:"")
 S Y=$$TXSP^QAOC0("ASP",TXSP)
 Q:$S(+Y=-1:1,$P(INTYP,"^",2)'=1:1,INTYP(0)'>0:1,1:0)
 S QAOSDTP=9999999.9999999-QAOSDT
AGAIN ;
 S QAOSDTP=$O(^DGPM("ATID3",QAOSDFN,QAOSDTP))
 Q:QAOSDTP'>0!(QAOSDTP\1'?7N)
 S QAOSD1P=$O(^DGPM("ATID3",QAOSDFN,QAOSDTP,0))
 S QAOSZERO(0)=$S(QAOSD1P'>0:"",$D(^DGPM(QAOSD1P,0))#2:^(0),1:"")
 G:QAOSZERO(0)="" AGAIN
 S OUTIMP=+QAOSZERO(0),OUTYPP=$P(QAOSZERO(0),"^",18)
 S X1=$P(QAOSZERO,"^")\1,X2=OUTIMP\1 D ^%DTC Q:X>10
 I OUTYPP>0,$D(^DG(405.2,OUTYPP,0))#2,$P(^(0),"^",8)=4 G AGAIN
 D VADPT^QAOC0(QAOSDFN,QAOSD1P)
 S ^UTILITY($J,"QAM CONDITION",QAMD1,QAOSDFN,QAMTODAY)=""
 S WARDCLIN=+VAIP(5)_"^"
 S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"WARD")=WARDCLIN
 S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"TXSP")=+VAIP(8)
 S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"MVDT")=OUTIMP
 D VADPT^QAOC0(QAOSDFN,QAOSD0)
 S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"DIAG")=VAIP(9)
 S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"AADM")=VAIP(13)
 Q