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

IBTRH5F.m

Go to the documentation of this file.
  1. IBTRH5F ;ALB/FA - HCSR Create 278 Request ;15-SEP-2014
  1. ;;2.0;INTEGRATED BILLING;**517**;21-MAR-94;Build 240
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;
  1. ; Contains Entry points and functions used in creating a 278 request from a
  1. ; selected entry in the HCSR Response worklist
  1. ;
  1. ; -------------------------- Entry Points --------------------------------
  1. ; SELSAPI - Allows the user to see a quick view of the currently entered
  1. ; Service Line Additional Information Lines and either pick one
  1. ; to edit, enter a new one or skip.
  1. ; SELPT - Allows the user to see a quick view of the currently entered
  1. ; Patient Event Transport Lines and either pick one to edit,
  1. ; enter a new one or skip.
  1. ; SELSTI - Allows the user to see a quick view of the currently entered
  1. ; Service Line Tooth Information Lines and either pick one to
  1. ; edit, enter a new one or skip.
  1. ;-----------------------------------------------------------------------------
  1. ;
  1. SELPT(IBTRIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Patient Transport
  1. ; multiples and allows them to select one to edit or enter a new one.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit template
  1. ; IBNEW=1 when creating a new entry
  1. N CNT,ENTNUM,FDA,IEN,H1,H2,L1,L2,MAX,PT,PTDATA,PTTYPE,RETIEN,SECT,X,XX,Y,YY
  1. S IBNEW=0,SECT="Patient Transport Information"
  1. ;
  1. ; First check for an empty Patient Transport Information Lines to delete
  1. D DELPT(IBTRIEN)
  1. ;
  1. ; Next create an array of all current Patient Transport Information lines
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,14,0)),"^",4) ; Total # of lines
  1. S MAX=$S(XX<5:"",1:"Patient Transport Information Lines")
  1. S SECT="Patient Transport Information"
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,14,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S PT=$G(^IBT(356.22,IBTRIEN,14,IEN,0))
  1. . S XX=$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S YY=$$GET1^DIQ(356.2214,IEN_","_DA_",",.01)
  1. . S YY=$E(YY,1,20)_" "
  1. . S XX=XX_$$LJ^XLFSTR(YY,22)
  1. . S YY=$$GET1^DIQ(356.2214,IEN_","_DA_",",.02)
  1. . S XX=XX_$$LJ^XLFSTR(YY,"54T")
  1. . S PTDATA(CNT)=IEN_"^"_XX
  1. ;
  1. S H1="# Type Location Name"
  1. S H2="-- -------------------- ------------------------------------------------------"
  1. S L1="The following Patient Transport Information is currently on file."
  1. S L2="Enter the # of an entry to edit, 'NEW' to add one or press Return to skip."
  1. ;
  1. ; Creating 1st Patient Transport Information Line
  1. I CNT=0 D Q $O(RETIEN(0))
  1. . W !!,"Two Patient Transport Information lines are required.",!
  1. . S PTTYPE=$$PTTYPE(IBTRIEN,1) ; Get the .01 value
  1. . S FDA(356.2214,"+1,"_IBTRIEN_",",.01)=PTTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. ;
  1. ; Creating 2nd Patient Transport Information Line
  1. I CNT=1 D Q $O(RETIEN(0))
  1. . W !!,"Two Patient Transport Information lines are required.",!!
  1. . W !,L1,!,H1,!,H2,!,$P(PTDATA(1),"^",2),!!
  1. . S PTTYPE=$$PTTYPE(IBTRIEN,1) ; Get the .01 value
  1. . S FDA(356.2214,"+2,"_IBTRIEN_",",.01)=PTTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. ;
  1. ; Next display all of the current Patient Transport Lines
  1. S XX=$$SELENT^IBTRH5D(.PTDATA,H1,H2,L1,L2,MAX,"",SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(PTDATA(XX),"^",1)
  1. . D DELPT(IBTRIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S PTTYPE=$$PTTYPE(IBTRIEN) ; Get the .01 value
  1. . I PTTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1
  1. . S XX=PTTYPE
  1. . S FDA(356.2214,"+1,"_IBTRIEN_",",.01)=PTTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(PTDATA(XX),"^",1)
  1. ;
  1. PTTYPE(IBTRIEN,REQ) ; Prompts the user to enter the .01 (Entity Identifier) field
  1. ; of the Patient Transport Information Multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; REQ - 1 if field is required
  1. ; Optional, defaults to 0
  1. ; Returns: Selected Entity Identifier or "" of not entered
  1. N ARR,DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EIS,ERR,IX,X,XX,YY
  1. PTTYPE1 ; Looping tag
  1. S:'$D(REQ) REQ=0
  1. S EIS="",IX=0
  1. F D Q:'+IX
  1. . S IX=$O(^IBT(356.22,IBTRIEN,14,IX))
  1. . Q:+IX=0
  1. . S XX=$P(^IBT(356.22,IBTRIEN,14,IX,0),"^",1)
  1. . S EIS=$S(EIS="":XX,1:EIS_"^"_XX)
  1. S DA(1)=IBTRIEN
  1. S:EIS'="" EIS="^"_EIS_"^"
  1. D FIELD^DID(356.2214,.01,,"POINTER","ARR","ERR")
  1. S DIR("A")=" Ambulance Location Qualifier: "
  1. S XX=""
  1. F IX=1:1:$L(ARR("POINTER"),";") D
  1. . S YY=$P(ARR("POINTER"),";",IX)
  1. . Q:EIS[("^"_$P(YY,":",1)_"^")
  1. . S XX=$S(XX="":YY,1:XX_";"_YY)
  1. S DIR(0)=$S(REQ:"SA^",1:"SOA^")_XX
  1. D ^DIR
  1. I REQ,$D(DIRUT) D G PTTYPE1
  1. . W !,*7," Entity Identifier is required.",!!
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;
  1. DELPT(IBTRIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Patient Transport Information Line and didn't enter any data for it OR
  1. ; selected a line to delete. If so, the Patient Transport Information Line with
  1. ; no data (or selected) is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty (or selected) Patient Transport Information line is deleted (Potentially)
  1. N DA,DIK,PTIEN,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(1)=IBTRIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(1),14,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S PTIEN=+$P($G(^IBT(356.22,IBTRIEN,14,0)),"^",3) ; Last Multiple IEN
  1. Q:'PTIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,14,PTIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(1)=IBTRIEN,DA=PTIEN
  1. S DIK="^IBT(356.22,DA(1),14,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. SELSAPI(IBTRIEN,SIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Service Line
  1. ; Additional Patient Information multiples and allows them to select one to
  1. ; edit or enter a new one.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - IEN of the service line multiple being edited
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit multiple
  1. ; IBNEW=1 when creating a new entry
  1. N AIDATA,CNT,ENTNUM,FDA,IEN,IENS,H1,H2,L1,L2,MAX,RETIEN,RTYPE,SECT,X,XX,Y,YY
  1. S IBNEW=0,SECT="Service Additional Patient Information"
  1. ;
  1. ; First check for an empty Additional Patient Information Line to delete
  1. D DELSAPI(IBTRIEN,SIEN)
  1. ;
  1. ; Next create an array of all current Additional Patient
  1. ; Information lines to display
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,16,SIEN,6,0)),"^",4) ; Total # of API Lines
  1. S MAX=$S(XX<10:"",1:"Additional Patient Information Lines")
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,16,SIEN,6,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=" "_$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S IENS=IEN_","_SIEN_","_IBTRIEN_","
  1. . S YY=$$GET1^DIQ(356.22166,IENS,.01) ; Report Type Desc
  1. . S YY=$E(YY,1,26)_" "
  1. . S XX=XX_$$LJ^XLFSTR(YY,28)
  1. . S YY=$$GET1^DIQ(356.22166,IENS,.02) ; Delivery Method
  1. . S YY=$E(YY,1,20)_" "
  1. . S XX=XX_$$LJ^XLFSTR(YY,23)
  1. . S YY=$$GET1^DIQ(356.22166,IENS,.03) ; Attachment Ctrl #
  1. . S YY=$E(YY,1,22)
  1. . S XX=XX_$$LJ^XLFSTR(YY,22)
  1. . S AIDATA(CNT)=IEN_"^"_XX
  1. ;
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . W !!," No Additional Patient Information is currently on file.",!
  1. . S XX=$$ASKNEW^IBTRH5D(" Add Additional Patient Information","NO")
  1. . Q:XX<0
  1. . S RTYPE=$$RTYPE(IBTRIEN,SIEN) ; Get the .01 value
  1. . I RTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1,XX=RTYPE
  1. . S FDA(356.22166,"+1,"_SIEN_","_IBTRIEN_",",.01)=RTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. ;
  1. ; Next display all of the current Additional Patient Information
  1. S H1=" # Report Type Delivery Method Attachment Control #"
  1. S H2=" -- -------------------------- --------------------- ----------------------"
  1. S L1=" The following Additional Patient Information is currently on file."
  1. S L2=" Enter the # of an entry to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT^IBTRH5D(.AIDATA,H1,H2,L1,L2,MAX,1,SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(AIDATA(XX),"^",1)
  1. . D DELSAPI(IBTRIEN,SIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S RTYPE=$$RTYPE(IBTRIEN,SIEN) ; Get the .01 value
  1. . I RTYPE="" S XX=-1 Q ; None entered
  1. . S XX=RTYPE
  1. . S IBNEW=1
  1. . S FDA(356.22166,"+1,"_SIEN_","_IBTRIEN_",",.01)=RTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(AIDATA(XX),"^",1)
  1. ;
  1. DELSAPI(IBTRIEN,SIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Additional Patient Information Line and didn't enter any data for it or selected
  1. ; a line to be deleted. If so, the empty or selected Additional Patient Information
  1. ; line is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - IEN of the Service Line being edited
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty or selected Additional Patient Information line is deleted (Potentially)
  1. N APIIEN,DA,DIK,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(2)=IBTRIEN,DA(1)=SIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(2),16,DA(1),6,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S APIIEN=+$P($G(^IBT(356.22,IBTRIEN,16,SIEN,11,0)),"^",3) ; Last Multiple IEN
  1. Q:'APIIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,16,SIEN,6,APIIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(2)=IBTRIEN,DA(1)=SIEN,DA=APIIEN
  1. S DIK="^IBT(356.22,DA(2),16,DA(1),6,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. RTYPE(IBTRIEN,SIEN) ; Prompts the user to enter the .01 (Report Type) field of the
  1. ; Additional Patient Information multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - IEN of the Service Line
  1. ; Returns: IEN of the selected Report Type or "" of not entered
  1. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DA(2)=IBTRIEN,DA(1)=SIEN
  1. S DIR(0)="356.22166,.01",DIR("A")=" Report Type"
  1. D ^DIR
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;
  1. SELSTI(IBTRIEN,SIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Service Line Tooth
  1. ; Information multiples and allows them to select one to edit or enter a new
  1. ; one.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - Service Line Multiple IEN
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit multiple
  1. ; IBNEW=1 when creating a new entry
  1. N CNT,ENTNUM,TDATA,IEN,H1,H2,IEN,IENS,L1,L2,MAX,RETIEN,SECT,TIDATA,TTYPE,X,XX,Y,YY
  1. S IBNEW=0,SECT="Tooth Information"
  1. ;
  1. ; First check for an empty Additional Patient Information Line to delete
  1. D DELSTI(IBTRIEN,SIEN)
  1. ;
  1. ; Next create an array of all current Service Line Tooth Information Lines
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,16,SIEN,4,0)),"^",4) ; Total # of multiples
  1. S MAX=$S(XX<32:"",1:"Tooth Information Lines")
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,16,SIEN,4,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=" "_$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S IENS=IEN_","_SIEN_","_IBTRIEN_","
  1. . S YY=$$GET1^DIQ(356.22164,IENS,.01,"I") ; Tooth Code (External)
  1. . S YY=$$GET1^DIQ(356.022,YY_",",.01) ; Tooth Code
  1. . S XX=XX_$$LJ^XLFSTR(YY,7)
  1. . S YY=$$GET1^DIQ(356.22164,IENS,.02) ; Tooth Surface #1
  1. . S XX=XX_$$LJ^XLFSTR(YY,12)
  1. . S YY=$$GET1^DIQ(356.22164,IENS,.03) ; Tooth Surface #2
  1. . S XX=XX_$$LJ^XLFSTR(YY,12)
  1. . S YY=$$GET1^DIQ(356.22164,IENS,.04) ; Tooth Surface #3
  1. . S XX=XX_$$LJ^XLFSTR(YY,12)
  1. . S YY=$$GET1^DIQ(356.22164,IENS,.05) ; Tooth Surface #4
  1. . S XX=XX_$$LJ^XLFSTR(YY,12)
  1. . S TIDATA(CNT)=IEN_"^"_XX
  1. ;
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . W !!," No Additional Patient Information is currently on file.",!
  1. . S XX=$$ASKNEW^IBTRH5D(" Add Tooth Information")
  1. . Q:XX<0
  1. . S TTYPE=$$TTYPE(IBTRIEN,SIEN) ; Get the .01 value
  1. . I TTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1,XX=TTYPE
  1. . S FDA(356.22164,"+1,"_SIEN_","_IBTRIEN_",",.01)=TTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. ;
  1. ; Next display all of the current Tooth Information lines and let the user select one
  1. S H1=" # Tooth Surface #1 Surface #2 Surface #3 Surface #4"
  1. S H2=" -- ----- ---------- ---------- ---------- ----------"
  1. S L1=" The following Tooth Information Lines are currently on file."
  1. S L2=" Enter the # of a Line to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT^IBTRH5D(.TIDATA,H1,H2,L1,L2,MAX,1,SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(TIDATA(XX),"^",1)
  1. . D DELSTI(IBTRIEN,SIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S TTYPE=$$TTYPE(IBTRIEN,SIEN) ; Get the .01 value
  1. . I TTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1
  1. . S XX=TTYPE
  1. . S FDA(356.22164,"+1,"_SIEN_","_IBTRIEN_",",.01)=TTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(TIDATA(XX),"^",1)
  1. ;
  1. DELSTI(IBTRIEN,SIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Tooth Information Line and didn't enter any data for it OR selected a line
  1. ; to be deleted. If so, the Additional Tooth Information line with no data
  1. ; (or selected) is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - IEN of the Service Line being edited
  1. ; Output: Empty (or selected) Tooth Information line is deleted (Potentially)
  1. N DA,DIK,TIIEN,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(2)=IBTRIEN,DA(1)=SIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(2),16,DA(1),4,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S TIIEN=+$P($G(^IBT(356.22,IBTRIEN,16,SIEN,4,0)),"^",3) ; Last Multiple IEN
  1. Q:'TIIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,16,SIEN,4,TIIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(2)=IBTRIEN,DA(1)=SIEN,DA=TIIEN
  1. S DIK="^IBT(356.22,DA(2),16,DA(1),4,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. TTYPE(IBTRIEN,SIEN) ; Prompts the user to enter the .01 (Tooth) field of the
  1. ; Tooth Information multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - IEN of the Service Line
  1. ; Returns: IEN of the selected Tooth Type or "" of not entered
  1. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DA(2)=IBTRIEN,DA(1)=SIEN
  1. S DIR(0)="356.22164,.01",DIR("A")=" Tooth Code"
  1. D ^DIR
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;