source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAUTL10.m@ 1240

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1RAUTL10 ;HISC/CAH,FPT,GJC-Utility Routine ;7/23/97 11:05
2 ;;5.0;Radiology/Nuclear Medicine;**28**;Mar 16, 1998
3 ;
4UPDLOC ;Update Pt Loc Info, file 74.4
5 ;RAY3= 0 node of 74.4, RAB= IEN of 74.3, RARDIFN= IEN of 74.4
6 N RAY I '$D(^RARPT(RARPT,0)) Q
7 I $P(^RARPT(RARPT,0),U,11) S RAPRTOK=1 Q
8 S RAI="",RAI1=$S($D(^DPT(RADFN,.1)):^(.1),1:0) S:RAI1="" RAI1=0 S RAI=$O(^DIC(42,"B",RAI1,0)) S:'$D(RABTY) RABTY="ALL"
9 I '$P(RAY3,U,6),'$P(RAY3,U,8),RAB=$$DQ("FILE ROOM") S RAPRTOK=1 G SET
10 I $P(RAY3,U,6),$P(RAY3,U,6)=RAI S RAPRTOK=1 G SET
11 I $P(RAY3,U,8),'RAI S RAPRTOK=1 G SET
12 I $P(RAY3,U,6),'RAI S $P(RAY3,U,6)="" S RAY=$$DQ("FILE ROOM") D:'$D(RAFL) UP2(0) S:'RAY RAPRTOK=1 S:RAY=RAB&((RAI1=RABTY)!(RABTY="ALL")) RAPRTOK=1 G SET
13 I $P(RAY3,U,6),$P(RAY3,U,6)'=RAI S $P(RAY3,U,6)=RAI D:'$D(RAFL) UP2(1) S:RAI1=RABTY!(RABTY="ALL") RAPRTOK=1 G SET
14 I $P(RAY3,U,8),RAI S $P(RAY3,U,8)="",$P(RAY3,U,6)=RAI S RAY=$$DQ("WARD REPORTS") D:'$D(RAFL) UP2(2) S:RAY=RAB!('RAY) RAPRTOK=1
15SET I $D(RAPRTF),$D(RAPRTOK) S $P(^RARPT(RARPT,0),U,11)=DT
16 K RAI,RAI1 Q
17 ;
18UP2(RAX) ;update file - 74.4
19 ;INPUT: RAX (required)
20 ; If RAX=0, inpt to outpt/RAX=1, ward transfer/RAX=2, outpt to inpt
21 ;OUTPUT: If being called from RARTST2 and patient has been discharged,
22 ; the variable RARTST2I will be defined and will contain the IEN of
23 ; the altered File Room record in file 74.4.
24 N RABI,RABTCH,RADQ,DA,DIE,DR,DC S (RADQ("FROM"),RADQ("TO"))=0
25 S:RAX=0 RADQ("FROM")=$$DQ("WARD REPORTS"),RADQ("TO")=$$DQ("FILE ROOM")
26 S:RAX=2 RADQ("FROM")=$$DQ("CLINIC REPORTS"),RADQ("TO")=$$DQ("WARD REPORTS")
27 I RAX'=1 S RABI=0 F S RABI=$O(^RABTCH(74.4,"B",RARPT,RABI)) Q:'RABI S RABTCH=+$P($G(^RABTCH(74.4,RABI,0)),U,11) S:RABTCH=RADQ("FROM") $P(RADQ("FROM"),U,2)=RABI S:RABTCH=RADQ("TO") $P(RADQ("TO"),U,2)=RABI
28 I RAX=0,$P(RADQ("FROM"),U,2),$P(RADQ("TO"),U,2) S DIK="^RABTCH(74.4,",DA=$P(RADQ("TO"),U,2) D ^DIK K DIK I $D(RARTST2) D
29 .;If file room entry in file 74.4 was deleted, and this is a discharged
30 .;patient (i.e. RAX=0), and UPDLOC is being called from RARTST2 (i.e.
31 .;RARTST2 is defined), set RARTST2I to IEN of remaining 74.4 entry that
32 .;will be edited below to point to File Room.
33 .;This fix was added so RARTST2 can properly update 'Date Printed' on
34 .;the 74.4 entry for File Room for discharged patients. Otherwise,
35 .;File Room entries would print twice before being removed from queue.
36 . I $$DQ("FILE ROOM")=$P(RADQ("TO"),U,1),'$D(^RABTCH(74.4,+$P(RADQ("TO"),U,2),0)) S RARTST2I=+$P(RADQ("FROM"),U,2)
37 I RAX=2,'+RADQ("TO"),$P(RADQ("FROM"),U,2) S DIK="^RABTCH(74.4,",DA=$P(RADQ("FROM"),U,2) D ^DIK K DIK
38 S DR=$S(+RADQ("TO")&($P(RADQ("FROM"),U,2)):"11////^S X=+RADQ(""TO"")",1:"")
39 S DIE="^RABTCH(74.4,",DR="I RAX>0 S Y=""@1"";6///@;S Y=""@2"";@1;6////^S X=RAI;@2;S:RAX=0 Y=""@3"" S:RAX=1 Y="""";8///@;@3;S:DA'=$P($G(RADQ(""FROM"")),U,2) Y="""";"_DR
40 S DA=0 F S DA=$O(^RABTCH(74.4,"B",RARPT,DA)) Q:'DA D LOCK,^DIE L -^RABTCH(74.4,DA,0)
41 K DA,DIE,DR,DE,DQ Q
42DQ(X) ;distr queue
43 ;INPUT: queue name
44 ;OUTPUT: IEN in distr queue (74.3) or 0
45 S X=+$O(^RABTCH(74.3,"B",X,0))
46 Q $S('X:0,+$G(^RABTCH(74.3,X,"I")):0,1:X)
47LOCK L +^RABTCH(74.4,DA,0):2 I '$T G LOCK
48 Q
49STR70(RA0,RA1,RA2,RA3) ;
50 S RA0=""
51 Q:'$O(^RADPT(RA1,"DT",RA2,"P",RA3,"M","B",0))
52 M RA0=^RADPT(RA1,"DT",RA2,"P",RA3,"M","B")
53 D STR(.RA0)
54 Q
55STR751(RA0,RAOIFN) ;
56 S RA0=""
57 Q:'$O(^RAO(75.1,RAOIFN,"M","B",0))
58 M RA0=^RAO(75.1,RAOIFN,"M","B")
59 D STR(.RA0)
60 Q
61STR(RA0) ;
62 N I S I=""
63 F S I=$O(RA0(I)) Q:'I S RA0=RA0_I_","
64 Q
Note: See TracBrowser for help on using the repository browser.