| [613] | 1 | IBDFDEA ;ALB/AAS - AICS Data Entry API ; 19-JUN-96
 | 
|---|
 | 2 |  ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
 | 
|---|
 | 3 |  ;
 | 
|---|
 | 4 |  ;
 | 
|---|
 | 5 | EN1(PXCA,IBDF) ; -- Procedure
 | 
|---|
 | 6 |  ; -- supported reference to process encounter form data.
 | 
|---|
 | 7 |  ;    Packages that know patient, visit date/time, and clinic
 | 
|---|
 | 8 |  ;    can call this api to use the AICS data entry system to prompt
 | 
|---|
 | 9 |  ;    users for encounter data and subsequently store this data
 | 
|---|
 | 10 |  ;    using the PCE device interface (this is done automatically using
 | 
|---|
 | 11 |  ;    the aics parameters).
 | 
|---|
 | 12 |  ;    D EN1^IBDFDEA(.RESULTS,.IBDF)
 | 
|---|
 | 13 |  ;
 | 
|---|
 | 14 |  ; -- Input:  PXCA, called by reference, the results of processing
 | 
|---|
 | 15 |  ;            are returned in this array.  See PCE device inteface
 | 
|---|
 | 16 |  ;            manual for description of data nodes
 | 
|---|
 | 17 |  ;            IBDF, called by reference
 | 
|---|
 | 18 |  ;            IBDF("APPT")   :=  Appointment Date Time (required)
 | 
|---|
 | 19 |  ;            IBDF("DFN")    :=  pointer to patient file (required)
 | 
|---|
 | 20 |  ;            IBDF("CLINIC") :=  pointer to hospital location file (44)
 | 
|---|
 | 21 |  ;                               (optional) if clinic not defined and no
 | 
|---|
 | 22 |  ;                               form printed, no data entry allowed
 | 
|---|
 | 23 |  ;            IBDF("NOAPPT") :=  (optional) if AICS parameters allow 
 | 
|---|
 | 24 |  ;                               making follow up appointments, setting
 | 
|---|
 | 25 |  ;                               this to any non-zero value will suppress
 | 
|---|
 | 26 |  ;                               the ability to add followup appointments
 | 
|---|
 | 27 |  ;          IBDF("PROVIDER") :=  (optional) if defined, will be used as
 | 
|---|
 | 28 |  ;                               primary provider for data entry, use
 | 
|---|
 | 29 |  ;                               for provider data entry options
 | 
|---|
 | 30 |  ;
 | 
|---|
 | 31 |  N %,%H,C,I,J,X,Y,ADD,DEL,ASKOTHER,DIR,DIC,DA,CNT,DFN,DIRUT,DUOUT,DTOUT,POP,RTN,FRMDATA,IBY,IBQUIT,IBDOBJ,IBDPTSTI,IBDPTSTE,IBDPTNM,IBDPTDTI,SEL
 | 
|---|
 | 32 |  N IBDPTDTE,IBDFMNME,IBDFMIEN,IBDFMSTI,IBDFMSTE,IBDFMIDI,IBDCLNME,IBFORM,IBDCLNPH,IBDPID,IBDPTPRI,IBDSEL,IBDPI,IBDCO,SDCLST,PXCASTAT,PXKNODA,PXKNODB,IBDREDIT,IBDASK,IBDPRE,IBDOK
 | 
|---|
 | 33 |  N ANS1,AUPNDAYS,AUPNDOB,AUPNDOD,AUPNPAT,AUPNSEX,FORMLST
 | 
|---|
 | 34 |  ;
 | 
|---|
 | 35 |  I '$D(IOF) D HOME^%ZIS
 | 
|---|
 | 36 |  G:'$G(IBDF("DFN")) EN1Q S DFN=IBDF("DFN")
 | 
|---|
 | 37 |  G:'$G(IBDF("APPT")) EN1Q
 | 
|---|
 | 38 |  S IBQUIT=0
 | 
|---|
 | 39 |  ;
 | 
|---|
 | 40 |  ; -- if no form create entry
 | 
|---|
 | 41 |  S FORMLST=$$FINDID^IBDF18C(DFN,IBDF("APPT"),"",1)
 | 
|---|
 | 42 |  I FORMLST="",$G(IBDF("CLINIC")) D ANYWAY^IBDFDE6
 | 
|---|
 | 43 |  ;
 | 
|---|
 | 44 |  G:IBQUIT EN1Q
 | 
|---|
 | 45 |  ;
 | 
|---|
 | 46 |  I FORMLST F IBDX=1:1 S IBDF("FORM")=$P(FORMLST,"^",IBDX) Q:IBDF("FORM")=""  I IBDF("FORM")'="" D EN^IBDFDE K IBDSEL,IBDPI Q:IBQUIT
 | 
|---|
 | 47 |  ;
 | 
|---|
 | 48 | EN1Q Q
 | 
|---|
 | 49 |  ;
 | 
|---|
 | 50 | SCANFRM(X) ; is entry scannable
 | 
|---|
 | 51 |  Q +$P($G(^IBE(357,+$P($G(^IBD(357.95,+$P($G(^IBD(357.96,X,0)),"^",4),0)),"^",21),0)),"^",12)
 | 
|---|
 | 52 |  ;
 | 
|---|
 | 53 | DELFT ; -- Delete forms Tracking Entry
 | 
|---|
 | 54 |  N I,J,IBD,DIR,DIRUT,VALMY,IBDF,IBDNODE,DFN,APPT,IBX,CLN,IBQUIT,FORMID
 | 
|---|
 | 55 |  D EN^VALM2($G(XQORNOD(0)))
 | 
|---|
 | 56 |  I $D(VALMY) D FULL^VALM1 S IBD=0 F  S IBD=$O(VALMY(IBD)) Q:'IBD!$D(DIRUT)  D
 | 
|---|
 | 57 |  .S IBDF=$P($G(^TMP("FRMIDX",$J,+IBD)),"^",2)
 | 
|---|
 | 58 |  .S IBDNODE=$G(^IBD(357.96,+IBDF,0)) I IBDNODE="" W !,"No Form Tracking record associated with entry #",IBD H 2 Q
 | 
|---|
 | 59 |  .I $D(^XUSEC("IBD MANAGER",DUZ)) D
 | 
|---|
 | 60 |  ..S IBX=$P(IBDNODE,"^",11) I IBX>1,IBX<20 W !!,"***** Status indicates action has been taken on this entry #"_IBD_" *****"
 | 
|---|
 | 61 |  ..W !!?25,"*** Entry #"_IBD_" STATUS: "_$S(IBX=1:"PRINTED",IBX=2:"SCANNED",IBX=3:"SCD/PCE",IBX=4:"SCD w/ER",IBX=5:"DENTRY",IBX=6:"DE to PCE",IBX=7:"DE w/ER",IBX=11:"PEND Pgs",IBX=12:"NO TRANS",20:"AVAIL DE",1:"NOT PRNT")_" ***"
 | 
|---|
 | 62 |  .I '$D(^XUSEC("IBD MANAGER",DUZ)) D
 | 
|---|
 | 63 |  ..S DFN=$P(IBDNODE,"^",2),APPT=$P(IBDNODE,"^",3),CLN=$P(IBDNODE,"^",10),FORMID=$P(IBDNODE,"^",4)
 | 
|---|
 | 64 |  ..I $D(^DPT(DFN,"S",APPT,0)),$P(^DPT(DFN,"S",APPT,0),"^",1)=CLN D  ; !,"Entry #"_IBD_" - Nothing Deleted...Deleting entries only allowed for entries not associated with an appointment." H 2 S IBQUIT=1 Q
 | 
|---|
 | 65 |  ...I $D(^IBD(357.95,FORMID,0)),'$P(^IBD(357.95,FORMID,0),"^",2) W !,"Entry #"_IBD_" - Nothing Deleted...This entry is associated with an appointment,  and is the most current version of the form." H 2 S IBQUIT=1 Q
 | 
|---|
 | 66 |  ..;I $P(IBDNODE,"^",11)>1,$P(IBDNODE,"^",11)<20 W !,"Status indicates action taken on this entry, deletion not allowed." H 2 Q
 | 
|---|
 | 67 |  .I '$D(IBQUIT) W ! S DIR(0)="Y",DIR("B")="NO",DIR("A")="Are You Sure you want to delete entry #"_IBD
 | 
|---|
 | 68 |  .I '$D(IBQUIT) D ^DIR I Y'=1 W !,"Entry #",IBD," not Deleted!" H 2 Q
 | 
|---|
 | 69 |  .I '$D(IBQUIT) D DP1
 | 
|---|
 | 70 |  .K IBQUIT
 | 
|---|
 | 71 |  I '$D(VALMY) G DTQ1
 | 
|---|
 | 72 |  ;
 | 
|---|
 | 73 | DTQ K ^TMP("CNT",$J),^TMP("FRM",$J),^TMP("FTRK",$J),^TMP("STATS",$J),^TMP("FRMIDX",$J),^TMP("STAIDX",$J)
 | 
|---|
 | 74 |  D EXIT1^IBDFFT,START^IBDFFT1
 | 
|---|
 | 75 | DTQ1 S VALMBCK="R" Q
 | 
|---|
 | 76 |  ;
 | 
|---|
 | 77 | DP1 ; -- actual deletion of forms tracking entry
 | 
|---|
 | 78 |  N DA,DIC,DIK
 | 
|---|
 | 79 |  S DA=IBDF,DIK="^IBD(357.96," D ^DIK
 | 
|---|
 | 80 |  W !,"Entry ",IBD," Deleted!"
 | 
|---|
 | 81 |  Q
 | 
|---|