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

IBCNCH3.m

Go to the documentation of this file.
  1. IBCNCH3 ;ALB/FA - PATIENT POLICY COMMENT HISTORY ;27-APR-2015
  1. ;;2.0;INTEGRATED BILLING;**549**;21-MAR-94;Build 54
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; Patient Policy Comment - Expand the selected Comment
  1. ; OR
  1. ; Patient Policy Comment - Display Search Comment Results
  1. ;
  1. EXPCOM(VMODE) ;EP
  1. ; Protocol action to expand a selected Patient Policy Comment
  1. ; After selected a comment to expand the IBCNCH POLICY COMMENT EXPAND
  1. ; Listman template is shown
  1. ; Input: VMODE - 1 if in view only mode, 0 otherwise
  1. ; Optional, defaults to 0
  1. ; DFN - IEN of the selected Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected Patient Policy
  1. ; Output: All Policy Comment History fields displayed
  1. N COMNUM
  1. S:'$D(VMODE) VMODE=0
  1. S VALMBCK="R"
  1. S COMNUM=$$SELCOM^IBCNCH(1,"Select Comment to expand","","IBCNCHIX")
  1. Q:COMNUM=""
  1. D EN(DFN,IBIIEN,COMNUM,VMODE)
  1. Q
  1. ;
  1. ; Called from SEARCH^IBCNCH2 to display all the comments with the found search
  1. ; text in expanded mode with the search text highlighted wherever it was found
  1. ; Input: DFN - IEN of the selected Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected Patient Policy
  1. ; SRCHTXT - Text user was searching for
  1. ; FOUNDTXT- Array of Patient Policy Comment IENS Where the search
  1. ; text was found
  1. D EN(DFN,IBIIEN,"","",SRCHTXT,.FOUNDTXT)
  1. Q
  1. ;
  1. EN(DFN,IBIIEN,COMIEN,VMODE,SRCHTXT,FOUNDTXT) ; Display the expand Listman template
  1. ; Input: DFN - IEN of the selected Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the multiple IEN
  1. ; of the selected Patient Policy
  1. ; COMIEN - IEN of the selected Patient Policy Comment
  1. ; "" when called to in display search text mode
  1. ; VMODE - 1 if in view only mode, 0 otherwise
  1. ; Optional, defaults to 0
  1. ; SRCHTXT - Text user was searching for
  1. ; Optional, only passed when displaying found search text
  1. ; FOUNDTXT- Array of Patient Policy Comment IENS Where the search
  1. ; text was found
  1. ; Optional, only passed when displaying found search text
  1. ; Output: COMIEN - COMIEN of comment to display in search mode
  1. ; Only set when in search mode
  1. S:'$D(FOUNDTXT) FOUNDTXT=0
  1. K VALMQUIT
  1. I $G(DFN)="" D Q
  1. . W !!,*7,"Patient is not identified."
  1. . D PAUSE^VALM1
  1. I IBIIEN=0 D Q
  1. . W !!,*7,"Patient Policy is not identified."
  1. . D PAUSE^VALM1
  1. ;
  1. I FOUNDTXT D Q ; Display Search listman
  1. . S COMIEN=FOUNDTXT(0,1)
  1. . D EN^VALM("IBCNCH POLICY COMMENT SEARCH")
  1. ;
  1. I VMODE D Q
  1. . D EN^VALM("IBCNCH POL COMMENT EXPAND VIEW")
  1. D EN^VALM("IBCNCH POLICY COMMENT EXPAND")
  1. I $G(IBFASTXT)'=1 D
  1. . D CLEAN^VALM10,INIT^IBCNCH,HDR^IBCNCH
  1. . S VALMBCK="R"
  1. Q
  1. ;
  1. HDR ;EP
  1. ; Build the listman template header information
  1. ; Input: DFN - IEN of the select Patient
  1. ; IBPPOL - ^DPT(DFN,.312,PIEN,0) Where PIEN is the IEN of the
  1. ; selected Patient Policy
  1. ; COMIEN - IEN of the selected Patient Policy Comment
  1. ; "" when called to in display search text mode
  1. ; SRCHTXT - Text user was searching for
  1. ; Optional, only passed when displaying found search text
  1. ; FOUNDTXT- Array of Patient Policy Comments Where the search
  1. ; text was found
  1. ; Optional, only passed when displaying found search text
  1. N WW,XX,YY,ZZ
  1. S XX=$E($P(^DPT(DFN,0),"^",1),1,20)_" "_$P($$PT^IBEFUNC(DFN),"^",2)
  1. S ZZ=$$GET1^DIQ(2,DFN_",",.03),XX=XX_" "_ZZ
  1. S VALMHDR(1)="Policy Comment History for: "_XX
  1. S ZZ=$G(^DPT(DFN,.312,+$P(IBPPOL,"^",4),0))
  1. S WW=$P($G(^IBA(355.3,+$P(ZZ,"^",18),0)),"^",11)
  1. S YY=$E($P($G(^DIC(36,+ZZ,0)),"^",1),1,20)_" Insurance Company"
  1. S XX="** Plan Currently "_$S(WW:"Ina",1:"A")_"ctive **"
  1. S VALMHDR(2)=$$SETSTR^VALM1(XX,YY,48,29)
  1. I FOUNDTXT D
  1. . S YY=FOUNDTXT(1,COMIEN)
  1. . S XX=$S(YY=1:"1st",YY=2:"2nd",YY=3:"3rd",1:YY_"th")
  1. . S ZZ="Displaying "_XX_" of "_FOUNDTXT_" Pt Policy Comments where '"
  1. . S ZZ=ZZ_SRCHTXT_"' was found."
  1. . S VALMHDR(3)=ZZ
  1. Q
  1. ;
  1. INIT ;EP
  1. ; Initialize the listman template
  1. ; Input: DFN - IEN of the selected Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected Patient Policy
  1. ; COMIEN - IEN of the selected Patient Policy Comment
  1. ; SRCHTXT - Text user was searching for
  1. ; Optional, only passed when displaying found
  1. ; search text
  1. ; FOUNDTXT - Array of Patient Policy Comment IENS Where
  1. ; the search text was found
  1. ; Optional, only passed when displaying found
  1. ; search text
  1. ; Output: ^TMP("IBCNCH3",$J) - Body lines to display for specified template
  1. K ^TMP("IBCNCH3",$J)
  1. S:'$D(SRCHTXT) SRCHTXT=""
  1. D BLD(DFN,IBIIEN,COMIEN,SRCHTXT)
  1. Q
  1. ;
  1. BLD(DFN,IBIIEN,COMIEN,SRCHTXT,SMODE) ; Build the listman template body
  1. ; Input: DFN - IEN of the select Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected Patient Policy
  1. ; COMIEN - IEN of the selected Patient Policy Comment
  1. ; SRCHTXT - Text user was searching for or null if not in search
  1. ; mode
  1. N ELINEL,ELINER,IENS,SLINE,STARTR
  1. S VALMCNT=0,SLINE=1
  1. S IENS=COMIEN_","_IBIIEN_","_DFN_","
  1. D BLDCOML(IENS,SLINE,.STARTR,.ELINEL,SRCHTXT) ; Build Left Column
  1. ;
  1. ; The next two lines are in place in case a build right column is ever added.
  1. ; If one is added, we would need to determine which side has more lines but
  1. ; since none is currently present, temporarily setting ELINER=ELINEL.
  1. S ELINER=ELINEL
  1. S SLINE=$S(ELINEL'>ELINER:ELINER,1:ELINEL)
  1. D BLDCOMT(IENS,SLINE,.ELINEL,SRCHTXT) ; Build Comment Text
  1. S VALMCNT=$O(^TMP("IBCNCH3",$J,""),-1)
  1. Q
  1. ;
  1. BLDCOML(IENS,SLINE,STARTR,ELINE,SRCHTXT) ; Build the non-comment section
  1. ; of the Expanded Comment Display
  1. ; NOTE: Code is set-up to allow a section display to the right of
  1. ; this section but none exists at present
  1. ; Input: IENS - String of IENS needed to access comment fields
  1. ; SLINE - Starting Line Number
  1. ; ELINE - Current Ending Line Number
  1. ; SRCHTXT - Text user was searching for
  1. ; Optional, only passed when displaying found search text
  1. ; Output: STARTR - Line to start displaying Right Column
  1. ; ELINE - Updated Ending Line
  1. ;
  1. N XX
  1. S STARTR=SLINE ; Start of Right Section
  1. S XX=$$GET1^DIQ(2.342,IENS,.01,"I")
  1. S XX=$$FMTE^XLFDT(XX,"2SZ")
  1. S ELINE=$$SET("Last Edited Date: ",XX,SLINE,1)
  1. S ELINE=$$SET(" Last Edited By: ",$$GET1^DIQ(2.342,IENS,.02),ELINE,1)
  1. S ELINE=$$SET(" Contact Person: ",$$GET1^DIQ(2.342,IENS,.04),ELINE,1,SRCHTXT)
  1. S ELINE=$$SET(" Contact Phone #: ",$$GET1^DIQ(2.342,IENS,.05),ELINE,1,SRCHTXT)
  1. S ELINE=$$SET(" Method: ",$$GET1^DIQ(2.342,IENS,.07),ELINE,1,SRCHTXT)
  1. S ELINE=$$SET("Call Reference #: ",$$GET1^DIQ(2.342,IENS,.06),ELINE,1,SRCHTXT)
  1. S ELINE=$$SET(" Authorization #: ",$$GET1^DIQ(2.342,IENS,.08),ELINE,1,SRCHTXT)
  1. Q
  1. ;
  1. BLDCOMT(IENS,SLINE,ELINE,SRCHTXT) ; Build the Comment Text Section
  1. ; Input: IENS - String of IENS needed to access comment fields
  1. ; SLINE - Starting Line Number
  1. ; ELINE - Current Ending Line Number
  1. ; SRCHTXT - Text user was searching for
  1. ; Optional, only passed when displaying found search text
  1. ; Output: ELINE - Updated Ending Line Number
  1. ;
  1. N COMTEXT,CPOS,REM,XX
  1. S COMTEXT=$$GET1^DIQ(2.342,IENS,.03)
  1. S ELINE=$$SET("","",SLINE,1) ; Spacing Blank Line
  1. S ELINE=$$SET("Comment","",ELINE,1)
  1. S ELINE=$$SETC(COMTEXT,ELINE,SRCHTXT) ; Display comment line(s)
  1. Q
  1. ;
  1. SETC(DATA,LINE,SRCHTXT) ; Sets comment text into the body of the worklist
  1. ; Input: DATA - Comment Text to set into line(s)
  1. ; LINE - Current Line text is being set into
  1. ; SRCHTXT - Text user was searching for
  1. ; Optional, only passed when displaying found search text
  1. ; Returns: LINE - Updated Line text is being set into
  1. ;
  1. N CLNEND,CPOS,CWLPOS,CWPOS,CWEPOS,DATAU,SPOS,STLEN,STXTU,XX
  1. S:'$D(SRCHTXT) SRCHTXT=""
  1. S STLEN=$L(SRCHTXT)
  1. S DATAU=$$UP^XLFSTR(DATA)
  1. S STXTU=$$UP^XLFSTR(SRCHTXT)
  1. ;
  1. ; Display the comment text 1 line at a time and if in search mode displaying
  1. ; any instances of found search text in reverse video
  1. S (CPOS,SPOS)=0,CLNEND=80
  1. S (CWLPOS,CWPOS)=1,CWEPOS=$L(DATA)
  1. F D Q:(CWPOS>CWEPOS)
  1. . I SRCHTXT'="" D
  1. . . S CPOS=$F(DATAU,STXTU,CWPOS),SPOS=0
  1. . . Q:'CPOS
  1. . . S SPOS=CPOS-STLEN ; Starting position of found text
  1. . ;
  1. . ; Not in search mode OR search text not found in characters CWPOS-CLNEND
  1. . ; of the comment. Display the text from position CWPOS-CLNEND
  1. . I 'SPOS!(SPOS>CLNEND) D Q
  1. . . S XX=$E(DATA,CWPOS,CLNEND)
  1. . . D SET1(XX,LINE,CWLPOS,$L(XX))
  1. . . S LINE=LINE+1,CWLPOS=1
  1. . . S CWPOS=CLNEND+1,CLNEND=CLNEND+80
  1. . ;
  1. . ; Search text found starting somewhere in current comment line. First
  1. . ; display any text in front of the found search text
  1. . I SPOS>1 D
  1. . . S XX=$E(DATA,CWPOS,SPOS-1),CWPOS=SPOS
  1. . . D SET1(XX,LINE,CWLPOS,$L(XX))
  1. . . S CWLPOS=CWLPOS+$L(XX)
  1. . ;
  1. . ; If entire search text found in characters CWPOS-CLNEND. Display search
  1. . ; text in reverse video
  1. . I (CPOS-1)'>CLNEND D Q
  1. . . S XX=$E(DATA,CWPOS,(CPOS-1)),CWPOS=CPOS
  1. . . D SET1(XX,LINE,CWLPOS,$L(XX),0,1)
  1. . . S CWLPOS=CWLPOS+STLEN
  1. . ;
  1. . ; Search text is straddling comment text lines. First display the start of
  1. . ; the search text on the current line in reverse video
  1. . S XX=$E(DATA,SPOS,CLNEND),CWPOS=CLNEND+1
  1. . D SET1(XX,LINE,CWLPOS,$L(XX),0,1)
  1. . S LINE=LINE+1,CLNEND=CLNEND+80,CWLPOS=1
  1. . ;
  1. . ; Next display remaining search text in reverse video
  1. . S XX=$E(DATA,CWPOS,(CPOS-1)),CWPOS=CPOS
  1. . D SET1(XX,LINE,CWLPOS,$L(XX),0,1)
  1. . S CWLPOS=CWLPOS+$L(XX)
  1. Q LINE
  1. ;
  1. SET(LABEL,DATA,LINE,COL,SRCHTXT) ; Sets text into the body of the worklist
  1. ; Input: LABEL - Label text to set into the line
  1. ; DATA - Field Data to set into the line
  1. ; LINE - Line to set LABEL and DATA into
  1. ; COL - Starting column position in LINE to insert
  1. ; LABEL_DATA text
  1. ; SRCHTXT - Text user was searching for
  1. ; Optional, only passed when displaying found search text
  1. ; Returns: LINE - Updated Line by 1
  1. ;
  1. N COL,DATAU,FPOS,START,STXTU,WHICH,XX
  1. S:'$D(SRCHTXT) SRCHTXT=""
  1. S DATAU=$$UP^XLFSTR(DATA)
  1. S STXTU=$$UP^XLFSTR(SRCHTXT)
  1. S WHICH=$S(SRCHTXT="":0,DATAU[STXTU:1,1:0)
  1. D SET1(LABEL,LINE,1,$L(LABEL),1) ; First display the label
  1. ;
  1. ; Not in search mode OR search text not found
  1. I 'WHICH D Q LINE
  1. . D SET1(DATA,LINE,$L(LABEL)+1,$L(DATA))
  1. . S LINE=LINE+1
  1. ;
  1. ; Display text with all occurrences of the search text in reverse video
  1. S COL=$L(LABEL)+1
  1. F D Q:(DATA="")!'FPOS
  1. . S FPOS=$F(DATAU,STXTU) ; Find the search text
  1. . Q:'FPOS ; No more occurrences found
  1. . S XX=FPOS-$L(SRCHTXT)-1
  1. . S START=$S(XX:$E(DATA,1,XX),1:"")
  1. . I START'="" D
  1. . . D SET1(START,LINE,COL,$L(START))
  1. . . S COL=COL+$L(START)
  1. . S XX=$E(DATA,XX+1,FPOS-1)
  1. . D SET1(XX,LINE,COL,$L(XX),0,1)
  1. . S COL=COL+$L(SRCHTXT)
  1. . S DATA=$E(DATA,FPOS,$L(DATA))
  1. . S DATAU=$E(DATAU,FPOS,$L(DATAU))
  1. D:DATA'="" SET1(DATA,LINE,COL,$L(DATA)) ; Display any remaining text
  1. S LINE=LINE+1
  1. Q LINE
  1. ;
  1. SET1(TEXT,LINE,COL,WIDTH,BOLD,RV) ; Sets the TMP array with body data
  1. ; Input: TEXT - Text to be set into the specified line
  1. ; LINE - Line to set TEXT into
  1. ; COL - Column of LINE to set TEXT into
  1. ; WIDTH - Width of the TEXT being set into line
  1. ; BOLD - 1 - Set bold on, 0 otherwise
  1. ; Optional, defaults to ""
  1. ; RV - 1 - Set Reverse Video on, 0 otherwise
  1. ; Optional, defaults to ""
  1. ; ^TMP("IBCNCH3",$J) - Current ^TMP array
  1. ; Output: ^TMP("IBCNCH3",$J) - Updated ^TMP array
  1. ;
  1. N IBX
  1. S:'$D(BOLD) BOLD=0
  1. S:'$D(RV) RV=0
  1. S IBX=$G(^TMP("IBCNCH3",$J,LINE,0))
  1. S IBX=$$SETSTR^VALM1(TEXT,IBX,COL,WIDTH)
  1. D SET^VALM10(LINE,IBX)
  1. D:BOLD CNTRL^VALM10(LINE,COL,WIDTH,IOINHI,IOINORM)
  1. D:RV CNTRL^VALM10(LINE,COL,WIDTH,IORVON,IORVOFF)
  1. Q
  1. ;
  1. HELP ;EP
  1. ; Display the listman template help
  1. N X
  1. S X="?"
  1. D DISP^XQORM1
  1. W !!
  1. Q
  1. ;
  1. EXIT ;EP
  1. ; Exit the listman template
  1. K ^TMP("IBCNCH3",$J)
  1. D CLEAR^VALM1
  1. Q
  1. ;
  1. NEXTCOM ;EP
  1. ; Protocol action to show the next comment with the found Search text
  1. ; Input: DFN - IEN of the selected Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected Patient Policy
  1. ; COMIEN - IEN of the currently displayed Patient Policy Comment
  1. ; FOUNDTXT- Array of Patient Policy Comment IENS Where the search
  1. ; text was found
  1. ; Output: Next Patient Policy Comment is displayed
  1. ; COMIEN - IEN of the next Patient Policy Comment to display
  1. N XX
  1. S VALMBCK="R"
  1. S XX=FOUNDTXT(1,COMIEN),XX=$O(FOUNDTXT(0,XX))
  1. I XX="" D Q
  1. . W !!,*7,"No more comments with the search text were found."
  1. . D PAUSE^VALM1
  1. S COMIEN=FOUNDTXT(0,XX)
  1. D CLEAN^VALM10
  1. D HDR,INIT
  1. Q
  1. ;
  1. PREVCOM ;EP
  1. ; Protocol action to show the previous comment with the found Search text
  1. ; Input: DFN - IEN of the selected Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected Patient Policy
  1. ; FOUNDTXT- Array of Patient Policy Comment IENS Where the search
  1. ; text was found
  1. ; Output: Next Patient Policy Comment is displayed
  1. ; COMIENS - Updated Index into the FOUNDTXT array of the Patient
  1. ; Policy Comment currently being shown
  1. N XX
  1. S VALMBCK="R"
  1. S XX=FOUNDTXT(1,COMIEN),XX=$O(FOUNDTXT(0,XX),-1)
  1. I XX="" D Q
  1. . W !!,*7,"First comment with the search text is already being displayed."
  1. . D PAUSE^VALM1
  1. S COMIEN=FOUNDTXT(0,XX)
  1. D CLEAN^VALM10
  1. D HDR,INIT
  1. Q