Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BMCRPC5

BMCRPC5.m

Go to the documentation of this file.
  1. BMCRPC5 ; IHS/CAS/AU - GUI REFERRED CARE INFO SYSTEM (4/4);
  1. ;;4.0;REFERRED CARE INFO SYSTEM;**11,12**;JAN 09, 2006;Build 101
  1. ;
  1. ;GDIT/HS/BEE 10/19/17 - p12 CR#5450:Added BMC PRINT REFERRAL RPC call (tag PRINT)
  1. ;GDIT/HS/BEE 10/19/17 - p12 - Address XINDEX/SAC issues
  1. ;
  1. ; RPC code for RCIS GUI Application
  1. ; Routines contains code for saving Business office and Medical History/Finding in RCIS Referral table.
  1. ;SETWP(FN,WPFN,IEN,NOTES,ISAPPEND,ISDELETE) ;Set WordProcessing Data based on file, field and IEN information!
  1. ;S FileNumber=$G(FN),WpFieldNumber=$G(WPFN),RowId=$G(IEN),Notes=$G(NOTES),IsAppend=$G(ISAPPEND),IsDelete=$G(ISDELETE)
  1. ;I +$G(RowId)<1,+$G(FileNumber)<1,+$G(WpFieldNumber)<1,$L($G(Notes))<1 Q "0^Required Data missing"
  1. ;I $G(Notes)["2@%Library.GlobalBinaryStream" Q "-2^GlobalBinaryStream error"
  1. ;N err,wproot,wp,i,OrigCharCount,RunningCharCount
  1. ;S OrigCharCount=$L($G(Notes))
  1. ;I IsDelete S wproot="@"
  1. ;I 'IsDelete D
  1. ;. S Notes=$LISTFROMSTRING(Notes,$c(13))
  1. ;. S wproot="wp",i=0,RunningCharCount=0
  1. ;. F i=1:1:$ll(Notes) S wp(i)=$lg(Notes,i)
  1. ;I IsAppend D WP^DIE(FileNumber,RowId_",",WpFieldNumber,"AK",wproot,"err")
  1. ;I 'IsAppend D WP^DIE(FileNumber,RowId_",",WpFieldNumber,"K",wproot,"err")
  1. ;I $D(err) Q "-1^"_$G(err("DIERR",1,"TEXT",1))
  1. ;K err,wproot,wp,i,OrigCharCount,RunningCharCount,Notes,RowId,FileNumber,WpFieldNumber
  1. ;Q "1"
  1. SETWP(FILENUM,WPFLDNM,ROWID,NOTES,ISAPPEND,ISDELETE) ;EP Set WordProcessing Data based on file, field and IEN information
  1. ;
  1. NEW ERR,WPROOT,WP,II
  1. ;
  1. S ISAPPEND=$G(ISAPPEND),ISDELETE=$G(ISDELETE)
  1. ;
  1. ;Input checking
  1. I (+$G(ROWID)<1)!(+$G(FILENUM)<1)!(+$G(WPFLDNM)<1)!($L($G(NOTES))<1) Q "0^Required Data missing"
  1. I NOTES["2@%Library.GlobalBinaryStream" Q "-2^GlobalBinaryStream error"
  1. ;
  1. ;Deletes
  1. I ISDELETE S WPROOT="@"
  1. ;
  1. ;Format Add/Appends
  1. I 'ISDELETE D
  1. . S WPROOT="WP"
  1. . F II=1:1:$L(NOTES,"~") S WP(II)=$P(NOTES,"~",II)
  1. ;
  1. ;Add/Append/Delete
  1. I ISAPPEND D WP^DIE(FILENUM,ROWID_",",WPFLDNM,"AK",WPROOT,"ERR")
  1. I 'ISAPPEND D WP^DIE(FILENUM,ROWID_",",WPFLDNM,"K",WPROOT,"ERR")
  1. I $D(ERR) Q "-1^"_$G(ERR("DIERR",1,"TEXT",1))
  1. Q "1"
  1. ;
  1. ;GDIT/HS/BEE 10/19/17 - p12 CR#5450;Added PRINT and GETRPT tags
  1. PRINT(ROOT,BMCREF) ;EP RPC - BMC PRINT REFERRAL
  1. ;
  1. ;This tag is called by the BMC PRINT REFERRAL RPC call - It returns a formatted
  1. ;STANDARD IHS REFERRAL LETTER for a passed in referral number
  1. ;
  1. ;Input: BMCREF - Pointer to RCIS REFERRAL entry
  1. ;
  1. ;Reset output and define root
  1. K ^TMP("BMCDATA",$J)
  1. S ROOT=$NA(^TMP("BMCDATA",$J,1))
  1. ;
  1. ;Compile the report
  1. D GETRPT(.ROOT,BMCREF)
  1. Q
  1. ;
  1. GETRPT(DATA,BMCREF) ;Retrieve the referral letter
  1. NEW II
  1. S DATA=$$TMPGBL^CIAVMRPC
  1. I '$G(BMCREF) S @DATA@(1)="A referral has not been selected." Q
  1. D CAPTURE^CIAUHFS("D GPRINT^BMCFPRN(BMCREF)",DATA,80)
  1. S:'$D(@DATA) @DATA@(1)="No referral information was found."
  1. ;
  1. ;Append CR/LF to end of each line
  1. S II="" F S II=$O(@DATA@(II)) Q:II="" S @DATA@(II)=@DATA@(II)_$C(13)_$C(10)
  1. Q