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

RADD3.m

Go to the documentation of this file.
  1. RADD3 ;HISC/SWM-Radiology Data Dictionary Utility Routine ; Oct 12, 2022@10:55:50
  1. ;;5.0;Radiology/Nuclear Medicine;**18,65,154,194**;Mar 16, 1998;Build 1
  1. ;
  1. ;Supported IA #2056 reference to GET1^DIQ
  1. ;Supported IA #10142 reference to EN^DDIOL
  1. ;Supported IA #2053 reference to UPDATE^DIE, FILE^DIE
  1. ;Supported IA #10103 reference to NOW^XLFDT
  1. ;
  1. PAIR ;
  1. ; called from file 71.9's field SOURCE
  1. ; SOURCE may be added normally via the "RA NM EDIT LOT" option,
  1. ; or it may be added via one of the 3 exam edits when the LOT
  1. ; prompt appears for the case's Radiopharm. This LOT prompt
  1. ; allows adding new LOT on-the-fly, which causes the LOT's
  1. ; associated SOURCE, EXPIRATION DATE, KIT # to be prompted
  1. ; and the current case's Radiopharm to be stuffed into the new LOT's
  1. ; Radiopharm field. The SOURCE field invokes this subroutine to:
  1. ; re-set DR string to stuff matching radiopharm
  1. ; not allow spacebar return for radioph
  1. ; RA*5*65 removed the Fileman Identifier for file 79.1's RADIOPHARM
  1. ; so by default, the DR will just be "2;3;4;" without the "5;".
  1. ;
  1. N RA1,RA2,RA3
  1. I $D(RAOPT("EDITPT"))!($D(RAOPT("EDITCN")))!($D(RAOPT("STATRACK"))) D
  1. . S RA1=$$EN1^RAPSAPI(RAPSDRUG,.01)
  1. . I $G(DR)'[";5",$G(DIE)="^RAMIS(71.9,",+$G(RAPSDRUG),RA1]"" S DR=DR_"5///"_RA1 K ^DISV(DUZ,"^RAMIS(71.9,")
  1. . Q
  1. ; check pairing of number/id with source
  1. ; called by input transform of file 71.9'S field 2 (source)
  1. S (RA1,RA2,RA3)=""
  1. Q:$G(DA)="" Q:$G(D)=""
  1. F S RA1=$O(^RAMIS(71.9,"B",$P(D,U),RA1)) Q:'RA1 I DA'=RA1 S:$P(^RAMIS(71.9,RA1,0),U,2)=+Y RA2=1 ;found a match so set ra2=1
  1. W:RA2 !!,"** There's already a NUMBER/ID=",$P(D,U)," and SOURCE=",$P(Y,U,2)," **",!
  1. K:RA2 X
  1. Q
  1. SCRLOT() ;screen lot # from file 70.2
  1. ;lot's exp. dt must be within d/t dose admin, if no admin, use exam dt
  1. ; if lot's exp. dt is null, allow as choice (don't check)
  1. ;lot's radiopharm must match exam's radiopharm
  1. ; if lot's radiopharm is null, don't allow as choice
  1. ;Y pointer to lot file
  1. ;RA0A date/time dose administered
  1. ;RA0E date/time exam
  1. ;RALOTEXP lot's expiration date
  1. ;RA0RAD exam's radiopharmaceutical
  1. ;RALOTRAD lot's radiopharmaceutical
  1. ;RARETUR return value of screen, 0=failed, 1=passed
  1. I '$D(Y)#2!('$D(DA))!('$D(DA(1))) Q 0
  1. N RA0A,RA0E,RALOTEXP,RA0RAD,RALOTRAD,RARETURN
  1. S RARETURN=0
  1. S RA0E=$P(^RADPTN(DA(1),0),U,2),RA0A=$P(^("NUC",DA,0),U,8),RA0RAD=$P(^(0),U),RALOTEXP=$P(^RAMIS(71.9,+Y,0),U,3),RALOTRAD=$P(^(0),U,5)
  1. I $S(RALOTEXP="":1,RA0A:RALOTEXP>RA0A,1:RALOTEXP>RA0E),(RA0RAD=RALOTRAD) S RARETURN=1
  1. Q RARETURN
  1. ;
  1. GETID(Y) ; Pass back a string of data which will be used as an
  1. ; identifier when lookups are done on the Imaging Locations (79.1) file
  1. ; Input : Y -> ien of entry in 79.1
  1. ; Output: string of data relevent to the entry in file 79.1
  1. ; Location I-type_"-"_Station # of Rad/Nuc Med Division
  1. ; *Location I-type_"-"_Station # of Rad/Nuc Med Division
  1. ; Note: The asterisk preceeding the Location I-type name
  1. ; indicates the I-loc is inactive. (P194)
  1. ;
  1. N RA791,RASTR
  1. S RA791(0)=$G(^RA(79.1,Y,0)),RA791("DIV")=$G(^RA(79.1,Y,"DIV"))
  1. S RA791(19)=$S($P(RA791(0),"^",19)]"":"*",1:"") ;no future D/T allowed
  1. S RA791(6)=$$GET1^DIQ(79.2,+$P(RA791(0),"^",6),.01)
  1. S RA791(25)=$$GET1^DIQ(4,+$P(RA791("DIV"),"^"),99)
  1. S RASTR="("_RA791(19)_RA791(6)_"-"_RA791(25)_")"
  1. Q RASTR
  1. ;
  1. DELDESC(RAIEN) ; This sub-routine will determine if descendents can be
  1. ; deleted from parent procedures. If only one descendent exists, and
  1. ; the parent is on the common procedure list do not allow the deletion
  1. ; of the descendent.
  1. ; Input : RAIEN (the DA array for the Rad/Nuc Med Procedure file.)
  1. ; Output: 0 if ok to delete, 1 if not ok to delete
  1. ; Called from: ^DD(71.05,.01,"DEL",1,0) node
  1. N I,RA713,RATTL S (I,RA713,RATTL)=0
  1. S:$D(^RAMIS(71.3,"B",RAIEN(1))) RA713=+$O(^RAMIS(71.3,"B",RAIEN(1),0))
  1. S:RA713>0 RA713(0)=$G(^RAMIS(71.3,RA713,0))
  1. F S I=$O(^RAMIS(71,RAIEN(1),4,I)) Q:I'>0 S RATTL=RATTL+1
  1. I RA713,($P(RA713(0),"^",5)=""),(RATTL=1) D Q 1
  1. . ; don't allow deletion of the last descendent on procedures that are
  1. . ; currently active in the common procedure file.
  1. . N RATXT S RATXT(1)=" "
  1. . S RATXT(2)="You cannot delete the last or only descendent from a"
  1. . S RATXT(3)="parent procedure when the parent procedure is an active"
  1. . S RATXT(4)="common procedure.",RATXT(5)=$C(7) D EN^DDIOL(.RATXT)
  1. . Q
  1. Q 0 ; common procedure with more than one descendent, ok to delete
  1. ;
  1. REACMMN(RADA) ; Check to see if a commom procedure can be re-activated.
  1. ; This sub-routine checks if this common is a parent w/o descendents.
  1. ; If true, this common procedure cannot be re-activated.
  1. ; Input : RADA - ien of the entry in 71.3
  1. ; Output: 0 if ok to delete, 1 if not ok to delete
  1. ; Called from ^DD(71.3,4,"DEL",1,0)
  1. N RA713 S RA713=$G(^RAMIS(71.3,RADA,0))
  1. I $P($G(^RAMIS(71,+RA713,0)),"^",6)="P",('$O(^RAMIS(71,+RA713,4,0))) D Q 1
  1. . N RATXT S RATXT(1)=" "
  1. . S RATXT(2)="You cannot re-activate a common parent procedure without descendents."
  1. . S RATXT(3)=$C(7) D EN^DDIOL(.RATXT)
  1. . Q
  1. Q 0 ; ok to delete
  1. ;
  1. X7005(RADFN,RADTI,RACNI,RAMDV,RAQED,RASTI,RAWHO) ;update the EXAM
  1. ; STATUS TIMES (70.05) multiple. Called from RASTED (will be
  1. ; called from RAUTL1 in the future)
  1. ;
  1. ; input variables:
  1. ; ----------------
  1. ; RADFN=patient dfn, RADTI=exam date/time (inverse)
  1. ; RACNI=exam record ien (70.03), RAMDV=division parameters
  1. ; RAQED=task queued(1=yes;0=no), RASTI=exam status
  1. ; RAWHO=editing person
  1. ;
  1. N %,D,D0,DA,DIC,DIE,DQ,DR,RAFDA,RAIEN,RAIENS,X,Y
  1. S RAQED=+$G(RAQED) ; if tasked 1, else 0
  1. S RAIENS="+1,"_RACNI_","_RADTI_","_RADFN_","
  1. S RAFDA(70.05,RAIENS,.01)=$$MIDNGHT^RAUTL5($$NOW^XLFDT())
  1. D UPDATE^DIE(,"RAFDA","RAIEN") ; RAIEN(1)=ien of new record
  1. K RAFDA,RAIENS Q:'$D(RAIEN(1)) ; record not added
  1. I $P(RAMDV,"^",11),('RAQED) D
  1. .S DIE="^RADPT("_RADFN_",""DT"","_RADTI_",""P"","_RACNI_",""T"","
  1. .S DA=RAIEN(1),DR=".01" D ^DIE
  1. S RAIENS=RAIEN(1)_","_RACNI_","_RADTI_","_RADFN_","
  1. S RAFDA(70.05,RAIENS,2)=RASTI
  1. S RAFDA(70.05,RAIENS,3)=$G(RAWHO)
  1. D FILE^DIE(,"RAFDA")
  1. Q
  1. A7007(RADFN,RADTI,RACNI,RAWHO,RATC) ; update the ACTIVITY LOG (70.07)
  1. ; multiple. Called from RASTED (will be called from RAUTL1 in the
  1. ; future)
  1. ;
  1. ; input variables:
  1. ; ----------------
  1. ; RADFN=patient dfn, RADTI=exam date/time (inverse)
  1. ; RACNI=exam record ien (70.03), RAWHO=editing person
  1. ; RATC=technologist comments (optional)
  1. ;
  1. N %,D,D0,DA,DIC,DIE,DQ,DR,RAFDA,RAIEN,RAIENS,RATOA,X,Y
  1. S RATOA=$S($D(RAOPT("STATRACK")):"S",1:"U") ;p154 Reflect option used
  1. S RAIENS="+1,"_RACNI_","_RADTI_","_RADFN_","
  1. S RAFDA(70.07,RAIENS,.01)="NOW"
  1. D UPDATE^DIE("E","RAFDA","RAIEN") ;RAIEN(1)=ien of new record
  1. K RAFDA,RAIENS Q:'$D(RAIEN(1)) ; record not added
  1. S RAIENS=RAIEN(1)_","_RACNI_","_RADTI_","_RADFN_","
  1. S RAFDA(70.07,RAIENS,2)=RATOA
  1. S RAFDA(70.07,RAIENS,3)=$G(RAWHO)
  1. S:$G(RATC)]"" RAFDA(70.07,RAIENS,4)=RATC
  1. D FILE^DIE(,"RAFDA")
  1. Q
  1. ;
  1. ;updates EXAM STATUS
  1. U70033(RA18DFN,RA18DTI,RA18CNI,RA18ST) ;
  1. N %,D,D0,DA,DIC,DIE,DQ,DR,RA18FDA,RA18IENS,X,Y
  1. S RA18IENS=RA18CNI_","_RA18DTI_","_RA18DFN_","
  1. S RA18FDA(70.03,RA18IENS,3)=RA18ST
  1. D FILE^DIE(,"RA18FDA")
  1. Q
  1. ;