| 1 | RASYS1 ;HISC/CAH - Utility to update I-Loc Type to Clinic ;10/30/96  10:00
 | 
|---|
| 2 |  ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
 | 
|---|
| 3 | EN1(RA791) ;For each imaging loc, get file 44 pointer, DSS ID, Div
 | 
|---|
| 4 |  ;and give to MAS to set/reset params on the file 44 entry
 | 
|---|
| 5 |  ; Input: -> ien of entry in the 'Imaging Locations' file (79.1)
 | 
|---|
| 6 |  N RA44,RA44NM,RA44NM2,RADSS,RADSSNM,RADIV,RAERRCNT,RA44NEW,RATRY
 | 
|---|
| 7 |  S RAERRCNT=0,RA44NM2=""
 | 
|---|
| 8 |  S RA791(0)=$G(^RA(79.1,+RA791,0))
 | 
|---|
| 9 |  S RA44=$P(RA791(0),"^",1) I '$D(^SC(+RA44,0)) D ERR44 Q:RAXIT
 | 
|---|
| 10 |  S RA44NM=$P($G(^SC(+RA44,0)),"^",1)
 | 
|---|
| 11 |  S RADSS=$P(RA791(0),"^",22) I 'RADSS D ERRDSS Q:RAXIT
 | 
|---|
| 12 |  S RADSSNM=$P($G(^DIC(40.7,+RADSS,0)),"^",2)
 | 
|---|
| 13 |  S RADIV=$G(^RA(79.1,+RA791,"DIV")) I 'RADIV D ERRDIV Q:RAXIT
 | 
|---|
| 14 |  I RAERRCNT Q  ;If this Img Loc has an error, stop here
 | 
|---|
| 15 |  ;Call MAS Sched'g routine with img loc data
 | 
|---|
| 16 |  S RA44NEW=$$RAD^SCDXUAPI(RA44,"RA") ;returns ien of same or new loc
 | 
|---|
| 17 |  I +RA44NEW=-1 D ERRMSG(RA44NEW) Q  ; explain why $$RAD call failed
 | 
|---|
| 18 |  I RA44NEW'=RA44 D REPOINT
 | 
|---|
| 19 |  S RATRY=$$LOC^SCDXUAPI($S($L(RA44NM2):RA44NM2,1:RA44NM),RADIV,RADSSNM,"RA",RA44)
 | 
|---|
| 20 |  I +RATRY=-1 D ERRMSG(RATRY)
 | 
|---|
| 21 |  I +RATRY'=-1 D OK
 | 
|---|
| 22 |  Q
 | 
|---|
| 23 | ERR44 ;bad file 44 pointer
 | 
|---|
| 24 |  S RAERRCNT=RAERRCNT+1
 | 
|---|
| 25 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 26 |  W !,"Imaging Location file #79.1 internal entry #"_RA44
 | 
|---|
| 27 |  W !,"is a broken pointer to Hospital Location file #44."
 | 
|---|
| 28 |  W !,"IRM must resolve this problem, then the Rad/Nuc Med ADPAC"
 | 
|---|
| 29 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 30 |  W !,"should use the Location Parameter Set-up [RA SYSLOC] option"
 | 
|---|
| 31 |  W !,"to edit this Imaging Location, and the Division Parameter"
 | 
|---|
| 32 |  W !,"Set-up [RA SYSDIV] option to assign it to a division.",!," "
 | 
|---|
| 33 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 34 |  Q
 | 
|---|
| 35 | ERRDSS ;bad file 40.7 pointer (DSS ID/Stop Code)
 | 
|---|
| 36 |  S RAERRCNT=RAERRCNT+1
 | 
|---|
| 37 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 38 |  W !,"Imaging Location file #79.1 entry "_$S($L(RA44NM):RA44NM,1:RA44)_" has a missing"
 | 
|---|
| 39 |  W !,"or invalid DSS ID.  The Radiology/Nuclear Medicine ADPAC should"
 | 
|---|
| 40 |  W !,"use the Location Parameter Set-up [RA SYSLOC] option to enter"
 | 
|---|
| 41 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 42 |  W !,"a valid imaging DSS Code for this imaging location.",!," "
 | 
|---|
| 43 |  Q
 | 
|---|
| 44 | ERRDIV ;bad or non-existent Division on active imaging loc
 | 
|---|
| 45 |  S RAERRCNT=RAERRCNT+1
 | 
|---|
| 46 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 47 |  W !,"Imaging Location file #79.1 entry "_$S($L(RA44NM):RA44NM,1:RA44)_" is not assigned"
 | 
|---|
| 48 |  W !,"to a Rad/Nuc Med Division. If Imaging exams are to be registered"
 | 
|---|
| 49 |  W !,"in this imaging location, or if there are incomplete exams"
 | 
|---|
| 50 |  W !,"already registered to this location, the Radiology/Nuclear"
 | 
|---|
| 51 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 52 |  W !,"Med ADPAC should use the Division Parameter Set-up [RA SYSDIV]"
 | 
|---|
| 53 |  W !,"option to assign this imaging location to the appropriate"
 | 
|---|
| 54 |  W !,"Rad/Nuc Med Division.",!," "
 | 
|---|
| 55 |  I $Y>(IOSL-4) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 56 |  Q
 | 
|---|
| 57 | ERRMSG(RAX) ; Explain why the $$RAD call failed.
 | 
|---|
| 58 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 59 |  W !,"Scheduling routine could not reset Hospital Location"
 | 
|---|
| 60 |  W !,"file #44 params for Imaging Location "_$S($L(RA44NM2):RA44NM2,1:RA44NM)
 | 
|---|
| 61 |  W !,"to agree with params on the Imaging Location file #79.1."
 | 
|---|
| 62 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 63 |  W !,"IRM should investigate the cause of this Scheduling error message:"
 | 
|---|
| 64 |  W !," * "_$P(RAX,"^",3)_" * ",!," "
 | 
|---|
| 65 |  Q
 | 
|---|
| 66 | REPOINT ;current img loc points to a file 44 entry with appt patterns
 | 
|---|
| 67 |  ;must be repointed to the loc Sched'g returned to us
 | 
|---|
| 68 |  ;
 | 
|---|
| 69 |  ;call DIE or Silent FM to change .01 fld of file 79.1 to RA44NEW
 | 
|---|
| 70 |  ;use equivalent of /// stuff, and give a message about old imaging
 | 
|---|
| 71 |  ;loc name changing to new name
 | 
|---|
| 72 |  ;
 | 
|---|
| 73 |  N RAERR,RAFDA
 | 
|---|
| 74 |  S RA44=RA44NEW,RA44NM2=$P($G(^SC(+RA44NEW,0)),"^",1)
 | 
|---|
| 75 |  S RAFDA(79.1,RA791_",",.01)=RA44NEW
 | 
|---|
| 76 |  D FILE^DIE("K","RAFDA","RAERR")
 | 
|---|
| 77 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 78 |  W !,"Imaging Location "_RA44NM_" has appointment patterns, and"
 | 
|---|
| 79 |  W !,"cannot be 'pointed to' from a file 79.1 Imaging Location."
 | 
|---|
| 80 |  W !,"Imaging Location "_RA44NM_" has been 're-pointed' to"
 | 
|---|
| 81 |  I $Y>(IOSL-6) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 82 |  W !,"Hospital Location "_RA44NM2_".",!," "
 | 
|---|
| 83 |  Q
 | 
|---|
| 84 | OK ;this img loc was processed ok
 | 
|---|
| 85 |  I $Y>(IOSL-4) S RAXIT=$$EOS^RAUTL5() Q:RAXIT  W @IOF
 | 
|---|
| 86 |  W !,"Imaging Location "_$S($L(RA44NM2):RA44NM2,1:RA44NM)_" is OK.",!," "
 | 
|---|
| 87 |  Q
 | 
|---|