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

GMRADEL.m

Go to the documentation of this file.
  1. GMRADEL ;HIRMFO/WAA-PATIENT DELETE REACTION ;11/14/06 13:18
  1. ;;4.0;Adverse Reaction Tracking;**36**;Mar 29, 1996;Build 9
  1. ;
  1. ; Is this data Correct question:
  1. ;Single Reaction:
  1. ; user |
  1. ; reponse | action taken
  1. ;-------------------------------------------------------------
  1. ; Yes | Data is Sign off
  1. ; |
  1. ; No | User is asked if they wish to delete the entry
  1. ; ^,timeout|---------------------------------------------------
  1. ; | response | action taken
  1. ; |---------------------------------------------------
  1. ; | yes | the entry is deleted
  1. ; | ^,timeout|
  1. ; | |
  1. ; | no | the entry is not deletes and a alert trigered
  1. ; |---------------------------------------------------
  1. ;
  1. ;Multiple Reaction:
  1. ; user |
  1. ; reponse | action taken
  1. ;-------------------------------------------------------------
  1. ; select | Selected reaction will be signed
  1. ;reactions |
  1. ; |
  1. ;reactions | all User is asked if they wish to delete the entry
  1. ;NOT |---------------------------------------------------
  1. ;selected | response | action taken
  1. ; OR |---------------------------------------------------
  1. ;^,timeout | yes | the entries is deleted
  1. ; | ^,timeout|
  1. ; | |
  1. ; | no | the entries is not deletes and a alert trigered
  1. ; |---------------------------------------------------
  1. ;
  1. ;Note: Only one entry point will be needed.....
  1. DEL ; Main Entry point
  1. N DIR,GMRACNT,GMRAPCT
  1. D DELPRT ; No reaction to be deleted
  1. S DIR(0)="YA",DIR("B")="YES"
  1. S DIR("?")="PLEASE ENTER 'Y' TO DELETE THE CAUSATIVE AGENT"_$S(GMRACNT>1:"S",1:"")_" 'N' NOT TO DELETE THE DATA"
  1. S DIR("??")="^D PRINT^GMRASIGN",DIR("A")="Do you wish to delete "_$S(GMRACNT>1:"these",1:"this")_" Causative Agent"_$S(GMRACNT>1:"s",1:"")_"? " D ^DIR
  1. I $D(DIRUT) S Y=1,GMRAOUT=1
  1. S GMRAPCT=Y
  1. Q:'GMRAPCT ; User did not want to delete the entry(s)
  1. ; User want to delete the data
  1. D DELETE
  1. Q
  1. DELETE ; Deleting the data
  1. N X
  1. ;W !,"One moment please deleting data..."
  1. S X=0 F S X=$O(^TMP($J,"GMRASF",X)) Q:X<1 D
  1. .N GMRAPA
  1. .S GMRAPA=$O(^TMP($J,"GMRASF",X,0)) ; find 120.8 data
  1. .S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)=""
  1. .I '$G(^TMP($J,"GMRASF",X,GMRAPA)) D EIE Q ;36 Existing records are marked entered in error rather than being deleted
  1. .N GMRAPA1
  1. .S GMRAPA1=0
  1. .; find 120.85 data
  1. .F S GMRAPA1=$O(^GMR(120.85,"C",GMRAPA,GMRAPA1)) Q:GMRAPA1<1 D
  1. ..S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0))
  1. ..I GMRAPA1(0)="" K ^GMR(120.85,"C",GMRAPA,GMRAPA1) Q
  1. ..D ; delete 120.85 data
  1. ...N DIK,DA
  1. ...S DIK="^GMR(120.85,",DA=GMRAPA1 D ^DIK
  1. ...D UNLOCK^GMRAUTL(120.85,GMRAPA1) ; Unlocking the data 120.85
  1. ...;W "." ;36
  1. ...Q
  1. ..Q
  1. .D ; delete 120.8 data
  1. ..N DIK,DA
  1. ..S DIK="^GMR(120.8,",DA=GMRAPA D ^DIK
  1. ..D UNLOCK^GMRAUTL(120.8,GMRAPA) ; Unlocking the data 120.8
  1. ..;W "." ;36
  1. ..Q
  1. .S X=$O(^TMP($J,"GMRASF","B",GMRAPA,0))
  1. .K ^TMP($J,"GMRASF",X,GMRAPA),^TMP($J,"GMRASF","B",GMRAPA,X)
  1. .Q
  1. Q
  1. DELPRT ; List all the reaction not signed
  1. N X,GMRAPA
  1. W @IOF
  1. S (GMRACNT,X)=0
  1. F S X=$O(^TMP($J,"GMRASF",X)) Q:X<1 D
  1. .S GMRAPA=$O(^TMP($J,"GMRASF",X,0))
  1. .S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)=""
  1. .W !,$P(GMRAPA(0),U,2)
  1. .S GMRACNT=GMRACNT+1
  1. .Q
  1. Q
  1. ;
  1. EIE ;Section added in patch 36, will mark existing records entered in error
  1. N GMRADFN,ALDATA,SUB
  1. S GMRADFN=$P(GMRAPA(0),U)
  1. S ALDATA("GMRAERRDT")=$$NOW^XLFDT,ALDATA("GMRAERRBY")=$G(DUZ,.5)
  1. D EIE^GMRAGUI1(GMRAPA,GMRADFN,"ALDATA")
  1. S SUB=$O(^TMP($J,"GMRASF","B",GMRAPA,0))
  1. K ^TMP($J,"GMRASF",SUB,GMRAPA),^TMP($J,"GMRASF","B",GMRAPA,SUB) ;Delete entry as it's been taken care of
  1. Q