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

RA45PST1.m

Go to the documentation of this file.
  1. RA45PST1 ;Hines OI/GJC - Post-init 'A', patch 45 ;10/10/03 06:32
  1. VERSION ;;5.0;Radiology/Nuclear Medicine;**45**;Mar 16, 1998
  1. ;
  1. ENQ1 ;Need to convert the data in the old 'BARIUM USED?' (#5) field in
  1. ;the 70.03 data dictionary to the CONTRAST MEDIA (#225) multiple
  1. ;70.3225. If 'Yes' to 'BARIUM USED?' then 'Barium' will be added
  1. ;as a record to the new CONTRAST MEDIA field. The 'BARIUM USED?'
  1. ;field will be deleted. This will be a background process queued
  1. ;to run by the RA*5*45 post-init.
  1. ;
  1. ;IAs used in this subroutine: 4381 ("RA" node file 101.43), 4382
  1. ;("S.XRAY" xref), & 1995 ($$cpt^icptcod)
  1. ;IA 10035 used to obtain patient name
  1. ;
  1. ;called from EN^RA45PST, queued...
  1. K ^TMP("RA*5*45 BARIUM USED",$J)
  1. S:$D(ZTQUEUED) ZTREQ="@" S (RACT,RADFN,ZTSTOP)=0
  1. F S RADFN=$O(^RADPT(RADFN)) Q:'RADFN D Q:ZTSTOP
  1. .S RADTI=0
  1. .F S RADTI=$O(^RADPT(RADFN,"DT",RADTI)) Q:'RADTI D Q:ZTSTOP
  1. ..S RACNI=0
  1. ..F S RACNI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI)) Q:'RACNI D Q:ZTSTOP
  1. ...S Y=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)),RACT=RACT+1
  1. ...S:RACT#500=0 ZTSTOP=$$S^%ZTLOAD() Q:ZTSTOP
  1. ...;------------------------------------------------------------------
  1. ...;Indicate that barium was used by updating the new CONTRAST MEDIA
  1. ...;field (multiple, sub-file 70.3225)
  1. ...I $E($$UP^XLFSTR($P(Y,"^",5)))="Y" D
  1. ....;------- update fields: CONTRAST MEDIA USED & BARIUM USED? -------
  1. ....L +^RADPT(RADFN,"DT",RADTI,"P",RACNI,0):30 ;lock xam record
  1. ....I '$T D TRACK Q ;track the record that could not be updated
  1. ....S RAD3=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"CM",$C(32)),-1)+1
  1. ....S RAIEN="+"_RAD3_","_RACNI_","_RADTI_","_RADFN_","
  1. ....S RAFDA(70.3225,RAIEN,.01)="B" D UPDATE^DIE("","RAFDA","RAIEN")
  1. ....K RAD3,RAFDA,RAIEN
  1. ....S RAIEN=RACNI_","_RADTI_","_RADFN_","
  1. ....S RAFDA(70.03,RAIEN,5)="@" ;delete data in BARIUM USED?
  1. ....S RAFDA(70.03,RAIEN,10)="Y" ;set CONTRAST MEDIA USED field to YES
  1. ....D FILE^DIE("","RAFDA") K RAFDA,RAIEN
  1. ....L -^RADPT(RADFN,"DT",RADTI,"P",RACNI,0) ;unlock; on to next record
  1. ....Q
  1. ...;------------------------------------------------------------------
  1. ...Q
  1. ..Q
  1. .Q
  1. ;
  1. ;delete the 'BARIUM USED?' data dictionary 70.03, field #5 only if
  1. ;the user did not stop the task
  1. I ZTSTOP=0 K DA,DIK S DIK="^DD(70.03,",DA(1)=70.03,DA=5 D ^DIK
  1. ;
  1. ;if the user stopped the task, note that event
  1. D:ZTSTOP=1 STOP
  1. ;
  1. ;if examination records failed to get updated, if the user terminated
  1. ;the post-init through TaskMan, or if both conditions are true inform
  1. ;the user via email
  1. D:+$O(^TMP("RA*5*45 BARIUM USED",$J,0)) MAIL
  1. ;
  1. KILLQ1 ;Kill and clean up symbol table
  1. K %,DA,DIC,DIK,RACNI,RADFN,RADTI,RAIEN,X,Y
  1. K ^TMP("RA*5*45 BARIUM USED",$J)
  1. Q
  1. ;
  1. MAIL ;generate the email message informing the user of the following events:
  1. ;A) some examination records were not properly updated
  1. ;B) the process was stopped by the user via TaskMan
  1. ;C) both events A & B are true
  1. S ^TMP("RA*5*45 BARIUM USED",$J,.1)="The following patient(s) failed to have their exam records (70.03) updated"
  1. S ^TMP("RA*5*45 BARIUM USED",$J,.2)="accordingly because another user was editing the same record."
  1. S ^TMP("RA*5*45 BARIUM USED",$J,.3)=""
  1. S ^TMP("RA*5*45 BARIUM USED",$J,.4)="Format: patient name ^ exam date/time ^ case # ^ procedure name (truncated to"
  1. S ^TMP("RA*5*45 BARIUM USED",$J,.5)="forty characters)"
  1. S ^TMP("RA*5*45 BARIUM USED",$J,.6)=""
  1. N XMDUZ,XMSUB,XMTEXT,XMY S XMDUZ=.5
  1. S XMTEXT="^TMP(""RA*5*45 BARIUM USED"",$J,"
  1. S XMSUB="RA*5*45: 'Barium Used?' post-init issue detected"
  1. I '$$GOTLOCAL^XMXAPIG("G.RAD PERFORMANCE INDICATOR") D
  1. .S XMY(DUZ)=""
  1. E S XMY("G.RAD PERFORMANCE INDICATOR")=""
  1. D ^XMD
  1. Q
  1. ;
  1. STOP ;inform the user that the task has been stopped
  1. S ^TMP("RA*5*45 BARIUM USED",$J,$$SUB())="RA*5*45's 'BARIUM USED?' data dictionary cleanup terminated prematurely"
  1. Q
  1. ;
  1. TRACK ;track the record that could not be locked for updating
  1. ;by patient name, date/time of exam, case number, & procedure
  1. ;Note: RADFN, RADTI, & RACNI are global in scope.
  1. ;
  1. ;format: pat. name^exam date/time^case #^procedure name (trunc'd to 40)
  1. ;
  1. N RAEXAM S RAEXAM=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0))
  1. S ^TMP("RA*5*45 BARIUM USED",$J,$$SUB())=$$GET1^DIQ(2,RADFN,.01)_U_$$FMTE^XLFDT((9999999.9999-RADTI),"1P")_U_$P(RAEXAM,U)_U_$E($$GET1^DIQ(71,+$P(RAEXAM,U,2),.01),1,40)
  1. Q
  1. ;
  1. SUB() ;return the next available subscript (arithmetic progression)
  1. Q +$O(^TMP("RA*5*45 BARIUM USED",$J,$C(32)),-1)+1
  1. ;