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

IBCNCH2.m

Go to the documentation of this file.
  1. IBCNCH2 ;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 Comments - 1. Build main insurance comment display
  1. ; 2. Search Comments for a specified String
  1. ;
  1. BLD(DFN,IBIIEN) ;EP
  1. ; Build the listman template body of the main Insurance Comment display
  1. ; Input: DFN - IEN of the patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected patient policy
  1. ; ^TMP($J,"IBCNCHIX",CNT) - See GETCOMS
  1. N CNT,LINE,LN,XX
  1. D GETCOMS(DFN,IBIIEN)
  1. S VALMCNT=0,LINE="",CNT=""
  1. ;
  1. F D Q:CNT=""
  1. . S CNT=$O(^TMP($J,"IBCNCHIX",CNT))
  1. . Q:CNT=""
  1. . I CNT'=1 D
  1. . . S VALMCNT=VALMCNT+1
  1. . . D SET^VALM10(VALMCNT,"",VALMCNT)
  1. . ;
  1. . S VALMCNT=VALMCNT+1
  1. . D BLDONEC(.VALMCNT,CNT)
  1. ;
  1. I VALMCNT=0 D
  1. . S VALMCNT=1,XX=" *** No comments to display ***"
  1. . D SET^VALM10(VALMCNT,XX,VALMCNT)
  1. Q
  1. ;
  1. BLDONEC(VALMCNT,COMCNT) ; (Re)Build one comment into the listman display
  1. ; Called from BLD and after adding or editing a comment
  1. ; Input: VALMCNT - Current Line of the display being
  1. ; (re)built
  1. ; COMCNT - Comment Number
  1. ; ^TMP($J,"IBCNCHIX",COMCNT) - See GETONEC for details
  1. ; Output: VALMCNT - Updated Line of the display being
  1. ; (re)built
  1. N DATALN,LINE
  1. S LINE=$$SETL("",COMCNT,"",1,4) ; Comment #
  1. S DATALN=^TMP($J,"IBCNCHIX",COMCNT)
  1. S XX=$P(DATALN,"^",1) ; Dt Entered
  1. S LINE=$$SETL(LINE,XX,"",6,15)
  1. D SET^VALM10(VALMCNT,LINE,VALMCNT)
  1. S XX=$P(DATALN,"^",2) ; Entered By
  1. S LINE=$$SETL(LINE,XX,"",18,37)
  1. D SET^VALM10(VALMCNT,LINE,VALMCNT)
  1. S XX=$P(DATALN,"^",4) ; Method
  1. S LINE=$$SETL(LINE,XX,"",44,52)
  1. D SET^VALM10(VALMCNT,LINE,VALMCNT)
  1. S XX=$P(DATALN,"^",3) ; Person Contacted
  1. S LINE=$$SETL(LINE,XX,"",55,80)
  1. D SET^VALM10(VALMCNT,LINE,VALMCNT)
  1. S VALMCNT=VALMCNT+1
  1. S XX=$E($P(DATALN,"^",8),1,132) ; Start of Comment
  1. S LINE=$$SETL("",XX,"",6,80)
  1. D SET^VALM10(VALMCNT,LINE,VALMCNT)
  1. Q
  1. ;
  1. GETCOMS(DFN,IBIIEN) ; Retrieves the policy comments for the selected
  1. ; patient and policy in most recent date order
  1. ; Input: DFN - IEN of the patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected patient policy
  1. ; Output: ^TMP($J,"IBCNCHIX",CNT) - A1^A2^A3^A4^A5^A6^A7^A8^A9^A10
  1. ; See GETONEC for detailed explanation
  1. N CNT,COMDT,COMIEN
  1. S CNT=0,COMDT=""
  1. F D Q:COMDT=""
  1. . S COMDT=$O(^DPT(DFN,.312,IBIIEN,13,"B",COMDT),-1)
  1. . Q:COMDT=""
  1. . S COMIEN=""
  1. . F D Q:COMIEN=""
  1. . . S COMIEN=$O(^DPT(DFN,.312,IBIIEN,13,"B",COMDT,COMIEN),-1)
  1. . . Q:COMIEN=""
  1. . . S CNT=CNT+1
  1. . . D GETONEC(DFN,IBIIEN,COMIEN,CNT) ; Get One Comment
  1. Q
  1. ;
  1. GETONEC(DFN,IBIIEN,COMIEN,CNT,CLEN,FULL,NOSET) ;EP
  1. ; Get the Data for a specified Policy Comment
  1. ; Input: DFN - IEN of the patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the
  1. ; multiple IEN of the selected patient policy
  1. ; COMIEN - ^DPT(DFN,.312,IBIIEN,13,COMIEN,0) Where
  1. ; COMIEN is the multiple IEN of the selected
  1. ; Patient Policy Comment
  1. ; CNT - Current Comment Selection Number
  1. ; CLEN - Length of Partial Comment to be displayed
  1. ; Optional, defaults to 74
  1. ; FULL - 1 to return the full comment text,
  1. ; otherwise
  1. ; Optional - defaults to 0
  1. ; NOSET - 1 to not set into ^TMP, 0 otherwise
  1. ; Optional, defaults to 0
  1. ; Output: NOTE: ^TMP($J,"IBCNCHIX",CNT) only set if NOSET=0
  1. ; ^TMP($J,"IBCNCHIX",CNT) - A1^A2^A3^A4^A5^A6^A7^A8^A9^A10
  1. ; Where:
  1. ; CNT - Comment selection # (comments ordered by
  1. ; (date entered)
  1. ; A1 - External date/time the comment was entered
  1. ; NOTE: has a leading '+' when A8 > CLEN
  1. ; A2 - External User Name of the user who entered
  1. ; the comment
  1. ; A3 - Person Contacted
  1. ; A4 - Method of Contact
  1. ; A5 - Contact Phone #
  1. ; A6 - Call Reference #
  1. ; A7 - Authorization #
  1. ; A8 - Comment
  1. ; A9 - Patient Policy Comment IEN
  1. ; A10 - Comment Selection Number
  1. N COMMENT,DATAOUT,IENS,XX,ZZ
  1. S:'$D(FULL) FULL=0
  1. S:'$D(NOSET) NOSET=0
  1. S:'$D(CLEN) CLEN=74
  1. S IENS=COMIEN_","_IBIIEN_","_DFN_","
  1. S COMMENT=$$GET1^DIQ(2.342,IENS,.03) ; Comment Text
  1. S XX=$$GET1^DIQ(2.342,IENS,.01,"I") ; Internal Date/Time entered
  1. S ZZ=$S($L(COMMENT)>CLEN:"+",1:" ") ; Truncated Comment Indicator
  1. S DATAOUT=ZZ_$$FMTE^XLFDT($P(XX,"^",1),"2DZ")
  1. S XX=$$GET1^DIQ(2.342,IENS,.02,"I") ; IEN of Last Edited By User
  1. S ZZ=$$GET1^DIQ(200,XX,.01) ; Entered by user
  1. S $P(DATAOUT,"^",2)=$E(ZZ,1,24)
  1. S $P(DATAOUT,"^",3)=$$GET1^DIQ(2.342,IENS,.04) ; Person Contacted
  1. S ZZ=$$GET1^DIQ(2.342,IENS,.07)
  1. S $P(DATAOUT,"^",4)=$E(ZZ,1,10) ; Method of Contact
  1. S $P(DATAOUT,"^",5)=$$GET1^DIQ(2.342,IENS,.05) ; Contact Phone #
  1. S $P(DATAOUT,"^",6)=$$GET1^DIQ(2.342,IENS,.06) ; Call Reference #
  1. S $P(DATAOUT,"^",7)=$$GET1^DIQ(2.342,IENS,.08) ; Authorization #
  1. S ZZ=$S('FULL:$E(COMMENT,1,CLEN),1:COMMENT)
  1. S $P(DATAOUT,"^",8)=ZZ ; Comment
  1. S $P(DATAOUT,"^",9)=COMIEN ; IEN of the Comment
  1. S $P(DATAOUT,"^",10)=CNT ; Comment Number
  1. S:'NOSET ^TMP($J,"IBCNCHIX",CNT)=DATAOUT
  1. Q DATAOUT
  1. ;
  1. SETL(LINE,DATA,LABEL,COL,LNG) ; Creates a line of data to be set into the body
  1. ; of the worklist
  1. ; Input: LINE - Current line being created
  1. ; DATA - Information to be added to the end of the current line
  1. ; LABEL - Label to describe the information being added
  1. ; COL - Column position in line to add information add
  1. ; LNG - Maximum length of data information to include on the line
  1. ; Returns: Line updated with added information
  1. S LINE=LINE_$J("",(COL-$L(LABEL)-$L(LINE)))_LABEL_$E(DATA,1,LNG)
  1. Q LINE
  1. ;
  1. ; Protocol action to Search Patient Policy Comments for selected text
  1. ; Input: COMIN - IEN of the selected Patient Policy Comment
  1. ; Optional - Only sent when called from the expanded
  1. ; comment listman template.
  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. N FOUND,STEXT
  1. S VALMBCK="R"
  1. D FULL^VALM1
  1. S STEXT=$$GETSTXT() ; Get the text to search for
  1. I STEXT="" D Q
  1. . W !!,*7,"No search text selected."
  1. . D PAUSE^VALM1
  1. ;
  1. ; Search all of the Patient Policy Comments for the specified search text
  1. D SEARCHC(DFN,IBIIEN,STEXT,.FOUND)
  1. I 'FOUND D Q
  1. . W !!,*7,STEXT," not found in any Patient Policy Comments."
  1. . D PAUSE^VALM1
  1. ;
  1. ; Display all the Patient Policy Comments where the text was found
  1. W !!,STEXT," was found in ",FOUND," Patient Policy Comment(s)."
  1. W !,"The found text will be highlighted within each comment in the Expanded Entry"
  1. W !,"display.",!!
  1. Q:'$$ASKYN^IBCNCH("View the results now",1)
  1. D SEARCH^IBCNCH3(DFN,IBIIEN,STEXT,.FOUND)
  1. Q
  1. ;
  1. GETSTXT() ; Get the text to search for
  1. ; Input: None
  1. ; Returns: text to search for or "" if not entered
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)="F",DIR("A")="Enter the text to search for"
  1. D ^DIR
  1. Q Y
  1. ;
  1. SEARCHC(DFN,IBIIEN,STEXT,FOUND) ; Search all the Patient Policy Comments
  1. ; Input: DFN - IEN of the Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the multiple
  1. ; IEN of the selected Patient Policy
  1. ; STEXT - Text to search for
  1. ; Output: FOUND - Array of Patient Policy Comments
  1. ; FOUND - A1
  1. ; FOUND(0,CTR) - A2
  1. ; FOUND(1,A2) - CTR
  1. ; Where: A1 - Number of comments where text was found
  1. ; A2 - IEN of the comment where text was found
  1. ; CTR- Counter to put sort comments by date
  1. N CNT,COMDT,COMIEN
  1. S (CNT,FOUND)=0,COMDT=""
  1. F D Q:COMDT=""
  1. . S COMDT=$O(^DPT(DFN,.312,IBIIEN,13,"B",COMDT),-1)
  1. . Q:COMDT=""
  1. . S COMIEN=""
  1. . F D Q:COMIEN=""
  1. . . S COMIEN=$O(^DPT(DFN,.312,IBIIEN,13,"B",COMDT,COMIEN),-1)
  1. . . Q:COMIEN=""
  1. . . Q:'$$FOUNDT(DFN,IBIIEN,COMIEN,STEXT)
  1. . . S CNT=CNT+1,FOUND=FOUND+1
  1. . . S FOUND(0,CNT)=COMIEN,FOUND(1,COMIEN)=CNT
  1. Q
  1. ;
  1. FOUNDT(DFN,IBIIEN,COMIEN,STEXT) ; Search the specified comment for the
  1. ; specified text
  1. ; Input: DFN - IEN of the Patient
  1. ; IBIIEN - ^DPT(DFN,.312,IBIIEN,0) Where IBIIEN is the multiple
  1. ; IEN of the selected Patient Policy
  1. ; COMIEN - IEN of the selected Patient Policy Comment
  1. ; STEXT - Text to search for
  1. ; Returns: 1 if the STEXT was found, 0 otherwise
  1. N IENS,XX
  1. S IENS=COMIEN_","_IBIIEN_","_DFN_","
  1. S STEXT=$$UP^XLFSTR(STEXT)
  1. S XX=$$UP^XLFSTR($$GET1^DIQ(2.342,IENS,.04))
  1. I XX[STEXT Q 1 ; Search Contact Person
  1. S XX=$$UP^XLFSTR($$GET1^DIQ(2.342,IENS,.05))
  1. I XX[STEXT Q 1 ; Search Contact Phone
  1. S XX=$$UP^XLFSTR($$GET1^DIQ(2.342,IENS,.07))
  1. I XX[STEXT Q 1 ; Search Method
  1. S XX=$$UP^XLFSTR($$GET1^DIQ(2.342,IENS,.06))
  1. I XX[STEXT Q 1 ; Search Call Reference #
  1. S XX=$$UP^XLFSTR($$GET1^DIQ(2.342,IENS,.08))
  1. I XX[STEXT Q 1 ; Search Authorization #
  1. S XX=$$UP^XLFSTR($$GET1^DIQ(2.342,IENS,.03))
  1. I XX[STEXT Q 1 ; Search Comment Text
  1. Q 0
  1. ;