| 1 | IBDFU91 ;ALB/CJM - ENCOUNTER FORM - transforms needed to validate,display and pass data;AUG 18,1995 | 
|---|
| 2 | ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997 | 
|---|
| 3 | ; | 
|---|
| 4 | OUTPUT(PI,Y) ;xecutes the output transform of the package interface on Y | 
|---|
| 5 | ;Y should be passed by reference | 
|---|
| 6 | ;the underlying output transform should set Y="" if the transform can not be made | 
|---|
| 7 | ;in that case Y is set to "?" | 
|---|
| 8 | ; | 
|---|
| 9 | I $G(PI),$D(Y) X $G(^IBE(357.6,PI,14)) I Y="" S Y="?" | 
|---|
| 10 | Q | 
|---|
| 11 | ; | 
|---|
| 12 | INPUT(PI,X) ;xecutes the input transform of the package interface on X | 
|---|
| 13 | ;X should be passed by reference | 
|---|
| 14 | ;the underlying input transform: | 
|---|
| 15 | ;       can be interactive if $G(IBDEVICE("LISTMAN")) | 
|---|
| 16 | ;       should set X to the form needed for passing to the database | 
|---|
| 17 | ;       X should be killed if it can not be put into the correct form | 
|---|
| 18 | ;       does not guarantee validity - for example, X could be an inactive code | 
|---|
| 19 | ; | 
|---|
| 20 | I $G(PI),$D(X) X $G(^IBE(357.6,PI,9)) | 
|---|
| 21 | Q | 
|---|
| 22 | ; | 
|---|
| 23 | CHOICE(PI,X) ;executes the selector of the package interface=PI, user input is X | 
|---|
| 24 | ; -- X should be passed by reference. | 
|---|
| 25 | ; -- sets IBLABEL,IBID,IBQUAL | 
|---|
| 26 | ; | 
|---|
| 27 | N DIC,DIE,%,%W,%Y,C,DIPGM,DISYS,I,Q,D,D0,DO,DI,DQ,D1,%X,%Y,Y,DIX,DICR | 
|---|
| 28 | ;execute the selector | 
|---|
| 29 | I $G(PI) X $G(^IBE(357.6,PI,17)) | 
|---|
| 30 | Q | 
|---|
| 31 | ; | 
|---|
| 32 | FDCHOICE(PI,X) ;executes the selector of the package interface=PI,X=the user input, then runs it through the input transform for a value that can be passed to the PCE GDI | 
|---|
| 33 | ; -- X should be passed by reference. | 
|---|
| 34 | ; | 
|---|
| 35 | N DIC,DIE,%,%W,%Y,C,DIPGM,DISYS,I,Q,D,D0,DO,DI,DQ,D1,%X,%Y,Y,DIX,DICR,IBLABEL,IBQUAL,IBID | 
|---|
| 36 | I $G(PI) D | 
|---|
| 37 | .;execute the selector | 
|---|
| 38 | .X $G(^IBE(357.6,PI,17)) | 
|---|
| 39 | .;the selector actually returns the ID for the selection in the variabel IBID - X is the displayable value, which may be different | 
|---|
| 40 | .;I $G(IBID)="" K X Q | 
|---|
| 41 | .;pass the selection through the input transform | 
|---|
| 42 | .I $D(X),$G(IBID)'="" S X=IBID D INPUT(PI,.X) | 
|---|
| 43 | Q | 
|---|
| 44 | ; | 
|---|
| 45 | HPTRNS(TYPEDATA,X,IBFORMID) ;used to transform a value read from a hand print field (X) into a value that can be passed to the database | 
|---|
| 46 | ;TYPEDATA = data type (file 359.1) | 
|---|
| 47 | ;IBFORMID = id in form tracking,should be passed by reference | 
|---|
| 48 | ;  available form form tracking: | 
|---|
| 49 | ;  IBFORMID("DFN") | 
|---|
| 50 | ;  IBFORMID("APPT") | 
|---|
| 51 | ;  IBFORMID("CLINIC") | 
|---|
| 52 | ;  IBFORMID("SOURCE") | 
|---|
| 53 | ; | 
|---|
| 54 | ;X = the value that needs to be transformed | 
|---|
| 55 | ;returns the transformed value | 
|---|
| 56 | ;returns "" if it can not be put inot the correct form | 
|---|
| 57 | ; | 
|---|
| 58 | ;the underlying input transform: | 
|---|
| 59 | ;       should not be interactive | 
|---|
| 60 | ;       can use the IBFORMID array | 
|---|
| 61 | ;       should set X to the form needed for passing to the database | 
|---|
| 62 | ;       X should be killed if it can not be put into the correct form | 
|---|
| 63 | ;       does not guarantee validity - for example, X could be an inactive code | 
|---|
| 64 | ; | 
|---|
| 65 | I '$G(TYPEDATA)!'$D(X) S X="" Q X | 
|---|
| 66 | I '$D(^IBE(359.1,TYPEDATA,0)) S X="" Q | 
|---|
| 67 | X $G(^IBE(359.1,TYPEDATA,1)) | 
|---|
| 68 | S:'$D(X) X="" | 
|---|
| 69 | Q X | 
|---|
| 70 | ; | 
|---|
| 71 | VALIDATE(PI,X) ;used to validate the value stored with a selection(file 357.3) | 
|---|
| 72 | ;PI is assumed to be a selection type package interface | 
|---|
| 73 | ;kills X if not valid, but otherwise does not change it | 
|---|
| 74 | ;pass X by reference | 
|---|
| 75 | ;the underlying validation transform: | 
|---|
| 76 | ;    should not be interactive | 
|---|
| 77 | ;    should kill X if it is not valid | 
|---|
| 78 | ; | 
|---|
| 79 | I X="" K X Q | 
|---|
| 80 | I 'PI K X Q | 
|---|
| 81 | I '$D(^IBE(357.6,PI,0)) K X Q | 
|---|
| 82 | X $G(^IBE(357.6,PI,11)) | 
|---|
| 83 | Q | 
|---|
| 84 | ; | 
|---|
| 85 | HELP(PI) ;writes the help message for the package interface | 
|---|
| 86 | ; | 
|---|
| 87 | I PI W !,?6,$G(^IBE(357.6,PI,10)),! | 
|---|
| 88 | I PI D CHOICE(PI,"?") | 
|---|
| 89 | Q | 
|---|