| 1 | SROWL ;B'HAM ISC/MAM - ENTER PATIENT ON WAITING LIST ; 4/18/07 11:55am | 
|---|
| 2 | ;;3.0;Surgery;**58,119,162**;24 Jun 93;Build 4 | 
|---|
| 3 | ; | 
|---|
| 4 | ENTER ; enter a patient on the waiting list | 
|---|
| 5 | S SRSOUT=0 W @IOF K DIC S DIC(0)="QEAMZL",(DIC,DLAYGO)=133.8,DIC("A")="  Select Surgical Specialty: " D ^DIC K DIC,DLAYGO G:Y<0 END S SRSS=+Y,SRSS1=+Y(0) | 
|---|
| 6 | S SRSSNM=$P(^SRO(137.45,SRSS1,0),"^") | 
|---|
| 7 | PAT W ! S DIC=2,DIC(0)="QEAMZ",DIC("A")="  Select Patient: " D ^DIC K DIC I Y<0 W !!,"No action taken." G END | 
|---|
| 8 | S DFN=+Y,SRNM=$P(Y(0),"^") I $D(^DPT(DFN,.35)),$P(^(.35),"^")'="" S Y=$E($P(^(.35),"^"),1,7) D D^DIQ W !!,"The records show that "_SRNM_" died on "_Y_".",! G PAT | 
|---|
| 9 | I $O(^SRO(133.8,"AP",DFN,SRSS,0)) D CHK G:"Yy"'[ECYN END | 
|---|
| 10 | OP W ! K DIR S DIR("A")="  Select Operative Procedure",DIR(0)="133.801,1" D ^DIR I $D(DTOUT)!$D(DUOUT) W !!,"No action taken." G END | 
|---|
| 11 | S SROPER=Y | 
|---|
| 12 | W ! D NOW^%DTC S SRSDT=% | 
|---|
| 13 | K DD,DO,DIC,DR,DA S DIC(0)="L",DIC="^SRO(133.8,SRSS,1,",DA(1)=SRSS,X=DFN D FILE^DICN I +Y S SROFN=+Y | 
|---|
| 14 | K DA,DIE,DR S DA=SRSS,DIE=133.8,DR="1///"_SRNM,DR(2,133.801)="1////"_SROPER_";2///"_SRSDT_";4T;W !;5T;6T;W !;3T",DR(3,133.8013)=".01T;1T;2T;3T;4T;5T" D ^DIE K DIE,DR | 
|---|
| 15 | D WL^SROPCE1 I SRSOUT G DEL | 
|---|
| 16 | W @IOF,!,SRNM_" has been entered on the waiting list",!,"for "_SRSSNM | 
|---|
| 17 | END D PRESS,^SRSKILL W @IOF | 
|---|
| 18 | Q | 
|---|
| 19 | PRESS W ! K DIR S DIR("A")="Press RETURN to continue  ",DIR(0)="FOA" D ^DIR K DIR | 
|---|
| 20 | Q | 
|---|
| 21 | DEL S DA(1)=SRSS,DA=SROFN,DIK="^SRO(133.8,"_DA(1)_",1," D ^DIK | 
|---|
| 22 | W @IOF,!,"Classification information is incomplete.  No action taken." G END | 
|---|
| 23 | Q | 
|---|
| 24 | HELP W !!,"Enter RETURN if you want to continue entering a new procedure on the waiting",!,"list for "_SRNM_".  If the procedure you are about to enter appears",!,"above, enter 'NO' to quit this option." | 
|---|
| 25 | W !!,"Press RETURN to continue  " R X:DTIME | 
|---|
| 26 | Q | 
|---|
| 27 | CHK ; check for existing entries for a patient | 
|---|
| 28 | W @IOF,!,"Procedure(s) already entered for "_SRNM,!,"on the Waiting List for "_SRSSNM,! | 
|---|
| 29 | S SROFN=0 F  S SROFN=$O(^SRO(133.8,"AP",DFN,SRSS,SROFN)) Q:'SROFN  D LIST | 
|---|
| 30 | W !!,"Do you wish to continue entering a new procedure for "_SRNM_" on",!,"the waiting list for "_SRSSNM_" ?  YES// " R ECYN:DTIME I '$T!(ECYN["^") S ECYN="N" Q | 
|---|
| 31 | S ECYN=$E(ECYN) S:"y"[ECYN ECYN="Y" | 
|---|
| 32 | I "YNn"'[ECYN D HELP G CHK | 
|---|
| 33 | Q | 
|---|
| 34 | LIST ; list existing procedures for specialty selected | 
|---|
| 35 | S SROPER=$P(^SRO(133.8,SRSS,1,SROFN,0),"^",2),SRDT=$P(^(0),"^",3),SROPDT=$P(^(0),"^",5),Y=SRDT D D^DIQ S SRDT=$E(Y,1,12) I SROPDT S Y=SROPDT D D^DIQ S SROPDT=$E(Y,1,12) | 
|---|
| 36 | K SROP,MM,MMM S:$L(SROPER)<36 SROP(1)=SROPER I $L(SROPER)>35 S SROPER=SROPER_"  " S SROPER=SROPER_"  " F M=1:1 D LOOP Q:MMM="" | 
|---|
| 37 | W !,SRNM,?40,"Date Entered on List:",?66,SRDT,!,?3,SROP(1),?40,"Tentative Operation Date: ",?66,SROPDT | 
|---|
| 38 | I $D(SROP(2)) W !,?3,SROP(2) | 
|---|
| 39 | W ! | 
|---|
| 40 | Q | 
|---|
| 41 | LOOP ; break procedure if greater than 36 characters | 
|---|
| 42 | S SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM=""  Q:$L(SROP(M))+$L(MM)'<36  S SROP(M)=SROP(M)_MM_" ",SROPER=MMM | 
|---|
| 43 | Q | 
|---|
| 44 | REFPHY   ; Look up Referring Physician in "New Person" file with filter and auto-populate Referring Physician demographic fields | 
|---|
| 45 | N SRCONT,Y,SRDEMO | 
|---|
| 46 | S SRCONT="" | 
|---|
| 47 | PRMPT R !,"Is this a VA Physician from this facility?  (Y/N): <Y> ",SRCONT:DTIME I '$T Q | 
|---|
| 48 | I SRCONT["?" D  G PRMPT | 
|---|
| 49 | .W !!,"Enter 'Y' if you would like to select the Referring Physician from this facility's VA personnel.",!,"Enter 'N' to continue data entry.",! | 
|---|
| 50 | S:SRCONT="" SRCONT="Y" | 
|---|
| 51 | I SRCONT="^" S X="" Q | 
|---|
| 52 | Q:(SRCONT'["Y")&(SRCONT'["y") | 
|---|
| 53 | ; Store FileMan variables and arrays | 
|---|
| 54 | M SRDABAK=DA,SRDICBAK=DIC,SRDZERO=D0,SRDRBAK=DR,SRXBAK=X,SRDOBAK=DO | 
|---|
| 55 | ; Setup variables and call ^DIC to lookup REFERRING PHYSICIAN from NEW PERSON file | 
|---|
| 56 | S DIC="^VA(200,",DIC(0)="E",DIC("B")=X | 
|---|
| 57 | D ^DIC | 
|---|
| 58 | ; Restore FileMan's variables and arrays | 
|---|
| 59 | M DA=SRDABAK,DIC=SRDICBAK,D0=SRDZERO,DR=SRDRBAK,X=SRXBAK,DO=SRDOBAK | 
|---|
| 60 | K SRCONT,SRDABAK,SRDICBAK,SRDZERO,SRDRBAK,SRXBAK,SRDOBAK | 
|---|
| 61 | Q:Y="-1"        ; Quit if no record was selected from the NEW PERSON file | 
|---|
| 62 | S SRNPREC=$P(Y,U,1)_","   ;The record number of the NEW PERSON file | 
|---|
| 63 | ; Retrieve demographic data from the NEW PERSON file. | 
|---|
| 64 | D GETS^DIQ(200,SRNPREC,".01:.116;.132","","SRDEMO") | 
|---|
| 65 | ; Build SRDEMO array for "stuffing" into REFERRING PHYSICIAN demographic fields | 
|---|
| 66 | S X=SRDEMO(200,SRNPREC,".01")                       ;Name | 
|---|
| 67 | S SRDEMO(1)=SRDEMO(200,SRNPREC,".111")        ;Address | 
|---|
| 68 | S:$L(SRDEMO(200,SRNPREC,".112"))>0 SRDEMO(1)=SRDEMO(1)_" "_SRDEMO(200,SRNPREC,".112")   ;Concatenate Address 2 to single address | 
|---|
| 69 | S:$L(SRDEMO(200,SRNPREC,".113"))>0 SRDEMO(1)=SRDEMO(1)_" "_SRDEMO(200,SRNPREC,".113")   ;Concatenate Address 3 to single address | 
|---|
| 70 | S SRDEMO(1)=$E(SRDEMO(1),1,75) | 
|---|
| 71 | S SRDEMO(2)=SRDEMO(200,SRNPREC,".114")        ;City | 
|---|
| 72 | S SRDEMO(3)=SRDEMO(200,SRNPREC,".115")        ;State | 
|---|
| 73 | S SRDEMO(4)=SRDEMO(200,SRNPREC,".116")        ;Zip | 
|---|
| 74 | S SRDEMO(5)=SRDEMO(200,SRNPREC,".132")        ;Office Phone | 
|---|
| 75 | ; Set up DR array that FileMan will use, with a call to ^DIE, after this subroutine Quits to "stuff" the demographic data. | 
|---|
| 76 | ; all fields except STATE will ignore input transform (SR*3.0*162) | 
|---|
| 77 | S DIC("DR")="1////"_SRDEMO(1)_";2////"_SRDEMO(2)_";3///"_SRDEMO(3)_";4////"_SRDEMO(4)_";5////"_SRDEMO(5)_";6////"_$P(Y,U,1) | 
|---|
| 78 | S DIC(0)="Z"    ;Tells FileMan to file the data without any more user input | 
|---|
| 79 | Q | 
|---|