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

RAIPST4.m

Go to the documentation of this file.
  1. RAIPST4 ;HIRMFO/GJC - Post-init number four ;12/18/97 09:08
  1. VERSION ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
  1. ;
  1. EN1 ; Add Exam Statuses with an Imaging Type of 'Mammography'.
  1. ; Exam Statuses created: Cancelled; Waiting For Exam; Called
  1. ; For Exam; Examined; Transcribed and Complete.
  1. N RAERR,RAFDA,RAITY,RATXT S RATXT(1)=" "
  1. S RAITY=+$O(^RA(79.2,"B","MAMMOGRAPHY",0))
  1. I RAITY=0 D Q ; mammography missing as an i-type
  1. . S RATXT(1)=" ",RATXT(2)="Error, 'MAMMOGRAPHY' missing from the Imaging Type (79.2) file.",RATXT(3)="IRM and the Radiology/Nuclear Medicine ADPAC should investigate."
  1. . D MES^XPDUTL(.RATXT)
  1. . Q
  1. S RATXT(1)=" "
  1. S RATXT(2)="Add Exam Statuses with an Imaging Type of 'Mammography'."
  1. S RATXT(3)="Exam Statuses created: Cancelled; Waiting For Exam; Called"
  1. S RATXT(4)="For Exam; Examined; Transcribed and Complete."
  1. D MES^XPDUTL(.RATXT) K RATXT
  1. ;-------------------- Exam Status: Cancelled --------------------------
  1. I '($D(^RA(72,"AA","MAMMOGRAPHY",0))\10) D ; Cancelled not filed.
  1. . S RAFDA(72,"+1,",.01)="CANCELLED",RAFDA(72,"+1,",3)=0
  1. . S RAFDA(72,"+1,",6)="y",RAFDA(72,"+1,",7)=RAITY
  1. . D UPDATE^DIE("","RAFDA","","RAERR")
  1. . I $D(RAERR("DIERR")) D ERMSG72("CANCELLED")
  1. . Q
  1. ;------------------ Exam Status: Waiting For Exam ---------------------
  1. I '($D(^RA(72,"AA","MAMMOGRAPHY",1))\10) D ; Waiting For Xam not filed.
  1. . K RAERR,RAFDA
  1. . S RAFDA(72,"+1,",.01)="WAITING FOR EXAM",RAFDA(72,"+1,",3)=1
  1. . S RAFDA(72,"+1,",5)="Y",RAFDA(72,"+1,",6)="y"
  1. . S RAFDA(72,"+1,",7)=RAITY
  1. . F RAI=.31,.32,.33,.34,.35,.36,.37,.38,.39,.311,.312,.313,.314,.315 S RAFDA(72,"+1,",RAI)="y"
  1. . D UPDATE^DIE("","RAFDA","","RAERR")
  1. . I $D(RAERR("DIERR")) D ERMSG72("WAITING FOR EXAM")
  1. . Q
  1. ;------------------ Exam Status: Called For Exam ----------------------
  1. I '$$XIST("CALLED FOR EXAM",RAITY) D ; Called For Exam not filed.
  1. . K RAERR,RAFDA
  1. . S RAFDA(72,"+1,",.01)="CALLED FOR EXAM",RAFDA(72,"+1,",6)="y"
  1. . S RAFDA(72,"+1,",7)=RAITY
  1. . F RAI=.11,.21 S RAFDA(72,"+1,",RAI)="Y"
  1. . F RAI=.31,.32,.33,.34,.35,.36,.37,.38,.39,.311,.312,.313,.314,.315 S RAFDA(72,"+1,",RAI)="y"
  1. . D UPDATE^DIE("","RAFDA","","RAERR")
  1. . I $D(RAERR("DIERR")) D ERMSG72("CALLED FOR EXAM")
  1. . Q
  1. ;------------------ Exam Status: Examined -----------------------------
  1. I '$$XIST("EXAMINED",RAITY) D ; Examined not filed.
  1. . K RAERR,RAFDA
  1. . S RAFDA(72,"+1,",.01)="EXAMINED",RAFDA(72,"+1,",7)=RAITY
  1. . F RAI=.11,.13,.14 S RAFDA(72,"+1,",RAI)="Y"
  1. . F RAI=.21,.23,.24,.26 S RAFDA(72,"+1,",RAI)="Y"
  1. . F RAI=.31,.32,.33,.34,.35,.36,.37,.38,.39,.311,.312,.313,.314,.315 S RAFDA(72,"+1,",RAI)="y"
  1. . D UPDATE^DIE("","RAFDA","","RAERR")
  1. . I $D(RAERR("DIERR")) D ERMSG72("EXAMINED")
  1. . Q
  1. ;------------------ Exam Status: Transcribed --------------------------
  1. I '$$XIST("TRANSCRIBED",RAITY) D ; Transcribed not filed.
  1. . K RAERR,RAFDA
  1. . S RAFDA(72,"+1,",.01)="TRANSCRIBED",RAFDA(72,"+1,",7)=RAITY
  1. . F RAI=.11,.12,.13,.14,.15,.16,.111 S RAFDA(72,"+1,",RAI)="Y"
  1. . F RAI=.22,.25 S RAFDA(72,"+1,",RAI)="Y"
  1. . F RAI=.31,.32,.33,.34,.35,.36,.37,.38,.39,.311,.312,.313,.314,.315 S RAFDA(72,"+1,",RAI)="y"
  1. . D UPDATE^DIE("","RAFDA","","RAERR")
  1. . I $D(RAERR("DIERR")) D ERMSG72("TRANSCRIBED")
  1. . Q
  1. ;------------------ Exam Status: Complete -----------------------------
  1. I '($D(^RA(72,"AA","MAMMOGRAPHY",9))\10) D ; Complete not filed.
  1. . K RAERR,RAFDA
  1. . S RAFDA(72,"+1,",.01)="COMPLETE"
  1. . S RAFDA(72,"+1,",3)=9,RAFDA(72,"+1,",7)=RAITY
  1. . F RAI=.11,.12,.13,.14,.15,.16 S RAFDA(72,"+1,",RAI)="Y"
  1. . F RAI=.111,.112,.116 S RAFDA(72,"+1,",RAI)="Y"
  1. . F RAI=.31,.32,.33,.34,.35,.36,.37,.38,.39,.311,.312,.313,.314 S RAFDA(72,"+1,",RAI)="y"
  1. . D UPDATE^DIE("","RAFDA","","RAERR")
  1. . I $D(RAERR("DIERR")) D ERMSG72("COMPLETE")
  1. . Q
  1. Q
  1. ;
  1. ERMSG72(X) ; Display error message when an Exam Status is not filed.
  1. N Y
  1. S Y(1)=" ",Y(2)="Error filing `"_X_"' in the Examination Status (72) file.",Y(3)="IRM and the Radiology/Nuclear Medicine ADPAC should investigate."
  1. D MES^XPDUTL(.Y)
  1. Q
  1. ;
  1. XIST(X,Y) ; Check if an Exam Status for a particular imaging type exists
  1. ; in file 72.
  1. ; Input: X-Exam Status, Y-imaging type (pointer)
  1. N I,XIT S (I,XIT)=0
  1. F S I=$O(^RA(72,"B",X,I)) Q:I'>0 D Q:XIT
  1. . S:$P($G(^RA(72,I,0)),"^",7)=Y XIT=1
  1. . Q
  1. Q XIT
  1. ;
  1. EN2 ; For the HL7 Application Parameter (file 771) 'Radiology',
  1. ; change the 'ORU' HL7 Message processing routine from RAHLO
  1. ; to the new bridge routine RAHLBKVR.
  1. N %,D,D0,DA,DI,DIC,DIE,DQ,DR,RA771,RA77106,RATXT,X
  1. S RA771=+$$FIND1^DIC(771,"","X","RADIOLOGY")
  1. I 'RA771 D Q ; Can't find 'Radiology' in file 771. Add to 771
  1. . S RATXT(1)=""
  1. . S RATXT(2)="Adding 'Radiology' to the HL7 Application Parameter file."
  1. . S RATXT(3)="Set the 'ORU' HL7 Message Processing Routine field to the"
  1. . S RATXT(4)="new bridge routine RAHLBKVR. Set the 'QRY' HL7 Message"
  1. . S RATXT(5)="Processing Routine field to the new bridge routine"
  1. . S RATXT(6)="RAHLBKVQ." D MES^XPDUTL(.RATXT)
  1. . N RA771,RAFDA S RAFDA(771,"+1,",.01)="RADIOLOGY"
  1. . S RAFDA(771,"+1,",2)="INACTIVE"
  1. . S RAFDA(771.06,"+2,+1,",.01)="ACK"
  1. . S RAFDA(771.06,"+3,+1,",.01)="ORF"
  1. . S RAFDA(771.06,"+4,+1,",.01)="ORU"
  1. . S RAFDA(771.06,"+4,+1,",1)="RAHLBKVR"
  1. . S RAFDA(771.06,"+5,+1,",.01)="QRY"
  1. . S RAFDA(771.06,"+5,+1,",1)="RAHLBKVQ"
  1. . D UPDATE^DIE("E","RAFDA")
  1. . S RA771=+$$FIND1^DIC(771,"","X","RADIOLOGY")
  1. . I RA771 D Q
  1. .. S ^HL(771,RA771,"EC")="~|\&" ; hard set the encoding char field
  1. .. S ^HL(771,RA771,"FS")="^" ; hard set the field seperator field
  1. .. Q
  1. . ; Display error message, 'RADIOLOGY' was not filed!
  1. . K RATXT S RATXT(1)=""
  1. . S RATXT(2)="'RADIOLOGY' could not be added as a HL7 Application"
  1. . S RATXT(3)="Parameter. IRM should investigate." D MES^XPDUTL(.RATXT)
  1. . Q
  1. ; The 'RADIOLOGY' entry exists, make sure the right fields are
  1. ; populated with the right data.
  1. S:$G(^HL(771,RA771,"EC"))'="~|\&" ^("EC")="~|\&" ; set encoding chars
  1. S:$G(^HL(771,RA771,"FS"))'="~|\&" ^("FS")="^" ; set field seperator
  1. S RA77106("ACK")=$$FIND("ACK")
  1. I 'RA77106("ACK") D ADD("ACK")
  1. I RA77106("ACK") D
  1. . N RAFDA
  1. . S RAFDA(771.06,RA77106("ACK")_","_RA771_",",1)="@" ;no processing rou
  1. . D FILE^DIE("","RAFDA","")
  1. . Q
  1. ;
  1. S RA77106("ORF")=$$FIND("ORF")
  1. I 'RA77106("ORF") D ADD("ORF")
  1. I RA77106("ORF") D
  1. . N RAFDA
  1. . S RAFDA(771.06,RA77106("ORF")_","_RA771_",",1)="@" ;no processing rou
  1. . D FILE^DIE("","RAFDA","")
  1. . Q
  1. S RA77106("ORU")=+$$FIND1^DIC(771.06,","_RA771_",","X","ORU")
  1. I 'RA77106("ORU") D ADD("ORU")
  1. I RA77106("ORU") D
  1. . N RAFDA S RAFDA(771.06,RA77106("ORU")_","_RA771_",",1)="RAHLBKVR"
  1. . D FILE^DIE("","RAFDA","")
  1. . Q
  1. S RA77106("QRY")=+$$FIND1^DIC(771.06,","_RA771_",","X","QRY")
  1. I 'RA77106("QRY") D ADD("QRY")
  1. I RA77106("QRY") D
  1. . N RAFDA S RAFDA(771.06,RA77106("QRY")_","_RA771_",",1)="RAHLBKVQ"
  1. . D FILE^DIE("","RAFDA","")
  1. . Q
  1. Q
  1. ADD(X) ; Add the HL7 Message to the 'RADIOLOGY' entry on the HL7 Application
  1. ; Parameter file.
  1. ; Input: 'X'-the HL7 Message we are trying to add
  1. ; Sets: RA77106('X')=the ien of the newly added HL7 Message
  1. N RAFDA S RAFDA(771.06,"+1,"_RA771_",",.01)=X
  1. D UPDATE^DIE("E","RAFDA") S RA77106(X)=$$FIND(X)
  1. Q
  1. FIND(X) ; Find the ien of the various HL7 Messages used by our HL7 Application
  1. ; Input: 'X'-the HL7 Message we are trying to find.
  1. ; Output: ien of the HL7 Message entry (if exists), else 0
  1. Q +$$FIND1^DIC(771.06,","_RA771_",","X",X)