| 1 | SCUTIE2 ;ALB/SCK - IEMM LIST MANAGER UTILITIES; 16-JUN-97 | 
|---|
| 2 | ;;5.3;Scheduling;**66**;AUG 13, 1993 | 
|---|
| 3 | ; | 
|---|
| 4 | Q | 
|---|
| 5 | ENTRY(SDYX) ;   Get entry for incomplete encounter lookup.  Mimics the selection process in | 
|---|
| 6 | ;  Appointment Management, but allows for the additional selection of an error code from | 
|---|
| 7 | ;  the Transmitted OP ENC Error Code file. | 
|---|
| 8 | ; | 
|---|
| 9 | ;    Input: | 
|---|
| 10 | ;        SDYX - Pointer to return variable for the IEN of the selected Patient, Clinic, or Error code | 
|---|
| 11 | ; | 
|---|
| 12 | ;    Sets SDENTYP as follows: | 
|---|
| 13 | ;          P  -   Patient Selection | 
|---|
| 14 | ;          C  -   Clinic Selection | 
|---|
| 15 | ;          E  -   Error Code Selection | 
|---|
| 16 | ; | 
|---|
| 17 | S DIR(0)="FA",DIR("A")="Select Patient name, Clinic name, or Error Code: " | 
|---|
| 18 | S DIR("?")="Enter as P.patient name, C.clinic name, or E.error name" | 
|---|
| 19 | S DIR("??")="^D HELP^SCUTIE2" | 
|---|
| 20 | D ^DIR K DIR I $D(DIRUT) S VALMQUIT="" G ENQ | 
|---|
| 21 | ; | 
|---|
| 22 | I $E(Y,1,2)="P."!($E(Y,1,2)="p.") D  G ENQ | 
|---|
| 23 | . S SDYX=$$LOOKUP($P(Y,".",2),2) | 
|---|
| 24 | . S SDENTYP="P" | 
|---|
| 25 | ; | 
|---|
| 26 | I $E(Y,1,2)="C."!($E(Y,1,2)="c.") D  G ENQ | 
|---|
| 27 | . S SDYX=$$LOOKUP($P(Y,".",2),44) | 
|---|
| 28 | . S SDENTYP="C" | 
|---|
| 29 | ; | 
|---|
| 30 | I $E(Y,1,2)="E."!($E(Y,1,2)="e.") D  G ENQ | 
|---|
| 31 | . S SDYX=$$LOOKUP($P(Y,".",2),409.76) | 
|---|
| 32 | . S SDENTYP="E" | 
|---|
| 33 | ; | 
|---|
| 34 | S SDYX=$$MULTLKUP(Y) | 
|---|
| 35 | ENQ Q $G(SDYX)>0 | 
|---|
| 36 | ; | 
|---|
| 37 | LOOKUP(X,SCG) ;  Look up IEN for the specified file | 
|---|
| 38 | ; | 
|---|
| 39 | ;    Input: | 
|---|
| 40 | ;        X     - Lookup value for the DIC call | 
|---|
| 41 | ;      SCG     - The file to do the lookup on | 
|---|
| 42 | ; | 
|---|
| 43 | ;    Returns  Y = the IEN of the selected entry | 
|---|
| 44 | ; | 
|---|
| 45 | S DIC=SCG,DIC(0)="EMQ" | 
|---|
| 46 | D ^DIC | 
|---|
| 47 | Q $G(Y) | 
|---|
| 48 | ; | 
|---|
| 49 | MULTLKUP(SD1) ;  Lookup entry for unspecified selection file.  Try searching the patient | 
|---|
| 50 | ;  file, hospital location file, and the transmitted OP ENC error code file for | 
|---|
| 51 | ;  a possible match. | 
|---|
| 52 | ; | 
|---|
| 53 | ;   Input: | 
|---|
| 54 | ;          SD1  -  Lookup value | 
|---|
| 55 | ; | 
|---|
| 56 | ;   Returns Y = The IEN of the selected entry | 
|---|
| 57 | ; | 
|---|
| 58 | N Y,X,SCVAL,DUOUT,DTOUT | 
|---|
| 59 | ; | 
|---|
| 60 | S SD1=$$UPPER^VALM1(SD1) | 
|---|
| 61 | ;  First pass, try patient file for match | 
|---|
| 62 | W !!,"Searching for patient ",SD1 | 
|---|
| 63 | K DIC S DIC=2,DIC(0)="EM",X=SD1 | 
|---|
| 64 | D ^DIC K DIC | 
|---|
| 65 | I +Y>0 S SCVAL=$$OK | 
|---|
| 66 | E  S SCVAL=0 | 
|---|
| 67 | I $G(SCVAL)<0 Q -1 | 
|---|
| 68 | I $G(SCVAL)'=0 S SDENTYP="P" G MLTQ | 
|---|
| 69 | ; | 
|---|
| 70 | ; Second pass, try hospital location file for match | 
|---|
| 71 | W !!,"Searching for Clinic ",SD1 | 
|---|
| 72 | K DIC S DIC=44,DIC(0)="EM",X=SD1 | 
|---|
| 73 | D ^DIC K DIC | 
|---|
| 74 | I +Y>0 S SCVAL=$$OK | 
|---|
| 75 | E  S SCVAL=0 | 
|---|
| 76 | I SCVAL<0 Q -1 | 
|---|
| 77 | I SCVAL'=0 S SDENTYP="C" G MLTQ | 
|---|
| 78 | ; | 
|---|
| 79 | ; Final pass, try error file for match | 
|---|
| 80 | W !!,"Searching for Error Code ",SD1 | 
|---|
| 81 | K DIC S DIC=409.76,DIC(0)="EM",X=SD1 | 
|---|
| 82 | D ^DIC K DIC | 
|---|
| 83 | I +Y>0 S SCVAL=$$OK | 
|---|
| 84 | E  S SCVAL=0 | 
|---|
| 85 | I SCVAL<0 Q -1 | 
|---|
| 86 | I SCVAL'=0 S SDENTYP="E" G MLTQ | 
|---|
| 87 | MLTQ Q $G(Y) | 
|---|
| 88 | ; | 
|---|
| 89 | OK() ;  Ask user if displayed entry is ok for selection. | 
|---|
| 90 | ;  Return 1 if Ok, 0 if not | 
|---|
| 91 | N Y | 
|---|
| 92 | K DIRUT,DIR | 
|---|
| 93 | W ! | 
|---|
| 94 | S DIR(0)="SA^Y:Yes;N:No",DIR("A")="  ...OK? ",DIR("B")="Yes" | 
|---|
| 95 | S DIR("?")="Answer with Yes to accept, or No to ignore" | 
|---|
| 96 | D ^DIR K DIR | 
|---|
| 97 | Q $S($D(DIRUT):-1,1:Y="Y") | 
|---|
| 98 | ; | 
|---|
| 99 | HELP ; | 
|---|
| 100 | ; | 
|---|
| 101 | W !?2,"Enter P.patient name to select a specific patient," | 
|---|
| 102 | W !?2,"C.clinic name to select a specific clinic, or E.Error Name" | 
|---|
| 103 | W !?2,"to select a specific error.",! | 
|---|
| 104 | W !?2,"If selecting a specific error by its description it may be" | 
|---|
| 105 | W !?2,"necessary to enter more than three characters(Ex. E.Abxxxx)." | 
|---|
| 106 | W !?2,"Because this is a descriptive field, case sensitivity applies.",! | 
|---|
| 107 | W !?2,"If just a name is entered, any matches will be displayed in" | 
|---|
| 108 | W !?2,"patient, clinic, error code order.  You will have the option" | 
|---|
| 109 | W !?2,"of selecting or ignoring the choice.",! | 
|---|
| 110 | Q | 
|---|