| 1 | SPNPATUL ;HIRMFO/WAA - Patinet Select utility ;3/27/98  08:35
 | 
|---|
| 2 |  ;;2.0;Spinal Cord Dysfunction;**4,5**;01/02/1997
 | 
|---|
| 3 | PAT(DFN) ;Select a patient
 | 
|---|
| 4 |  S SPNLEXIT=+$G(SPNLEXIT)
 | 
|---|
| 5 |  Q:SPNLEXIT
 | 
|---|
| 6 |  N DIR,Y
 | 
|---|
| 7 |  ;Do a dir call on a free text data test for "all,ALL"
 | 
|---|
| 8 | SELECT K DIR,Y
 | 
|---|
| 9 |  S DIR(0)="FAO^2:35",DIR("A")="Select a patient: "
 | 
|---|
| 10 |  S DIR("?")="^D HELP^SPNPATUL"
 | 
|---|
| 11 |  D ^DIR
 | 
|---|
| 12 |  I Y="" Q
 | 
|---|
| 13 |  I $D(DIRUT) S SPNLEXIT=1 Q
 | 
|---|
| 14 |  S SPNSTR=Y
 | 
|---|
| 15 |  I $$UP^XLFSTR(SPNSTR)="ALL" D  Q:SPNLEXIT  Q:'DFN
 | 
|---|
| 16 |  .N DIR,Y
 | 
|---|
| 17 |  .S DIR(0)="YAO",DIR("A")="Do you mean ""ALL"" Patients? ",DIR("B")="YES"
 | 
|---|
| 18 |  .D ^DIR
 | 
|---|
| 19 |  .I $G(DIRUT) S SPNLEXIT=1 Q
 | 
|---|
| 20 |  .I Y D
 | 
|---|
| 21 |  ..W !,"All patients selected..." K DFN S DFN=0,DFN("ALL")="" Q
 | 
|---|
| 22 |  ..Q
 | 
|---|
| 23 |  .Q
 | 
|---|
| 24 |  I $E(SPNSTR,1)="-" D
 | 
|---|
| 25 |  .D DELETE
 | 
|---|
| 26 |  .Q
 | 
|---|
| 27 |  E  D
 | 
|---|
| 28 |  .D ADD
 | 
|---|
| 29 |  .Q
 | 
|---|
| 30 |  Q:SPNLEXIT
 | 
|---|
| 31 |  G SELECT
 | 
|---|
| 32 | HELP ;This will print out all the help for the user
 | 
|---|
| 33 |  N IEN S IEN=0
 | 
|---|
| 34 |  W !,"The following is a list of selected patients:"
 | 
|---|
| 35 |  I DFN<1 W !,"No patients have been selected yet."
 | 
|---|
| 36 |  E  F  S IEN=$O(DFN(IEN)) Q:IEN<1  D
 | 
|---|
| 37 |  .W !,$$GET^DDSVAL(2,IEN,.01,"","E") ; Name
 | 
|---|
| 38 |  .W ?40,$$GET^DDSVAL(2,IEN,.09,"","E") ; SSN
 | 
|---|
| 39 |  .;**MOD,SD/AB,1/29/98, Changed DOB output to show 4-digit year
 | 
|---|
| 40 |  .W ?60,$$FMTE^XLFDT($$GET^DDSVAL(2,IEN,.03,"","I"),"1D") ; DOB
 | 
|---|
| 41 |  .Q
 | 
|---|
| 42 |  W !,"Enter the patient name or SSN to add a patient to the list."
 | 
|---|
| 43 |  W !,"Enter a minus ""-"" before a patient name to remove him from the list."
 | 
|---|
| 44 |  W !,"Enter ""ALL"" to select all patients and have the system use filters."
 | 
|---|
| 45 |  Q
 | 
|---|
| 46 | ADD ;Put a patient in the select list
 | 
|---|
| 47 |  N Y
 | 
|---|
| 48 |  D LOOKUP(SPNSTR) Q:SPNLEXIT
 | 
|---|
| 49 |  Q:Y=-1
 | 
|---|
| 50 |  I $D(DFN(Y)) W !,"Patient is already in list." Q
 | 
|---|
| 51 |  S DFN=DFN+1
 | 
|---|
| 52 |  S DFN(+Y)=""
 | 
|---|
| 53 |  Q
 | 
|---|
| 54 | DELETE ;Remove a patient from the select list
 | 
|---|
| 55 |  N Y
 | 
|---|
| 56 |  D LOOKUP($E(SPNSTR,2,$L(SPNSTR))) Q:SPNLEXIT
 | 
|---|
| 57 |  Q:Y=-1
 | 
|---|
| 58 |  I '$D(DFN(+Y)) W !,"Patient is not in list." Q
 | 
|---|
| 59 |  S DFN=DFN-1
 | 
|---|
| 60 |  K DFN(+Y)
 | 
|---|
| 61 |  Q
 | 
|---|
| 62 | LOOKUP(SPNSTR) ;Look-up a patient
 | 
|---|
| 63 |  S DIC=2,X=SPNSTR,DIC(0)="QEZ" D ^DIC
 | 
|---|
| 64 |  I $D(DTOUT)!($D(DUOUT)) S SPNLEXIT=1
 | 
|---|
| 65 |  Q
 | 
|---|