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

EDPBDL.m

Go to the documentation of this file.
  1. EDPBDL ;SLC/KCM - Delete/Inactivate Config Entries ;2/28/12 08:33am
  1. ;;2.0;EMERGENCY DEPARTMENT;;May 2, 2012;Build 103
  1. ;
  1. BED ; Delete Room/Area entries
  1. N AREA,IEN
  1. D SETAREA(.AREA) Q:'AREA
  1. W !,"EDIS Delete Room-Bed Tool",!
  1. W !,"This will delete or inactivate an entry from the TRACKING ROOM-BED file."
  1. W !,"This may take time, as it must search for usage of the Room-Bed entry."
  1. W !,"If the entry has been referenced, it will be inactivated."
  1. W !,"Otherwise the entry will be deleted.",!
  1. F S IEN=$$LKBED(AREA) Q:'IEN D DELBED(IEN)
  1. Q
  1. LKBED(AREA) ; Lookup a bed
  1. N DIC,X,Y,DTOUT,DUOUT
  1. S DIC="^EDPB(231.8,",DIC(0)="AEMQ"
  1. S DIC("S")="I ($P(^(0),U,2)=DUZ(2)),($P(^(0),U,3)=AREA)"
  1. D ^DIC
  1. Q:+Y>0 +Y
  1. Q ""
  1. ;
  1. DELBED(IEN) ; Delete bed if nothing references it, otherwise inactivate
  1. N NM,DA,DIE,DR,DIK,DTOUT,DUOUT
  1. S NM=$P($G(^EDPB(231.8,IEN,0)),U)
  1. I $$BEDUSED(IEN) D
  1. . S DA=IEN,DR=".01///Z"_NM_";.04///1",DIE="^EDPB(231.8,"
  1. . D ^DIE W !,NM," inactivated and renamed 'Z"_NM_"'.",!
  1. E D
  1. . S DA=IEN,DIK="^EDPB(231.8," D ^DIK
  1. . W !,$S($D(^EDPB(231.8,DA,0)):" not",1:"")_" deleted.",!
  1. Q
  1. BEDUSED(IEN) ; Return true if log entry references bed
  1. W !,"Searching for usages of ",$P(^EDPB(231.8,IEN,0),U)
  1. N I,FOUND,COUNT
  1. S I=0,FOUND=0,COUNT=0
  1. F S I=$O(^EDP(230.1,I)) Q:'I D Q:FOUND
  1. . I $P($G(^EDP(230.1,I,3)),U,4)=IEN W "...found" S FOUND=1
  1. . S COUNT=COUNT+1 I COUNT#100=0 W "."
  1. Q FOUND
  1. BOARD ; Delete Board entries
  1. Q
  1. CODE ; Delete Selection entries
  1. N AREA,SET
  1. D SETAREA(.AREA) Q:'AREA
  1. W !,"EDIS Delete Selection Tool",!
  1. W !,"This will delete a locally defined selection from"
  1. W !,"an EDIS selection list.",!
  1. S SET=$$LKSEL(AREA) Q:'SET
  1. ;
  1. N DIC,X,Y,X0,NM,DTOUT,DUOUT
  1. S DIC="^EDPB(233.2,"_SET_",1,",DIC(0)="AEMQ"
  1. S DIC("W")="W $P(^(0),U,4)"
  1. D ^DIC
  1. Q:Y<1
  1. S X0=^EDPB(233.2,SET,1,+Y,0),NM=$P(^EDPB(233.1,+$P(X0,U,2),0),U)
  1. I $E(NM,1,3)="edp" W !,"Cannot delete nationally defined item." Q
  1. D DELCODE(SET,+Y)
  1. Q
  1. LKSEL(AREA) ; Choose selection list for deletion
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT
  1. S DIR(0)="SABO^1:Status;2:Disposition;3:Delay Reason;4:Source"
  1. S DIR("A")="Selection List (1/2/3/4):"
  1. S DIR("A",1)="Choose the list you with to delete from -"
  1. S DIR("A",2)="1: Status",DIR("A",3)="2: Disposition"
  1. S DIR("A",4)="3: Delay Reason",DIR("A",5)="4: Source"
  1. D ^DIR
  1. Q:'Y ""
  1. ;
  1. N SETNM,IEN
  1. S SETNM=$S(1:".status",2:".disposition",3:".delay",4:".arrival",1:"")
  1. Q:SETNM="" ""
  1. S SETNM=$$STA^XUAF4(DUZ(2))_SETNM
  1. S IEN=$O(^EDPB(233.2,"B",SETNM,0))
  1. I 'IEN W !,"No locally defined selections found." Q ""
  1. Q IEN
  1. ;
  1. DELCODE(SET,DA) ; Delete from inside selection multiple
  1. N DIK
  1. W !,$P(^EDPB(233.2,SET,1,DA,0),U,4)
  1. S DIK="^EDPB(233.2,"_SET_",1,",DA(1)=SET D ^DIK
  1. W " ",$S($D(^EDPB(233.2,SET,1,DA,0)):" not",1:"")," deleted",!
  1. Q
  1. ;
  1. SETAREA(AREA) ; Set to default area for institution in DUZ(2)
  1. S AREA=$O(^EDPB(231.9,"C",DUZ(2),0))
  1. I 'AREA W !,"No tracking area is configured."
  1. Q