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

NURAAU3.m

Go to the documentation of this file.
NURAAU3 ;HIRMFO/RM,MD-PURGE MODULE...AMIS A1106 ;2/27/98  14:20
 ;;4.0;NURSING SERVICE;**9**;Apr 25, 1997
 ; LAST MODIFIED BY MD;/10/26/92
 ; DONE BY: NURAAU0
EN1 ; PURGE AMIS ACUITY DATA
 ; PURGE YEARLY (RETAIN 4 FISCAL YEARS) FROM FILE 213.4
 ;
 S NURPLSW=1
 S PURGDATE=($E(DT,1,3)-4)_"1001" S REC="" F NURSI=0:0 S REC=$O(^NURSA(213.4,"B",REC)) Q:'($E(REC,1,7)<PURGDATE)  S DA=$O(^NURSA(213.4,"B",REC,0)),DIK="^NURSA(213.4," W:'$D(ZTQUEUED) "." D ^DIK
 K NURPLSW Q
EXCP ; FILE EXCEPTION REPORT DATA
 I $S(NURTYPE=1:1,1:0) G 1
 S:'$D(^NURSA(213.5,NEXCDA,1,0)) ^NURSA(213.5,NEXCDA,1,0)="^213.51P^^"
 S ^NURSA(213.5,NEXCDA,1,DFN,0)=DFN_"^"_NWARD,$P(^NURSA(213.5,NEXCDA,1,0),"^",3,4)=DFN_"^"_($P(^NURSA(213.5,NEXCDA,1,0),"^",4)+1),DA(1)=NEXCDA,DA=DFN,DIK="^NURSA(213.5,DA(1),1," D IX1^DIK
 S DIE="^NURSA(213.5,DA(1),1,",DR="2///^S X=NERR;3///^S X=NURSX;4///^S X=CLSDATE" D ^DIE Q
1 Q:NERR(1)=""  S:'$D(^NURSA(213.5,NEXCDA(1),1,0)) ^NURSA(213.5,NEXCDA(1),1,0)="^213.51P^^"
 S ^NURSA(213.5,NEXCDA(1),1,DFN,0)=DFN_"^"_NWARD,$P(^NURSA(213.5,NEXCDA(1),1,0),"^",3,4)=DFN_"^"_($P(^NURSA(213.5,NEXCDA(1),1,0),"^",4)+1),DA(1)=NEXCDA(1),DA=DFN,DIK="^NURSA(213.5,DA(1),1," D IX1^DIK
 S DIE="^NURSA(213.5,DA(1),1,",DR="2///^S X=NERR(1);3///^S X=NURSX;4///^S X=CLSDATE" D ^DIE
 Q
EN2 ; ENTRY TO PURGE FILE 213.5 DATA OLDER THAN 30 DAYS AND CREATE TODAYS NODES
 S X="T-30",%DT="" D ^%DT S NURSJ=+Y
 S DIK="^NURSA(213.5," F NURSI=0:0 S NURSI=$O(^NURSA(213.5,"B",NURSI)) Q:NURSI'>0  F DA=0:0 S DA=$O(^NURSA(213.5,"B",NURSI,DA)) Q:DA'>0  I '(NURSI>NURSJ) W:'$D(ZTQUEUED) "." D ^DIK
 L +^NURSA(213.5)
 F NURTYPE=0,1 S X=RPTDATE,DLAYGO=213.5,DIC="^NURSA(213.5,",DIC(0)="L",DIC("DR")=".02///^S X=NURTYPE",DIC("S")="I $P(^(0),U,2)=NURTYPE" D ^DIC K DIC,DLAYGO S:NURTYPE=0 NEXCDA=+Y S:NURTYPE=1 NEXCDA(1)=+Y
 L -^NURSA(213.5) S:+Y'>0 NUROUTSW=1 Q:NUROUTSW
 K NURTYPE
 Q
HEMCOUNT ; HEMODIALYSIS COUNT UPDATE
 S BEDSECT=$O(^NURSF(213.3,"B","HEMODIALYSIS","")),NURS1=0
 I $L(BEDSECT)=1 S BEDSECT="0"_BEDSECT
 F NCWARD=0:0 S NCWARD=$O(^NURSA(214.6,"ACNT",RPTDATE,NCWARD)) Q:NCWARD'>0  F NURSI=0:0 S NURSI=$O(^NURSA(214.6,"ACNT",RPTDATE,NCWARD,"H",NURSI)) Q:NURSI'>0  S NURS1=NURS1+1 D HMRCPROC S NURS1=0
 Q
RECOUNT ; RECOVERY ROOM COUNT UPDATE
 S BEDSECT=$O(^NURSF(213.3,"B","RECOVERY ROOM","")),NURS1=0
 I $L(BEDSECT)=1 S BEDSECT="0"_BEDSECT
 F NCWARD=0:0 S NCWARD=$O(^NURSA(214.6,"ACNT",RPTDATE,NCWARD)) Q:NCWARD'>0  F NURSI=0:0 S NURSI=$O(^NURSA(214.6,"ACNT",RPTDATE,NCWARD,"R",NURSI)) Q:NURSI'>0  S NURS1=NURS1+1 D HMRCPROC S NURS1=0
 Q
HMRCPROC ; PROCESS RECOVERY/ROOM AND HEMODALYSIS COUNTS
 S REC=RPTDATE_BEDSECT_NCWARD F I=1:1:5 S NCLASS(I)=0
 S NCLASS(1)=NURS1 D FINALLY^NURAAU0
 Q