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

RAMAINU1.m

Go to the documentation of this file.
  1. RAMAINU1 ;HISC/GJC-Radiology Utility File Maintenance (utility)
  1. ;;5.0;Radiology/Nuclear Medicine;**45**;Mar 16, 1998
  1. ;Note: new routine with the release of RA*5*45
  1. ;
  1. FILEAU(RAD0,RATRKCMB) ;File the 'when, where, and who' data when the contrast
  1. ;media definitions for our Rad/Nuc Med Procedure change via an edit.
  1. ;input: RADA=IEN of the Rad/Nuc Med Procedure record
  1. ; RATRKCMB=the before contrast media definition
  1. S RAD1=$O(^RAMIS(71,RAD0,"AUD",$C(32)),-1)+1
  1. ;It is important to know when the user purges cm associations
  1. ;related to a procedure. In this case, we want to audit file to
  1. ;track subsequent cm purge events ignoring the case when the user
  1. ;initially associates cm with a procedure.
  1. I RAD1=1,RATRKCMB="" K RAD1 Q
  1. S RASFM(71.06,"+"_RAD1_","_RAD0_",",.01)=+$E($$NOW^XLFDT(),1,12)
  1. S RASFM(71.06,"+"_RAD1_","_RAD0_",",2)=RATRKCMB
  1. S RASFM(71.06,"+"_RAD1_","_RAD0_",",3)=$G(DUZ)
  1. D UPDATE^DIE("","RASFM","RAD1") K RAD1,RASFM
  1. Q
  1. ;
  1. AUD70(RADFN,RADTI,RACNI,RATRKCMB) ;File the 'when, where, and who' data
  1. ;when the contrast media definitions for our Rad/Nuc Med exam change
  1. ;via an edit.
  1. ;input: RADFN=DFN of the Rad/Nuc Med patient (file 2)
  1. ; RADTI=exam date/time (inverse)
  1. ; RACNI=ien of exam record (examinations sub-file 70.03)
  1. ; RATRKCMB=the before contrast media definition
  1. S RAD3=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"AUD",$C(32)),-1)+1
  1. ;It is important to know when the user purges cm associations related
  1. ;to an exam. In this case, we want to audit file to track subsequent
  1. ;cm purge events ignoring the case when the user initially associates
  1. ;cm with an exam.
  1. I RAD3=1,RATRKCMB="" K RAD3 Q
  1. S RAIENS="+"_RAD3_","_RACNI_","_RADTI_","_RADFN_","
  1. S RASFM(70.16,RAIENS,.01)=+$E($$NOW^XLFDT(),1,12)
  1. S RASFM(70.16,RAIENS,2)=RATRKCMB
  1. S RASFM(70.16,RAIENS,3)=$G(DUZ)
  1. D UPDATE^DIE("","RASFM","RAD3") K RAD3,RAIENS,RASFM
  1. Q
  1. ;
  1. UPPCM(DA,X) ;Check that if contrast media data is associated with this
  1. ;procedure that the 'CONTRAST MEDIA USED' (#20) field is set
  1. ;to 'Yes'. If contrast media data is not associated with this
  1. ;procedure check that the 'CONTRAST MEDIA USED' field is set
  1. ;to 'No'. Called immediately after exiting the 'RA PROCEDURE EDIT'
  1. ;input template in RAMAIN2.
  1. ;
  1. ;input: DA=IEN of the record in file 71
  1. ; X=the internal value; 'N' - No, 'Y' - Yes, or '@' - delete
  1. ;
  1. K RASFM S RASFM(71,DA_",",20)=X
  1. D UPDATE^DIE("","RASFM") K RASFM
  1. Q
  1. ;
  1. CMINTEG(DA,X) ;ensure data consistency between the 'CONTRAST MEDIA USED' &
  1. ;'CONTRAST MEDIA' fields for file 71.
  1. ;
  1. ;input: DA=ien of the record in file 71
  1. ; X=zero node of RAD/NUC MED PROCEDURE record
  1. S RACM471=$O(^RAMIS(71,DA,"CM",0))
  1. I RACM471,$P(X,U,20)'="Y" D ;cm assoc, contrast media used 'no'
  1. .W !!?3,"'"_$E($P(X,U),1,45)_"' has contrast media associations:"
  1. .S RAI=0 F S RAI=$O(^RAMIS(71,DA,"CM",RAI)) Q:'RAI D ;display CM
  1. ..S RAI(0)=$G(^RAMIS(71,DA,"CM",RAI,0))
  1. ..W !?5,$$EXTERNAL^DILFD(71.0125,.01,"",$P(RAI(0),U))
  1. ..Q
  1. .W !?3,"Updating the 'CONTRAST MEDIA USED' field to 'Yes'."
  1. .D UPPCM(DA,"Y") K RAI
  1. .Q
  1. I 'RACM471,$P(X,U,20)="Y" D ;no cm assoc, contrast media used 'yes'
  1. .W !!?3,"'"_$E($P(X,U),1,45)_"' doesn't have contrast media associations;"
  1. .W !?3,"updating the 'CONTRAST MEDIA USED' field to 'No'."
  1. .D UPPCM(DA,"N")
  1. .Q
  1. K RACM471 Q
  1. ;
  1. XCMINTEG(DA) ;ensure data consistency between the 'CONTRAST MEDIA USED' &
  1. ;'CONTRAST MEDIA' fields for file 70.
  1. ;
  1. ;input: DA=ien of the record in file 70 array; DA, DA(1), & DA(2)
  1. ;
  1. S RAXCM0=$G(^RADPT(DA(2),"DT",DA(1),"P",DA,0))
  1. S RAXCMP=$P(RAXCM0,U,2),RAXCMP=$$EXTERNAL^DILFD(70.03,2,"",RAXCMP)
  1. S RACM470=$O(^RADPT(DA(2),"DT",DA(1),"P",DA,"CM",0))
  1. I RACM470,$P(RAXCM0,U,10)'="Y" D ;cm assoc, contrast media used 'no'
  1. .W !!?3,"'"_$E(RAXCMP,1,45)_"' has contrast media associations:"
  1. .S RAI=0
  1. .F S RAI=$O(^RADPT(DA(2),"DT",DA(1),"P",DA,"CM",RAI)) Q:'RAI D ;display CM
  1. ..S RAI(0)=$G(^RADPT(DA(2),"DT",DA(1),"P",DA,"CM",RAI,0))
  1. ..W !?5,$$EXTERNAL^DILFD(70.3225,.01,"",$P(RAI(0),U))
  1. ..Q
  1. .W !?3,"Updating the 'CONTRAST MEDIA USED' field to 'Yes'."
  1. .D UPXCM^RAMAINU(.DA,"Y") K RAI
  1. .Q
  1. I 'RACM470,$P(RAXCM0,U,10)="Y" D ;no cm assoc, contrast media used 'yes'
  1. .W !!?3,"'"_$E(RAXCMP,1,45)_"' doesn't have contrast media associations;"
  1. .W !?3,"updating the 'CONTRAST MEDIA USED' field to 'No'."
  1. .D UPXCM^RAMAINU(.DA,"N")
  1. .Q
  1. K RACM470,RAXCM0,RAXCMP Q
  1. ;