| 1 | RACMPLE ;HISC-GJC/Compile Rad/Nuc Med input/print templates ;10/20/97  14:46 | 
|---|
| 2 | ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998 | 
|---|
| 3 | N D1,DIR,DIROUT,DIRUT,DMAX,DTOUT,DUOUT,RA1,RA2,RAFLENAM,RAFLENUM,RADMAX | 
|---|
| 4 | N RAMAX,RAMIN,RANODE,RAROOT,RAXIT,X,Y,Z D:'$D(IOF) HOME^%ZIS W @IOF | 
|---|
| 5 | K ^TMP($J,"RA INPUT TEMP"),^TMP($J,"RA PRINT TEMP") | 
|---|
| 6 | W !?5,"This option will compile all Radiology/Nuclear Medicine input" | 
|---|
| 7 | W !?5,"and print templates (within the defined file number range) which" | 
|---|
| 8 | W !?5,"are currently compiled on your system.  Since these templates" | 
|---|
| 9 | W !?5,"are critical to the operation of the software, it is strongly" | 
|---|
| 10 | W !?5,"advised that all Radiology/Nuclear Medicine users be off the" | 
|---|
| 11 | W !?5,"system.  It is also strongly advised that the compilation of" | 
|---|
| 12 | W !?5,"templates be done when system activity is at a minimum.",! | 
|---|
| 13 | S DIR(0)="YA",DIR("A")="Is it ok to continue? ",DIR("B")="No" | 
|---|
| 14 | S DIR("?",1)="Enter 'Yes' to continue the compilation process, or 'No'" | 
|---|
| 15 | S DIR("?")="to abort the compilation process." | 
|---|
| 16 | D ^DIR Q:'+Y  K DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y W ! | 
|---|
| 17 | S RAMAX=+$$ROUSIZE^DILF,RAMIN=2400,RAXIT=0 | 
|---|
| 18 | S RAMAX=$S(RAMAX>RAMIN:RAMAX,1:5000) | 
|---|
| 19 | S DIR(0)="NA^"_RAMIN_":"_RAMAX_":0",DIR("B")=RAMAX | 
|---|
| 20 | S DIR("A")="Maximum routine size on this computer in bytes.  " | 
|---|
| 21 | S DIR("A")=DIR("A")_"(2400-"_RAMAX_") : " | 
|---|
| 22 | S DIR("?",1)="This number will be used to determine the size of the" | 
|---|
| 23 | S DIR("?",2)="compiled template routines.  The size must be a number" | 
|---|
| 24 | S DIR("?",3)="greater than "_RAMIN_" the larger the better, up to the" | 
|---|
| 25 | S DIR("?")="maximum routine size for your operating system." D ^DIR | 
|---|
| 26 | Q:$D(DIRUT)  S RADMAX=+Y W !! | 
|---|
| 27 | S RAMAX=79.99,RAMIN=70 ; File range for the Rad/Nuc Med package | 
|---|
| 28 | F RAROOT="^DIE(","^DIPT(" D  Q:RAXIT | 
|---|
| 29 | . S RADIC=RAROOT,RADIC(0)="QEAZ" | 
|---|
| 30 | . S RADIC("A")="Select Rad/Nuc Med"_$S(RAROOT="^DIE(":" Input",1:" Print") | 
|---|
| 31 | . S RADIC("A")=RADIC("A")_" Template: " | 
|---|
| 32 | . S RADIC("S")="N RA S RA(0)=$G(^(0)),RA(""ROU"")=$G(^(""ROU"")) " | 
|---|
| 33 | . S RADIC("S")=RADIC("S")_"I $E($P(RA(0),""^""),1,2)=""RA""," | 
|---|
| 34 | . S RADIC("S")=RADIC("S")_"($P(RA(0),""^"",4)'<RAMIN)," | 
|---|
| 35 | . S RADIC("S")=RADIC("S")_"($P(RA(0),""^"",4)'>RAMAX),(RA(""ROU"")]"""")" | 
|---|
| 36 | . S RADIC("W")="W ""   File #: ""_$P($G(^(0)),""^"",4)" | 
|---|
| 37 | . S RAUTIL=$S(RAROOT="^DIE(":"RA INPUT TEMP",1:"RA PRINT TEMP") | 
|---|
| 38 | . W @IOF D EN1^RASELCT(.RADIC,RAUTIL,"",1) | 
|---|
| 39 | . I '$D(^TMP($J,RAUTIL)),(RAROOT="^DIE(") D | 
|---|
| 40 | .. S DIR(0)="YA",DIR("A",1)="You have not selected any Input Templates." | 
|---|
| 41 | .. S DIR("A")="Do you wish to continue with Print Templates? " | 
|---|
| 42 | .. S DIR("B")="No",DIR("?")="Enter 'Yes' to continue, 'No' to exit." | 
|---|
| 43 | .. W ! D ^DIR | 
|---|
| 44 | .. S:'+Y RAXIT=1 K DIR,DIROUT,DIRUT,DTOUT,DUOUT | 
|---|
| 45 | .. Q | 
|---|
| 46 | . K %,%W,%Y1,DIC,RADIC,RAQUIT,RAUTIL,X,Y | 
|---|
| 47 | . Q | 
|---|
| 48 | I '$D(^TMP($J,"RA INPUT TEMP")),('$D(^TMP($J,"RA PRINT TEMP"))) D  Q | 
|---|
| 49 | . W !!?5,"You have not selected any template(s) to be compiled.",$C(7) | 
|---|
| 50 | . Q | 
|---|
| 51 | Q:'$$ASKCMPL() | 
|---|
| 52 | F RAROOT="^TMP($J,""RA INPUT TEMP""","^TMP($J,""RA PRINT TEMP""" D | 
|---|
| 53 | . S RA1="" F  S RA1=$O(@(RAROOT_","""_RA1_""")")) Q:RA1']""  D | 
|---|
| 54 | .. S RA2=0 F  S RA2=$O(@(RAROOT_","""_RA1_""","_RA2_")")) Q:RA2'>0  D | 
|---|
| 55 | ... S RANODE("ROU")=$$GET1^DIQ($S(RAROOT["INPUT":.402,1:.4),RA2_",",1815,"") | 
|---|
| 56 | ... S DMAX=RADMAX | 
|---|
| 57 | ... S RAFLENUM=$$GET1^DIQ($S(RAROOT["INPUT":.402,1:.4),RA2_",",4,"I") | 
|---|
| 58 | ... S RAFLENAM=$$GET1^DIQ($S(RAROOT["INPUT":.402,1:.4),RA2_",",4,"") | 
|---|
| 59 | ... S Y=RA2,X=$P(RANODE("ROU"),"^",2) Q:X']"" | 
|---|
| 60 | ... W !!?3,$S(RAROOT["INPUT":"Input",1:"Print")_" template to be" | 
|---|
| 61 | ... W " compiled: "_RA1 | 
|---|
| 62 | ... W !?3,"For file #"_RAFLENUM_": ",RAFLENAM | 
|---|
| 63 | ... W !?3,"Routines filed under the following namespace: '",X_"'." | 
|---|
| 64 | ... D @$S(RAROOT["INPUT":"EN^DIEZ",1:"EN^DIPZ") W !?3,"Done!" | 
|---|
| 65 | ... Q | 
|---|
| 66 | .. Q | 
|---|
| 67 | . Q | 
|---|
| 68 | K ^TMP($J,"RA INPUT TEMP"),^TMP($J,"RA PRINT TEMP") | 
|---|
| 69 | Q | 
|---|
| 70 | ASKCMPL() ; Ask the user if they wish to compile the selected templates. | 
|---|
| 71 | N X,Y S DIR(0)="YA" | 
|---|
| 72 | S DIR("A")="Are you sure you wish to compile the selected templates? " | 
|---|
| 73 | S DIR("B")="No",DIR("?")="Enter 'Yes' to compile, 'No' to exit." | 
|---|
| 74 | W ! D ^DIR K DIR,DIROUT,DIRUT,DTOUT,DUOUT | 
|---|
| 75 | Q Y ; (Y=1 for yes, Y=0 for no) | 
|---|