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

RAUTL10.m

Go to the documentation of this file.
  1. RAUTL10 ;HISC/CAH,FPT,GJC-Utility Routine ;7/23/97 11:05
  1. ;;5.0;Radiology/Nuclear Medicine;**28**;Mar 16, 1998
  1. ;
  1. UPDLOC ;Update Pt Loc Info, file 74.4
  1. ;RAY3= 0 node of 74.4, RAB= IEN of 74.3, RARDIFN= IEN of 74.4
  1. N RAY I '$D(^RARPT(RARPT,0)) Q
  1. I $P(^RARPT(RARPT,0),U,11) S RAPRTOK=1 Q
  1. 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"
  1. I '$P(RAY3,U,6),'$P(RAY3,U,8),RAB=$$DQ("FILE ROOM") S RAPRTOK=1 G SET
  1. I $P(RAY3,U,6),$P(RAY3,U,6)=RAI S RAPRTOK=1 G SET
  1. I $P(RAY3,U,8),'RAI S RAPRTOK=1 G SET
  1. 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
  1. 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
  1. 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
  1. SET I $D(RAPRTF),$D(RAPRTOK) S $P(^RARPT(RARPT,0),U,11)=DT
  1. K RAI,RAI1 Q
  1. ;
  1. UP2(RAX) ;update file - 74.4
  1. ;INPUT: RAX (required)
  1. ; If RAX=0, inpt to outpt/RAX=1, ward transfer/RAX=2, outpt to inpt
  1. ;OUTPUT: If being called from RARTST2 and patient has been discharged,
  1. ; the variable RARTST2I will be defined and will contain the IEN of
  1. ; the altered File Room record in file 74.4.
  1. N RABI,RABTCH,RADQ,DA,DIE,DR,DC S (RADQ("FROM"),RADQ("TO"))=0
  1. S:RAX=0 RADQ("FROM")=$$DQ("WARD REPORTS"),RADQ("TO")=$$DQ("FILE ROOM")
  1. S:RAX=2 RADQ("FROM")=$$DQ("CLINIC REPORTS"),RADQ("TO")=$$DQ("WARD REPORTS")
  1. 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
  1. 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
  1. .;If file room entry in file 74.4 was deleted, and this is a discharged
  1. .;patient (i.e. RAX=0), and UPDLOC is being called from RARTST2 (i.e.
  1. .;RARTST2 is defined), set RARTST2I to IEN of remaining 74.4 entry that
  1. .;will be edited below to point to File Room.
  1. .;This fix was added so RARTST2 can properly update 'Date Printed' on
  1. .;the 74.4 entry for File Room for discharged patients. Otherwise,
  1. .;File Room entries would print twice before being removed from queue.
  1. . 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)
  1. 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
  1. S DR=$S(+RADQ("TO")&($P(RADQ("FROM"),U,2)):"11////^S X=+RADQ(""TO"")",1:"")
  1. 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
  1. S DA=0 F S DA=$O(^RABTCH(74.4,"B",RARPT,DA)) Q:'DA D LOCK,^DIE L -^RABTCH(74.4,DA,0)
  1. K DA,DIE,DR,DE,DQ Q
  1. DQ(X) ;distr queue
  1. ;INPUT: queue name
  1. ;OUTPUT: IEN in distr queue (74.3) or 0
  1. S X=+$O(^RABTCH(74.3,"B",X,0))
  1. Q $S('X:0,+$G(^RABTCH(74.3,X,"I")):0,1:X)
  1. LOCK L +^RABTCH(74.4,DA,0):2 I '$T G LOCK
  1. Q
  1. STR70(RA0,RA1,RA2,RA3) ;
  1. S RA0=""
  1. Q:'$O(^RADPT(RA1,"DT",RA2,"P",RA3,"M","B",0))
  1. M RA0=^RADPT(RA1,"DT",RA2,"P",RA3,"M","B")
  1. D STR(.RA0)
  1. Q
  1. STR751(RA0,RAOIFN) ;
  1. S RA0=""
  1. Q:'$O(^RAO(75.1,RAOIFN,"M","B",0))
  1. M RA0=^RAO(75.1,RAOIFN,"M","B")
  1. D STR(.RA0)
  1. Q
  1. STR(RA0) ;
  1. N I S I=""
  1. F S I=$O(RA0(I)) Q:'I S RA0=RA0_I_","
  1. Q