MDRPCNT ; HOIFO/NCA - Document Handler Object (TMDNOTE) ;5/23/05 15:50
;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
; Reference IA #2944 [Subscription] Calls to TIUSRVR1.
; 2240 [Supported] ENCRYP^XUSRB1 call
; 2241 [Supported] DECRYP^XUSRB1 call
; 2693 [Subscription] TIULQ call
;
RPC(RESULTS,OPTION,MDSID,MDTIU,MDDTE,MDAUTH,MDESIG,MDNTL,MDTXT) ; [Procedure] Main RPC call
; RPC: [MD TMDNOTE]
;
; MDSID=702 IEN
; MDTIU=Note Internal Entry Number
; MDDTE=Date/Time of Note
; MDAUTH=Author of Note
; MDESIG=Encoded E-Sig
; MDNTL=Note Title
; MDTXT=Array containing the text for the note
;
D CLEAN^DILF
S RESULTS=$NA(^TMP("MDKUTL",$J)) K @RESULTS
I $T(@OPTION)="" D Q
.S @RESULTS@(0)="-1^Error in RPC: MD TMDNOTE at "_OPTION_U_$T(+0)
D @OPTION S:'$D(@RESULTS) @RESULTS@(0)="-1^No return"
D CLEAN^DILF
Q
;
NEWDOC ; Add additional new note
;
I '$D(^MDD(702,+MDSID,0)) S @RESULTS@(0)="-1^No such study" Q
I $D(MDTXT)<1 S @RESULTS@(0)="-1^No note text" Q
K ^TMP("MDTXT",$J)
N X,Y S X="",Y=0
F S X=$O(MDTXT(X)) Q:X="" S Y=Y+1,^TMP("MDTXT",$J,Y)=MDTXT(X)
I Y<1 S @RESULTS@(0)="-1^No note text" Q
S MDESIG=$$DECRYP^XUSRB1(MDESIG),MDESIG=$$ENCRYP^XUSRB1(MDESIG)
I $G(MDDTE)="" D NOW^%DTC S MDDTE=% K %
S @RESULTS@(0)=$$SUBMIT^MDRPCNT1(+MDSID,MDDTE,MDAUTH,MDESIG,MDNTL,$NA(^TMP("MDTXT",$J)))
;
K ^TMP("MDTXT",$J)
Q
;
NOTELIST ; Get list of documents
; Return:
; Note Ien
; Note Title
; Date/Time Creation
; Author
;
N MDCST,MDDL,MDK,MDX1 S MDDL="" K ^TMP("MDDLST",$J)
S MDK=0 F S MDK=$O(^MDD(702.001,"ASTUDY",MDSID,MDK)) Q:MDK<1 S MDX1=+MDK D
.N MDDOC,MDTIUER
.S (MDDOC,MDTIUER)="" K ^TMP("MDTIUST",$J)
.D EXTRACT^TIULQ(+MDX1,"^TMP(""MDTIUST"",$J)",MDTIUER,".01;.05;1201;1202;1205") Q:+MDTIUER
.I $G(^TMP("MDTIUST",$J,MDX1,.05,"E"))'="COMPLETED" Q
.S @RESULTS@(MDK)=+MDX1_"^"_$G(^TMP("MDTIUST",$J,MDX1,.01,"E"))_"^"_$G(^TMP("MDTIUST",$J,MDX1,1201,"E"))_"^"_$G(^TMP("MDTIUST",$J,MDX1,1202,"E"))_"^"_$G(^TMP("MDTIUST",$J,MDX1,1205,"E"))
.K ^TMP("MDTIUST",$J)
.Q
Q
;
VIEWTIU ; [Procedure] View the associated TIU document
I '$G(MDTIU) S @RESULTS@(0)="-1^NO TIU NOTE FOR THIS STUDY" Q
D TGET^TIUSRVR1(.RESULTS,+MDTIU)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMDRPCNT 2296 printed Dec 13, 2024@01:43:58 Page 2
MDRPCNT ; HOIFO/NCA - Document Handler Object (TMDNOTE) ;5/23/05 15:50
+1 ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
+2 ; Reference IA #2944 [Subscription] Calls to TIUSRVR1.
+3 ; 2240 [Supported] ENCRYP^XUSRB1 call
+4 ; 2241 [Supported] DECRYP^XUSRB1 call
+5 ; 2693 [Subscription] TIULQ call
+6 ;
RPC(RESULTS,OPTION,MDSID,MDTIU,MDDTE,MDAUTH,MDESIG,MDNTL,MDTXT) ; [Procedure] Main RPC call
+1 ; RPC: [MD TMDNOTE]
+2 ;
+3 ; MDSID=702 IEN
+4 ; MDTIU=Note Internal Entry Number
+5 ; MDDTE=Date/Time of Note
+6 ; MDAUTH=Author of Note
+7 ; MDESIG=Encoded E-Sig
+8 ; MDNTL=Note Title
+9 ; MDTXT=Array containing the text for the note
+10 ;
+11 DO CLEAN^DILF
+12 SET RESULTS=$NAME(^TMP("MDKUTL",$JOB))
KILL @RESULTS
+13 IF $TEXT(@OPTION)=""
Begin DoDot:1
+14 SET @RESULTS@(0)="-1^Error in RPC: MD TMDNOTE at "_OPTION_U_$TEXT(+0)
End DoDot:1
QUIT
+15 DO @OPTION
if '$DATA(@RESULTS)
SET @RESULTS@(0)="-1^No return"
+16 DO CLEAN^DILF
+17 QUIT
+18 ;
NEWDOC ; Add additional new note
+1 ;
+2 IF '$DATA(^MDD(702,+MDSID,0))
SET @RESULTS@(0)="-1^No such study"
QUIT
+3 IF $DATA(MDTXT)<1
SET @RESULTS@(0)="-1^No note text"
QUIT
+4 KILL ^TMP("MDTXT",$JOB)
+5 NEW X,Y
SET X=""
SET Y=0
+6 FOR
SET X=$ORDER(MDTXT(X))
if X=""
QUIT
SET Y=Y+1
SET ^TMP("MDTXT",$JOB,Y)=MDTXT(X)
+7 IF Y<1
SET @RESULTS@(0)="-1^No note text"
QUIT
+8 SET MDESIG=$$DECRYP^XUSRB1(MDESIG)
SET MDESIG=$$ENCRYP^XUSRB1(MDESIG)
+9 IF $GET(MDDTE)=""
DO NOW^%DTC
SET MDDTE=%
KILL %
+10 SET @RESULTS@(0)=$$SUBMIT^MDRPCNT1(+MDSID,MDDTE,MDAUTH,MDESIG,MDNTL,$NAME(^TMP("MDTXT",$JOB)))
+11 ;
+12 KILL ^TMP("MDTXT",$JOB)
+13 QUIT
+14 ;
NOTELIST ; Get list of documents
+1 ; Return:
+2 ; Note Ien
+3 ; Note Title
+4 ; Date/Time Creation
+5 ; Author
+6 ;
+7 NEW MDCST,MDDL,MDK,MDX1
SET MDDL=""
KILL ^TMP("MDDLST",$JOB)
+8 SET MDK=0
FOR
SET MDK=$ORDER(^MDD(702.001,"ASTUDY",MDSID,MDK))
if MDK<1
QUIT
SET MDX1=+MDK
Begin DoDot:1
+9 NEW MDDOC,MDTIUER
+10 SET (MDDOC,MDTIUER)=""
KILL ^TMP("MDTIUST",$JOB)
+11 DO EXTRACT^TIULQ(+MDX1,"^TMP(""MDTIUST"",$J)",MDTIUER,".01;.05;1201;1202;1205")
if +MDTIUER
QUIT
+12 IF $GET(^TMP("MDTIUST",$JOB,MDX1,.05,"E"))'="COMPLETED"
QUIT
+13 SET @RESULTS@(MDK)=+MDX1_"^"_$GET(^TMP("MDTIUST",$JOB,MDX1,.01,"E"))_"^"_$GET(^TMP("MDTIUST",$JOB,MDX1,1201,"E"))_"^"_$GET(^TMP("MDTIUST",$JOB,MDX1,1202,"E"))_"^"_$GET(^TMP("MDTIUST",$JOB,MDX1,1205,"E"))
+14 KILL ^TMP("MDTIUST",$JOB)
+15 QUIT
End DoDot:1
+16 QUIT
+17 ;
VIEWTIU ; [Procedure] View the associated TIU document
+1 IF '$GET(MDTIU)
SET @RESULTS@(0)="-1^NO TIU NOTE FOR THIS STUDY"
QUIT
+2 DO TGET^TIUSRVR1(.RESULTS,+MDTIU)
+3 QUIT