source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RA45PST1.m@ 841

Last change on this file since 841 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1RA45PST1 ;Hines OI/GJC - Post-init 'A', patch 45 ;10/10/03 06:32
2VERSION ;;5.0;Radiology/Nuclear Medicine;**45**;Mar 16, 1998
3 ;
4ENQ1 ;Need to convert the data in the old 'BARIUM USED?' (#5) field in
5 ;the 70.03 data dictionary to the CONTRAST MEDIA (#225) multiple
6 ;70.3225. If 'Yes' to 'BARIUM USED?' then 'Barium' will be added
7 ;as a record to the new CONTRAST MEDIA field. The 'BARIUM USED?'
8 ;field will be deleted. This will be a background process queued
9 ;to run by the RA*5*45 post-init.
10 ;
11 ;IAs used in this subroutine: 4381 ("RA" node file 101.43), 4382
12 ;("S.XRAY" xref), & 1995 ($$cpt^icptcod)
13 ;IA 10035 used to obtain patient name
14 ;
15 ;called from EN^RA45PST, queued...
16 K ^TMP("RA*5*45 BARIUM USED",$J)
17 S:$D(ZTQUEUED) ZTREQ="@" S (RACT,RADFN,ZTSTOP)=0
18 F S RADFN=$O(^RADPT(RADFN)) Q:'RADFN D Q:ZTSTOP
19 .S RADTI=0
20 .F S RADTI=$O(^RADPT(RADFN,"DT",RADTI)) Q:'RADTI D Q:ZTSTOP
21 ..S RACNI=0
22 ..F S RACNI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI)) Q:'RACNI D Q:ZTSTOP
23 ...S Y=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)),RACT=RACT+1
24 ...S:RACT#500=0 ZTSTOP=$$S^%ZTLOAD() Q:ZTSTOP
25 ...;------------------------------------------------------------------
26 ...;Indicate that barium was used by updating the new CONTRAST MEDIA
27 ...;field (multiple, sub-file 70.3225)
28 ...I $E($$UP^XLFSTR($P(Y,"^",5)))="Y" D
29 ....;------- update fields: CONTRAST MEDIA USED & BARIUM USED? -------
30 ....L +^RADPT(RADFN,"DT",RADTI,"P",RACNI,0):30 ;lock xam record
31 ....I '$T D TRACK Q ;track the record that could not be updated
32 ....S RAD3=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"CM",$C(32)),-1)+1
33 ....S RAIEN="+"_RAD3_","_RACNI_","_RADTI_","_RADFN_","
34 ....S RAFDA(70.3225,RAIEN,.01)="B" D UPDATE^DIE("","RAFDA","RAIEN")
35 ....K RAD3,RAFDA,RAIEN
36 ....S RAIEN=RACNI_","_RADTI_","_RADFN_","
37 ....S RAFDA(70.03,RAIEN,5)="@" ;delete data in BARIUM USED?
38 ....S RAFDA(70.03,RAIEN,10)="Y" ;set CONTRAST MEDIA USED field to YES
39 ....D FILE^DIE("","RAFDA") K RAFDA,RAIEN
40 ....L -^RADPT(RADFN,"DT",RADTI,"P",RACNI,0) ;unlock; on to next record
41 ....Q
42 ...;------------------------------------------------------------------
43 ...Q
44 ..Q
45 .Q
46 ;
47 ;delete the 'BARIUM USED?' data dictionary 70.03, field #5 only if
48 ;the user did not stop the task
49 I ZTSTOP=0 K DA,DIK S DIK="^DD(70.03,",DA(1)=70.03,DA=5 D ^DIK
50 ;
51 ;if the user stopped the task, note that event
52 D:ZTSTOP=1 STOP
53 ;
54 ;if examination records failed to get updated, if the user terminated
55 ;the post-init through TaskMan, or if both conditions are true inform
56 ;the user via email
57 D:+$O(^TMP("RA*5*45 BARIUM USED",$J,0)) MAIL
58 ;
59KILLQ1 ;Kill and clean up symbol table
60 K %,DA,DIC,DIK,RACNI,RADFN,RADTI,RAIEN,X,Y
61 K ^TMP("RA*5*45 BARIUM USED",$J)
62 Q
63 ;
64MAIL ;generate the email message informing the user of the following events:
65 ;A) some examination records were not properly updated
66 ;B) the process was stopped by the user via TaskMan
67 ;C) both events A & B are true
68 S ^TMP("RA*5*45 BARIUM USED",$J,.1)="The following patient(s) failed to have their exam records (70.03) updated"
69 S ^TMP("RA*5*45 BARIUM USED",$J,.2)="accordingly because another user was editing the same record."
70 S ^TMP("RA*5*45 BARIUM USED",$J,.3)=""
71 S ^TMP("RA*5*45 BARIUM USED",$J,.4)="Format: patient name ^ exam date/time ^ case # ^ procedure name (truncated to"
72 S ^TMP("RA*5*45 BARIUM USED",$J,.5)="forty characters)"
73 S ^TMP("RA*5*45 BARIUM USED",$J,.6)=""
74 N XMDUZ,XMSUB,XMTEXT,XMY S XMDUZ=.5
75 S XMTEXT="^TMP(""RA*5*45 BARIUM USED"",$J,"
76 S XMSUB="RA*5*45: 'Barium Used?' post-init issue detected"
77 I '$$GOTLOCAL^XMXAPIG("G.RAD PERFORMANCE INDICATOR") D
78 .S XMY(DUZ)=""
79 E S XMY("G.RAD PERFORMANCE INDICATOR")=""
80 D ^XMD
81 Q
82 ;
83STOP ;inform the user that the task has been stopped
84 S ^TMP("RA*5*45 BARIUM USED",$J,$$SUB())="RA*5*45's 'BARIUM USED?' data dictionary cleanup terminated prematurely"
85 Q
86 ;
87TRACK ;track the record that could not be locked for updating
88 ;by patient name, date/time of exam, case number, & procedure
89 ;Note: RADFN, RADTI, & RACNI are global in scope.
90 ;
91 ;format: pat. name^exam date/time^case #^procedure name (trunc'd to 40)
92 ;
93 N RAEXAM S RAEXAM=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0))
94 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)
95 Q
96 ;
97SUB() ;return the next available subscript (arithmetic progression)
98 Q +$O(^TMP("RA*5*45 BARIUM USED",$J,$C(32)),-1)+1
99 ;
Note: See TracBrowser for help on using the repository browser.