[613] | 1 | VAFCPTAD ;ISA/RJS,Zoltan - ADD NEW PATIENT FROM QUERY ;APR 6, 1999
|
---|
| 2 | ;;5.3;Registration;**149**;Aug 13, 1993
|
---|
| 3 | ADD(ARRAY) ;-- Adds new patient to local data base
|
---|
| 4 | ; Input Format:
|
---|
| 5 | ; ARRAY(FIELD NUMBER)=FIELD VALUE.
|
---|
| 6 | ; Example:
|
---|
| 7 | ; ARRAY(.01)=Patient Name
|
---|
| 8 | ;
|
---|
| 9 | ; Return Values:
|
---|
| 10 | ; On Failure: -1^message (indicates failure condition.)
|
---|
| 11 | ; On Success: DFN of new patient record.
|
---|
| 12 | N DFN,LOCKFLE,FLD,ZTQUEUED,DIQUIET,RETURN,X,Y
|
---|
| 13 | S (ZTQUEUED,DIQUIET)=1
|
---|
| 14 | S DIC="^DPT(",DIC(0)="L",DLAYGO=2
|
---|
| 15 | S X=$G(@ARRAY@(.01))
|
---|
| 16 | K DD,D0 D FILE^DICN K DIC,DLAYGO
|
---|
| 17 | I $P(Y,U,3)'=1 S RETURN="-1^COULD NOT ADD PATIENT TO PATIENT FILE" G EXIT
|
---|
| 18 | ;-- Add rest of required data
|
---|
| 19 | S (DFN,RETURN)=+Y
|
---|
| 20 | L +^DPT(DFN):60
|
---|
| 21 | ;
|
---|
| 22 | I ('$T) S RETURN="-1^COULD NOT LOCK RECORD TO ADD PATIENT TO PATIENT FILE" G EXIT
|
---|
| 23 | ;
|
---|
| 24 | ;--Data needs to be loaded in a certain sequence
|
---|
| 25 | ;
|
---|
| 26 | S DA=DFN,DIE=2
|
---|
| 27 | ;
|
---|
| 28 | K DR
|
---|
| 29 | S DR=".09////"_$G(@ARRAY@(.09))
|
---|
| 30 | D ^DIE
|
---|
| 31 | ;
|
---|
| 32 | K DR
|
---|
| 33 | S FLD=.03 D EDIT^VAFCPTED(DFN,ARRAY,FLD)
|
---|
| 34 | ;
|
---|
| 35 | W !
|
---|
| 36 | W !,"NAME: "_$G(@ARRAY@(.01))
|
---|
| 37 | W !,"SOCIAL SECURITY NUMBER: "_$G(@ARRAY@(.09))
|
---|
| 38 | W !,"DATE OF BIRTH: "_$G(@ARRAY@(.03))
|
---|
| 39 | W !
|
---|
| 40 | S DR=".02;391;1901;.301"
|
---|
| 41 | D ^DIE
|
---|
| 42 | ;
|
---|
| 43 | ;update 991.01,991.02,991.03
|
---|
| 44 | N ERR
|
---|
| 45 | S ERR=$$UPDATE^MPIFAPI(DFN,ARRAY)
|
---|
| 46 | ;
|
---|
| 47 | L -^DPT(DFN)
|
---|
| 48 | EXIT ;
|
---|
| 49 | K DIE,DA,DR
|
---|
| 50 | Q RETURN
|
---|