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

IBTRH5H.m

Go to the documentation of this file.
  1. IBTRH5H ;ALB/FA - HCSR Create 278 Request ;14-OCT-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 worklist
  1. ;
  1. ; -------------------------- Entry Points --------------------------------
  1. ; DXTYPE - Dictionary Screen function for Diagnosis Type field 356.223/.01
  1. ; HCSDFC - Dictionary Screen function for Health Care Services Delivery
  1. ; Frequency Code fields 4.07 2216/5.07
  1. ; HCSDQQ - Dictionary Screen function for Health Care Services Delivery
  1. ; Quantity Qualifier fields 4.01, 2216/5.01
  1. ; JUMPERR - Displays an error message if the user tried to ^Field jump from
  1. ; a Section or Quick View prompt
  1. ; NHOME - Nursing home filter for Service line field 2216/2.08
  1. ; ONEPD - Used to auto-file the first Provider Data file for facility
  1. ; PROVTYPE - Dictionary Screen function for Provider Type field 356.2213/.01
  1. ; SPROVTYP - Dictionary Screen function for Provider Type field 356.22168/.01
  1. ; UNITS - Dictionary Screen function for field 356.2216/1.1
  1. ;-----------------------------------------------------------------------------
  1. ;
  1. NHOME() ;EP
  1. ; Screen for the 'Nursing Home Residential Status' Dictionary field (356.2216/2.08)
  1. ; to exclude 'DA' for a Professional Service Line and 'MJ' for an Institutional
  1. ; Service Line. Always exclude 'F2"
  1. ; Input: DA(1) - IEN of the 356.22 entry being edited
  1. ; DA - IEN of the Service Line multiple being edited
  1. ; Y - Internal Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. I Y=9 Q 0 ; Other not allowed for Service line
  1. Q 1
  1. ;
  1. UNITS() ;EP
  1. ; Screen for the 'Unit or Basis For Measurement' Dictionary field (356.2216/1.1)
  1. ; to exclude 'DA' for a Professional Service Line and 'MJ' for an Institutional
  1. ; Service Line. Always exclude 'F2"
  1. ; Input: DA(1) - IEN of the 356.22 entry being edited
  1. ; DA - IEN of the Service Line multiple being edited
  1. ; Y - Internal Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. N SLTYPE
  1. S SLTYPE=$$GET1^DIQ(356.2216,DA_","_DA(1)_",",1.12,"I")
  1. I SLTYPE="P",Y="DA" Q 0
  1. I SLTYPE="I",Y="MJ" Q 0
  1. Q 1
  1. ;
  1. JUMPERR(INDENT) ;EP
  1. ; Input: INDENT - # of spaces to indent
  1. ; Optional, defaults to 0
  1. N SPACES
  1. S:'$D(INDENT) INDENT=0
  1. S SPACES=$J("",80)
  1. W !,*7,$S(INDENT:$J(SPACES,INDENT),1:"")
  1. W "^Field jumping is not allowed from this prompt",!
  1. Q
  1. ;
  1. ONEPD(IBTRIEN) ;EP
  1. ; Called from Input Template: IB ADD/EDIT 278
  1. ; Attempts to an Attending Physician Provider Data multiple into 356.22 for
  1. ; entries with a Inpatient/Outpatient Status of 'I'
  1. ; Only called if there are currently no Provider Data multiples
  1. ; Input: IBTRIEN - IEN of the selected entry
  1. ; Output: Attending Physician Provider Data multiple is filed into 356.2213
  1. ; (Potentially)
  1. ; Returns: 1 if one or more lines were added, 0 otherwise
  1. N DFN,EVDT,FDA,IEN,PROV
  1. Q:$D(^IBT(356.22,IBTRIEN,13)) 0
  1. ;
  1. Q:$$GET1^DIQ(356.22,IBTRIEN_",",.04,"I")="O" 1 ; Entry is for an appointment
  1. S DFN=$$GET1^DIQ(356.22,IBTRIEN_",",.02,"I") ; Patient DFN
  1. S EVDT=$$GET1^DIQ(356.22,IBTRIEN_",",.07,"I") ; Patient Event Date
  1. S PROV=$$ADMDFN(EVDT,DFN)
  1. Q:PROV="" 0
  1. ;
  1. ; File Attending Physician Data Multiple
  1. S PROV=PROV_";VA(200,"
  1. K FDA
  1. S FDA(356.2213,"+1,"_IBTRIEN_",",.01)=19 ; 'Attending Phys' Prov Type
  1. S FDA(356.2213,"+1,"_IBTRIEN_",",.02)=1 ; Person
  1. S FDA(356.2213,"+1,"_IBTRIEN_",",.03)=PROV ; Provider IEN
  1. D UPDATE^DIE("","FDA")
  1. Q 1
  1. ;
  1. ADMDFN(EVDT,DFN) ; Checks to see if the specified event date is for
  1. ; an admission, a scheduled admission or neither
  1. ; Input: EVDT - Fileman date/time of the admission being searched for
  1. ; DFN - IEN of the patient of the admission being searched for
  1. ; Returns: IEN of the found Attending Physician or "" if not found
  1. N FOUND,PROV,TDFN,VAIN,VAINDT,XX
  1. ;
  1. S XX=$$NOW^XLFDT(),FOUND=0,PROV=""
  1. ;
  1. ; Direct admission check
  1. I EVDT'>XX D Q PROV
  1. . S VAINDT=EVDT
  1. . D INP^VADPT
  1. . S PROV=$P($G(VAIN(11)),"^",1)
  1. ;
  1. ; Next check for a scheduled admission
  1. S IEN=""
  1. F D Q:FOUND!(IEN="")
  1. . S IEN=$O(^DGS(41.1,"C",EVDT,IEN)) ; DBIA429
  1. . Q:IEN=""
  1. . S:$P($G(^DGS(41.1,IEN,0)),"^",1)=DFN FOUND=1
  1. S:FOUND PROV=$$GET1^DIQ(41.1,IEN_",",5,"I")
  1. Q PROV
  1. Q ""
  1. ;
  1. DXTYPE() ;EP
  1. ; Called from within Input template IB ADD/EDIT 278
  1. ; Screens Diagnosis Type values based upon the Diagnosis multiple being
  1. ; added/edit
  1. ; Called from field: 356.223/.01
  1. ; Input: DA(1) - IEN of the 356.22 entry being edited
  1. ; DA - IEN of the diagnosis multiple being edited
  1. ; Y - Internal Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. N CNT,DTDIFF,ICDDT,IX,RETURN,WHICH
  1. ;
  1. S ICDDT=3151001 ; ICD-9 cut-off date
  1. S DTDIFF=$$FMDIFF^XLFDT(DT,ICDDT)
  1. I DTDIFF<0,Y<5 Q 0 ; date is prior to cut-off, only ICD-9 is allowed
  1. I DTDIFF'<0,Y>4,Y<9 Q 0 ; date is not prior to cut-off, only ICD-10 is allowed
  1. ;
  1. I Y=10 Q $S($P($G(^IBT(356.22,DA(1),0)),"^",20)=2:1,1:0) ; LOI diagnosis codes are not allowed
  1. ; Determine which multiple is being added/edited
  1. S WHICH=""
  1. I '$D(^IBT(356.22,DA(1),3,DA)) D ; New multiple being created
  1. . S WHICH=$P($G(^IBT(356.22,DA(1),3,0)),"^",3)+1
  1. I WHICH="" D ; Existing multiple being edited
  1. . S IX=0,CNT=0
  1. . F D Q:(+IX=0)!(IX=DA)
  1. . . S IX=$O(^IBT(356.22,DA(1),3,IX))
  1. . . Q:+IX=0
  1. . . S CNT=CNT+1
  1. . . I IX=DA S WHICH=CNT Q ; Skip multiple being edited
  1. I WHICH=1 Q 1 ; All entries allowed
  1. I WHICH=2 D Q RETURN ; 2nd multiple
  1. . I (Y=3)!(Y=7) S RETURN=0 Q
  1. . S RETURN=1
  1. ;
  1. ; 3rd-12th multiple
  1. I (Y=3)!(Y=7)!(Y=2)!(Y=6) Q 0
  1. Q 1
  1. ;
  1. HCSDFC() ;EP
  1. ; Called from within Input template IB ADD/EDIT 278
  1. ; Dictionary Screen for Health Care Services Delivery Frequency Code
  1. ; fields 4.07, 2216/5.07
  1. ; Input: Y - Internal Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. ;
  1. ; Check for invalid Frequency Code
  1. N IEN
  1. S IEN=$O(^IBE(365.025,"B","WE",""))
  1. I Y=IEN Q 0
  1. Q 1
  1. ;
  1. HCSDQQ() ;EP
  1. ; Called from within Input template IB ADD/EDIT 278
  1. ; Dictionary Screen for Health Care Services Delivery Quantity Qualifier
  1. ; fields 4.01, 2216/5.01
  1. ; Input: Y - Internal Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. N CDE,IEN,IENS
  1. ;
  1. ; First Get all of IENS that we want to display
  1. F CDE="DY","FL","HS","MN","VS" D
  1. . S IEN=$O(^IBE(365.016,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. Q:'$D(IENS(Y)) 0
  1. Q 1
  1. ;
  1. PROVTYPE() ;EP
  1. ; Called from within Input template IB ADD/EDIT 278
  1. ; Dictionary Screen for allowable Provider Types.
  1. ; Called from field screens 356.2213/.01
  1. ; NOTE: Duplicate entries are allowed
  1. ; Input: X - External Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. ;
  1. N CDE,IENS
  1. ; Check external values that are not allowed for 278
  1. F CDE=13,36,"1I","1P","1T","2B","DQ","GP","GW","I3","IL","L5","LR","OC","P4","P5","PR","PRP","SEP","TTP","VER","VN","X3","Y2" D
  1. . S IENS(CDE)=""
  1. Q:$D(IENS(X)) 0
  1. Q 1
  1. ;
  1. SPROVTYP() ;EP
  1. ; Called from within Input template IB ADD/EDIT 278
  1. ; Dictionary Screen for allowable Provider Types for Service Lines.
  1. ; Called from field screens 356.22168/.01
  1. ; NOTE: Duplicate entries are allowed
  1. ; Input: X - External Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. ;
  1. N CDE,IENS
  1. ; Check external values for service line 278
  1. F CDE=13,36,71,"1I","1P","2B","AAJ","DN","GP","GW","I3","IL","L5","LR","OC","P4","P5","PR","PRP","SEP","TTP","VER","VN","X3","Y2" D
  1. . S IENS(CDE)=""
  1. Q:$D(IENS(X)) 0
  1. Q 1