[613] | 1 | TIUGEDIT ; SLC/MAM - Add New ID Entry; 8/28/01
|
---|
| 2 | ;;1.0;TEXT INTEGRATION UTILITIES;**100,123**;Jun 20, 1997
|
---|
| 3 | DIE(DA,TIUQUIT) ; Invoke ^DIE
|
---|
| 4 | N Y,DIE,DR
|
---|
| 5 | S ^TIU(8925,"ASAVE",DUZ,DA)=""
|
---|
| 6 | S DR=$$GETTMPL^TIUEDI1(+$P(^TIU(8925,+DA,0),U))
|
---|
| 7 | I DR']"" W !?5,$C(7),"No Edit template defined for ",$$PNAME^TIULC1(+$P(^TIU(8925,+DA,0),U)),! S TIUQUIT=2 Q
|
---|
| 8 | S DIE=8925 D ^DIE
|
---|
| 9 | S DR=".05///undictated",DIE=8925 D ^DIE
|
---|
| 10 | D UPDTIRT^TIUDIRT(.TIU,DA),SEND^TIUALRT(DA)
|
---|
| 11 | L -^TIU(8925,+DA)
|
---|
| 12 | Q
|
---|
| 13 | ;
|
---|
| 14 | ADDSTUB(DADDA) ; Prompt user for new stub ID entries for parent DADDA
|
---|
| 15 | N TIUAUTH,TIUTYP,TIUDAD,DFN,TIUDPRM,DA,TIURTYP,TIUPRMT
|
---|
| 16 | N X,Y,DIC
|
---|
| 17 | S DFN=$P(^TIU(8925,DADDA,0),U,2)
|
---|
| 18 | W !!," If you wish you may add stub interdisciplinary entries for this note:",!
|
---|
| 19 | F D Q:$G(TIUAUTH)'>0 Q:$G(TIUTYP)'>0
|
---|
| 20 | . K TIUTYP,TIUAUTH
|
---|
| 21 | . S DIC=200,DIC(0)="AEMQ",DIC("A")="Select stub AUTHOR: "
|
---|
| 22 | . S DIC("S")="I '+$$ISTERM^USRLM(+Y)"
|
---|
| 23 | . D ^DIC
|
---|
| 24 | . ;I Y'>0 S TIUOUT=1 Q
|
---|
| 25 | . Q:Y'>0
|
---|
| 26 | . S TIUAUTH=+Y
|
---|
| 27 | . ; -- Get data array TIUDAD on parent note DADDA: --
|
---|
| 28 | . I '$D(TIUDAD) D GETTIU^TIULD(.TIUDAD,DADDA)
|
---|
| 29 | . D DOCSPICK^TIULA2(.TIUTYP,3,"1A","LAST","Select stub TITLE: ","+$$CANPICK^TIULP(+Y),+$$CANENTR^TIULP(+Y),$$CANLINK^TIULP(+Y)")
|
---|
| 30 | . ;I +$G(TIUTYP)'>0 S TIUOUT=1 Q
|
---|
| 31 | . Q:+$G(TIUTYP)'>0
|
---|
| 32 | . S TIUTYP=+$P($G(TIUTYP(1)),U,2) ; IFN. (DOCSPICK returns TIUTYP as 1.)
|
---|
| 33 | . ; -- Use visit of parent: --
|
---|
| 34 | . M TIU=TIUDAD
|
---|
| 35 | . ;-- Get parameters for selected title: --
|
---|
| 36 | . D DOCPRM^TIULC1(TIUTYP,.TIUDPRM)
|
---|
| 37 | . ; -- Get DA: --
|
---|
| 38 | . S DA=$$CREATREC^TIUEDI3(DFN,.TIU,TIUTYP(1))
|
---|
| 39 | . N TIUQUIT,TIUTDA
|
---|
| 40 | . D DIE(DA,.TIUQUIT)
|
---|
| 41 | . D LINK^TIUGR2(DA,DADDA)
|
---|
| 42 | . W !," Stub entry added",!!
|
---|
| 43 | Q
|
---|
| 44 | ;
|
---|
| 45 | ADDDAD(DADDA,ADDED) ; Create new ID entry and link it to note DADDA
|
---|
| 46 | ; Assumes DADDA can receive ID entries.
|
---|
| 47 | ; Requires DADDA = parent note
|
---|
| 48 | ; Requires DADLINE = parent note line number
|
---|
| 49 | ; Returns ADDED > 0 if new note added (may not be linked), otherwise = 0
|
---|
| 50 | N TITLE,TIUD0,TITLEDA,ADDING,STATUS,KIDDA
|
---|
| 51 | S ADDED=0
|
---|
| 52 | S TIUD0=$G(^TIU(8925,+DADDA,0))
|
---|
| 53 | S TITLEDA=+TIUD0,STATUS=$P(TIUD0,U,5),TITLE=$$PNAME^TIULC1(TITLEDA)
|
---|
| 54 | I STATUS<6 Q
|
---|
| 55 | S ADDING=$$READ^TIUU("Y","Are you adding a new interdisciplinary entry to this note","YES")
|
---|
| 56 | I 'ADDING D Q
|
---|
| 57 | . W !!,"This note appears to be an interdisciplinary parent. Please select"
|
---|
| 58 | . W !,"the note you want to attach to this note FIRST, or check with IRM"
|
---|
| 59 | . W !,"or your clinical coordinator."
|
---|
| 60 | . I $$READ^TIUU("EA","Press RETURN to continue...")
|
---|
| 61 | D CLEAR^VALM1 W !!,"Adding a new interdisciplinary entry to",!,TITLE
|
---|
| 62 | D FULL^VALM1
|
---|
| 63 | D ADDDAD1(DADDA,.KIDDA)
|
---|
| 64 | I $G(KIDDA) S ADDED=1 D:$D(^TMP("TIUR",$J)) UPIDDATA^TIURL1(DADDA),UPIDDATA^TIURL1(KIDDA)
|
---|
| 65 | Q
|
---|
| 66 | ;
|
---|
| 67 | ADDDAD1(DADDA,DA) ; Enter one new ID Document and link it to DADDA
|
---|
| 68 | ; Call with:
|
---|
| 69 | ; [DADDA] --> IFN of note new note will be added to,
|
---|
| 70 | ; i.e. parent note. Required.
|
---|
| 71 | ; [DA] --> IFN of new note or 0 if not created. Passed back.
|
---|
| 72 | N LINKTL,TIUVSUPP,TIULMETH,TIU,TIUVMETH,TIUOUT,TIUASK,TIUDAD
|
---|
| 73 | N TIUNEW,TIU,TIUTYP,DFN,EDIT,TIUCMMTX,TIUDPRM,TIUEXIT,CONTINUE
|
---|
| 74 | N TIUQUIT
|
---|
| 75 | S DA=0
|
---|
| 76 | ; -- Get data array TIUDAD on parent note DADDA: --
|
---|
| 77 | D GETTIU^TIULD(.TIUDAD,DADDA)
|
---|
| 78 | S DFN=$P(^TIU(8925,DADDA,0),U,2)
|
---|
| 79 | ; -- Get new title from user.
|
---|
| 80 | ; Set info into array TIUTYP where
|
---|
| 81 | ; TIUTYP = title DA
|
---|
| 82 | ; TIUTYP(1) = 1^title DA^Name...
|
---|
| 83 | TITLE ; -- Get title. Limit titles to those user can link, at least
|
---|
| 84 | ;for SOME status. Check again later after we know the status.
|
---|
| 85 | W !!,"Please select a title for your entry:"
|
---|
| 86 | D DOCSPICK^TIULA2(.TIUTYP,3,"1A","LAST","","+$$CANPICK^TIULP(+Y),+$$CANENTR^TIULP(+Y),$$CANLINK^TIULP(+Y)")
|
---|
| 87 | I +$G(TIUTYP)'>0 S TIUOUT=1 Q
|
---|
| 88 | S TIUTYP=+$P($G(TIUTYP(1)),U,2) ; IFN. (DOCSPICK returns TIUTYP as 1.)
|
---|
| 89 | VISIT ; -- Get visit (use same visit as first entry unless visit
|
---|
| 90 | ;must be an historical event and parent visit is not hist): --
|
---|
| 91 | S TIUVSUPP=+$$SUPPVSIT^TIULC1(TIUTYP)
|
---|
| 92 | I TIUVSUPP,$P(TIUDAD("VSTR"),";",3)'="E" D EVENT^TIUSRVP1(.TIU,DFN) I 1
|
---|
| 93 | E M TIU=TIUDAD
|
---|
| 94 | VALID ; -- Validate, i.e. ask user if OK: --
|
---|
| 95 | S TIUVMETH=$$GETVMETH^TIUEDI1(TIUTYP)
|
---|
| 96 | I '$L(TIUVMETH) D S TIUOUT=1 Q
|
---|
| 97 | . W !,$C(7),"No Validation Method defined for "
|
---|
| 98 | . W $$PNAME^TIULC1(TIUTYP),".",!,"Please contact IRM..."
|
---|
| 99 | ; -- Ask user if proposed docmt looks OK.
|
---|
| 100 | ; May change array TIU, gets user answer in TIUASK: --
|
---|
| 101 | K TIU("REFDT") ; for new ID child, want default = NOW. See TIULD
|
---|
| 102 | X TIUVMETH
|
---|
| 103 | I '$D(TIU("VSTR")) D Q
|
---|
| 104 | . W !,$C(7),"Patient & Visit required." H 2
|
---|
| 105 | ; -- Go on if user answers says OK: --
|
---|
| 106 | Q:'TIUASK
|
---|
| 107 | ;-- Get parameters for selected title: --
|
---|
| 108 | D DOCPRM^TIULC1(TIUTYP,.TIUDPRM)
|
---|
| 109 | ; -- Get DA: new docmt for user to continue entering, or
|
---|
| 110 | ; existing docmt for user to edit, or existing docmt for
|
---|
| 111 | ; user to link w/o editing since they may not edit it: --
|
---|
| 112 | S DA=$$GETRECG^TIUGEDI1(DFN,.TIU,.TIUTYP,.TIUDPRM,.TIUNEW,.EDIT,DADDA)
|
---|
| 113 | I 'DA S VALMSG="** No entry added **" Q
|
---|
| 114 | ; -- If user is attaching an existing docmt they may not edit,
|
---|
| 115 | ; try to attach, and quit: --
|
---|
| 116 | I 'TIUNEW,'EDIT D TRYLINK(DA,DADDA,.TIUDAD) H 2 Q
|
---|
| 117 | ; -- Edit new or existing DA: --
|
---|
| 118 | N TIUQUIT,TIUTDA
|
---|
| 119 | D DIE^TIUEDI4(DA,.TIUQUIT)
|
---|
| 120 | Q:'$G(^TIU(8925,DA,0)) ; uparrow w/ bad docmt, already deleted
|
---|
| 121 | I $$EMPTYDOC^TIULF(DA) D DELETE^TIUEDIT(DA,0) S:$G(VALMAR)="^TMP(""TIUVIEW"",$J)" VALMBCK="Q" S:'TIUNEW TIUCHNG("DELETE")=1 H:'TIUNEW 2 Q
|
---|
| 122 | I +$G(TIUQUIT),'EDIT W !,"Document not attached" H 2 Q
|
---|
| 123 | ; -- Misc after-edit-stuff for DA --
|
---|
| 124 | I +$G(TIU("STOP")),(+$P($G(TIUDPRM(0)),U,14)'=1) D DEFER^TIUVSIT(DA,TIU("STOP")) I 1 ; Stop code: For stand alones, mark to get work load at signature
|
---|
| 125 | E D QUE^TIUPXAP1 ; Post workload now in background
|
---|
| 126 | S TIUCMMTX=$$COMMIT^TIULC1(TIUTYP)
|
---|
| 127 | I TIUCMMTX]"" X TIUCMMTX
|
---|
| 128 | D RELEASE^TIUT(DA)
|
---|
| 129 | D VERIFY^TIUT(DA)
|
---|
| 130 | ; -- If get this far without quitting, attach entry,
|
---|
| 131 | ; new or existing, so auto-print prints whole note:
|
---|
| 132 | D LINK^TIUGR2(DA,DADDA) S VALMSG="** Entry attached **"
|
---|
| 133 | ; -- Get signature
|
---|
| 134 | D EDSIG^TIURS(DA) ;does auto-print
|
---|
| 135 | ; -- execute EXIT ACTION --
|
---|
| 136 | S TIUEXIT=$$GETEXIT^TIUEDI2(TIUTYP)
|
---|
| 137 | I $L(TIUEXIT) S TIUTDA=DA X TIUEXIT S DA=TIUTDA
|
---|
| 138 | ;I '$G(^TIU(8925,DA,21)) D TRYLINK(DA,DADDA,.TIUDAD)
|
---|
| 139 | ; -- [Prompt to print DA] --
|
---|
| 140 | I +$P($G(TIUDPRM(0)),U,8) D PRINT^TIUEPRNT(DA)
|
---|
| 141 | Q
|
---|
| 142 | ;
|
---|
| 143 | TRYLINK(DA,DADDA,TIUDAD) ; Check specific docmt now that we know
|
---|
| 144 | ;its status, to see if user can attach it to an ID note; if so,
|
---|
| 145 | ;attach DA to DADDA.
|
---|
| 146 | ; Already know that DADDA can receive ID entries.
|
---|
| 147 | ;4/11/01 not currently used
|
---|
| 148 | N CANLINK
|
---|
| 149 | S CANLINK=$$CANDO^TIULP(DA,"ATTACH TO ID NOTE")
|
---|
| 150 | I 'CANLINK D Q
|
---|
| 151 | . W !!,$P(CANLINK,U,2),!," Entry saved as a stand-alone note. Please attach it later if you are",!," authorized to do so."
|
---|
| 152 | . I $$READ^TIUU("EA","Press RETURN to continue...")
|
---|
| 153 | . I $D(DUOUT)!$D(DTOUT)!$D(DIROUT) S TIUQUIT=1
|
---|
| 154 | . S VALMSG="** Entry saved as a stand-alone note **"
|
---|
| 155 | D LINK^TIUGR2(DA,DADDA)
|
---|
| 156 | W !!,"Entry added to ",$P(TIUDAD("DOCTYP"),U,2)
|
---|
| 157 | S VALMSG="** Entry attached **"
|
---|
| 158 | Q
|
---|
| 159 | ;
|
---|