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

IBTRH5I.m

Go to the documentation of this file.
  1. IBTRH5I ;ALB/FA - HCSR Create 278 Request ;18-NOV-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. ; COMQUAL - Dictionary screen for Requester Contact Qualifier fields
  1. ; CONTINFO - Retrieves Contact related information
  1. ; CRT278 - Allows the user to create a new 278 request for the selected
  1. ; entry in the HCSR Response worklist
  1. ; PERSON - Determines if the specified Provider is a Person or Non/Person
  1. ; PDATA - Retrieves the specified Provider's NPI and taxonomy numbers
  1. ; REFDATA - Retrieves the Previous Authorization and Reference Numbers for
  1. ; the specified entry.
  1. ; REQMISS - Checks for missing required fields in a request
  1. ; SEND278 - Prompts the user to send a brief 278 transmission
  1. ; SVCTYPE - Dictionary Screen for Service Type 2.03 and 356.2216,.03
  1. ; TIMEPDQ - Dictionary Screen for Time Period Qualifier, 4.05
  1. ; UDREASN - Dictionary Screen for UMO Denial Reasons
  1. ;-----------------------------------------------------------------------------
  1. ;
  1. CONTINFO(IBTRIEN,CNARY) ;EP
  1. ; Retrieves Contact related information for the specified entry
  1. ; Input: IBTRIEN - IEN of the entry to retrieve information from
  1. ; Output: CNARY - Array of populated information
  1. N NODE19,QUAL,Z
  1. S NODE19=$G(^IBT(356.22,IBTRIEN,19))
  1. F Z="19.01^2^20","19.02^3^21","19.03^4^22" D
  1. . S QUAL=$$EXTERNAL^DILFD(356.22,$P(Z,"^",1),,$P(NODE19,"^",$P(Z,"^",2)))
  1. . I QUAL'="" S CNARY(QUAL)=$G(^IBT(356.22,IBTRIEN,$P(Z,"^",3)))
  1. Q
  1. ;
  1. SEND278() ;EP
  1. ; Called from the input template to allow the user to send a brief 278 request
  1. ; transmission, continue answering all questions in the template or skip to
  1. ; Service level information
  1. ; Input: None
  1. ; Returns: 0 - User either wants to send a brief 278 or exit the input
  1. ; template
  1. ; 255 - User tried to field jump
  1. ; 1 - User wants to continue entering info
  1. ; 1400 - User wants to skip to Service Detail Information
  1. I +$P($G(^IBT(356.22,DA,16,0)),U,4) Q 1 ; data already entered for service lines. don't let them use short cut to send.
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,SEL,XX
  1. S XX="^Y:YES;N:NO;S:SKIP"
  1. S DIR(0)="SAO"_XX,DIR("A")="Send 278 Request w/o Additional Info? "
  1. S XX="Select YES to transmit a basic 278 Request now. Select No to enter"
  1. S XX=XX_" additional data before transmitting the 278 Request. Enter S to"
  1. S XX=XX_" skip to Service Line Detail."
  1. S DIR("?")=XX
  1. D ^DIR
  1. I X?1"^"1.E D JUMPERR^IBTRH5H Q "@260"
  1. S Y=$S($D(DUOUT):0,Y="Y":0,Y="N":"@270",Y="S":"@1400",1:"@270")
  1. Q Y
  1. ;
  1. SVCTYPE() ;EP
  1. ; Dictionary Screen function called from fields: 2.03 and 356.2216,.03
  1. ; Screens some specific entries from 365.013
  1. ; Input: DA - IEN of the 356.22 entry being edited
  1. ; 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. ; First Get all of IENS that we want to filter out
  1. F CDE=9,10,13,19,22,30,32,34,41,43,47,48,49,50,51,52,53,55,57,58,59,60,81,89 D
  1. . S IEN=$O(^IBE(365.013,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. F CDE=90,81,91,92,94,95,96,97,98,99,"A0","A1","A2","A3","A5","A7","A8","AA","AB" D
  1. . S IEN=$O(^IBE(365.013,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. F CDE="AC","AH","AM","AN","AO","AQ","B2","B3","BA","BH","BI","BJ","BK","BM","BR" D
  1. . S IEN=$O(^IBE(365.013,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. F CDE="BT","BU","BV","BW","BX","CA","CB","CC","CD","CE","CF","CG","CH","CI" D
  1. . S IEN=$O(^IBE(365.013,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. F CDE="CJ","CK","CL","CM","CN","CO","CP","DG","DM","DS","GF","GN","UC" D
  1. . S IEN=$O(^IBE(365.013,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. Q:$D(IENS(Y)) 0
  1. Q 1
  1. ;
  1. UDREASN(FIELD) ;EP
  1. ; Dictionary Screen function called from fields: 356.2215,.03, 356.2215,.04
  1. ; 356.2215,.05, 356.2215,.06.
  1. ; Prevents Duplicate UMO Denial Reasons
  1. ; Input: FIELD - Field being checked
  1. ; DA(1) - IEN of the 356.22 entry being edited
  1. ; DA - IEN of the UMO multiple
  1. ; Y - Internal Value of the user response
  1. ; Returns: 1 - Data input by the user is valid, 0 otherwise
  1. N NDE,RET,Z
  1. S RET=1 ; Assume Valid Input
  1. Q:Y="" 1 ; No value entered
  1. S NDE=$G(^IBT(356.22,DA(1),15,DA,0))
  1. ; Make sure there are no duplicates
  1. I FIELD=.03 D Q RET
  1. . F Z=4,5,6 D CHK(Z)
  1. I FIELD=.04 D Q RET
  1. . F Z=3,5,6 D CHK(Z)
  1. I FIELD=.05 D Q RET
  1. . F Z=3,4,6 D CHK(Z)
  1. I FIELD=.06 D Q RET
  1. . F Z=3,4,5 D CHK(Z)
  1. Q RET
  1. ;
  1. CHK(NUM) ;
  1. I $P(NDE,"^",NUM)=Y S RET=0 Q
  1. Q
  1. ;
  1. TIMEPDQ() ;EP
  1. ; Dictionary Screen function called from Time Period Qualifier, fields: 4.05,
  1. ; 356.2216/5.05
  1. ; Screens some specific entries from 365.015
  1. ; Input: DA - IEN of the 356.22 entry being edited
  1. ; 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. ; First Get all of IENS that we want to filter out
  1. F CDE=13,22,23,24,25,28,30,31,32,33,36 D
  1. . S IEN=$O(^IBE(365.015,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. Q:$D(IENS(Y)) 0
  1. Q 1
  1. ;
  1. PDATA(PROV) ; EP
  1. ; Retrieves the NPI and Taxonomy codes for the requested Provider
  1. ; PROV - Provider to retrieve codes for
  1. ; Output: NPI^Taxonomy number
  1. N XX,ZZ
  1. S ZZ=$$PRVDATA^IBTRHLO2(+$P(PROV,";",1),$P($P(PROV,"(",2),",",1))
  1. S XX=$$GTXNMY^IBTRH3(PROV)
  1. S XX=$P(XX,"^",1)_"^"_$P(ZZ,"^",7)
  1. Q XX
  1. ;
  1. REFDATA(IBTRIEN) ;EP
  1. ; Input: IBTRIEN - IEN of the entry being checked
  1. N REFINFO,RIEN,XX
  1. S XX=$G(^IBT(356.22,IBTRIEN,0)),REFINFO=""
  1. S RIEN=$P(XX,"^",19)
  1. Q REFINFO
  1. ;
  1. REQMISS(IBTRIEN,IBEXIT) ;EP
  1. ; Checks to see if all required fields in the request
  1. ; been answered and the user did not '^' the input template
  1. ; Input: IBTRIEN - IEN of the entry being checked
  1. ; IBEXIT - 0 if user '^' exited the template, 1 otherwise
  1. ; Returns: 0 if all required fields have been entered and no '^' exit
  1. ; 1 if missing required fields and/or '^' exit. All missing fields
  1. ; will be displayed in a warnings message.
  1. N CTC,IENS,MISSING,XX,YY,YY1,YY2,TYPE
  1. S MISSING=0,IENS=IBTRIEN_","
  1. I $$GET1^DIQ(356.22,IENS,2.01,"I")="" D
  1. . D MISSING("Request Category","Request Category is required and does not have a value entered.")
  1. S CTC=$$GET1^DIQ(356.22,IENS,2.02,"I") I CTC="" D
  1. . D MISSING("Certification Type Code","Certification Type Code is required and does not have a value entered.")
  1. S XX=$O(^IBT(356.22,IBTRIEN,16,0)) ; Check for a service line
  1. I XX="" D
  1. . I $$GET1^DIQ(356.22,IENS,2.03,"I")="" D ; No Service Line and No Service Type
  1. .. D MISSING(2.03,"Service Type is required if no Service Lines were entered.")
  1. . S TYPE=$$GET1^DIQ(356.22,IENS,2.04,"I") I TYPE="" D ; No Service Line(s) and no Facility Type Qualifier
  1. .. D MISSING(2.04,"Service Location Qualifier is required if no Service Lines are entered.")
  1. . I TYPE'="A",$$GET1^DIQ(356.22,IENS,2.05,"I")="" D ; No Service Line(s) and no Facility Type
  1. .. D MISSING(2.05,"Service Location is required if no Service Lines are entered.")
  1. . I TYPE="A" D
  1. .. I $$GET1^DIQ(356.22,IENS,2.06,"I")="" D MISSING(2.06,"Location of Care is required if no Service Lines are entered and Facility Type is 'A'")
  1. .. I $$GET1^DIQ(356.22,IENS,2.07,"I")="" D MISSING(2.07,"Bill Classification is required if no Service Lines are entered and Facility Type is 'A'")
  1. ;
  1. D REQMISS^IBTRH5J ;additional required fields checking 12/11/14 JWS
  1. ;
  1. ; If Home Health Care Information Home Health Start date is entered, then
  1. ; Prognosis must be defined and we must have a Principal Diagnosis and Date.
  1. I $$GET1^DIQ(356.22,IENS,10.01,"I")'="" D
  1. . I $$GET1^DIQ(356.22,IENS,2.15,"I")="" D
  1. .. S MISSING=MISSING+1
  1. .. S XX="Prognosis is required if Home Health Start Date is defined."
  1. .. S MISSING("Prognosis")=XX
  1. . I '$D(^IBT(356.22,IBTRIEN,3)) D MISSING("Diagnosis","A Principal Diagnosis and Date must be entered for Home Health Care service.")
  1. ; Check for Diagnosis values
  1. I $D(^IBT(356.22,IBTRIEN,3)) D DIAGMISS(IBTRIEN,.MISSING)
  1. ; Check for a Procedure on every Service line
  1. I $D(^IBT(356.22,IBTRIEN,16)) D SVCMISS(IBTRIEN,.MISSING)
  1. ; Check for Attending Physician line for Inpatient entries
  1. D ATTMISS(IBTRIEN,.MISSING)
  1. ; User completed the entire template and no require fields are missing
  1. I IBEXIT,'MISSING Q 0
  1. W !!
  1. I 'IBEXIT D
  1. . W !,*7,"'^' exit from the template has been detected. You must complete"
  1. . W !,"the entire 278 request before sending it. Currently entered information"
  1. . W !,"has been saved. Use the SR action to finish entering data to send the request."
  1. I MISSING D
  1. . W !!,*7,"The following required fields are missing or incorrect:"
  1. . S XX=""
  1. . F D Q:XX=""
  1. .. S XX=$O(MISSING(XX))
  1. .. Q:XX=""
  1. .. I MISSING(XX)="" W !,XX Q
  1. .. N TEXT,XX1
  1. .. D FSTRNG^IBJU1(MISSING(XX),76,.TEXT)
  1. .. S XX1="" F S XX1=$O(TEXT(XX1)) Q:XX1="" W !,TEXT(XX1)
  1. .. ;W !,MISSING(XX)
  1. . I IBEXIT D
  1. .. W !!,"A 278 request cannot be sent with missing required fields."
  1. .. I $G(IBTRENT)=1 W !,"Use the AD action to enter required data" Q
  1. .. W !,"Currently entered information has been saved. Use the SR action to finish"
  1. .. W !,"entering data to send the request."
  1. Q 1
  1. ;
  1. DIAGMISS(IBTRIEN,MISSING) ; Checks for Diagnosis information when Home Health
  1. ; Start Date been defined
  1. ; Input: IBTRIEN - IEN of the entry being checked
  1. ; MISSING - Current array and count of missing required fields
  1. ; Output: MISSING - Updated array and count of missing required fields
  1. ; Note: Only called if the Prognosis code (2.03) has a value
  1. N DXCODE,DXDATE,DXTYPE,XX,YY,XX1,START
  1. S XX=0,START=$O(^IBT(356.22,IBTRIEN,3,0))
  1. F S XX=$O(^IBT(356.22,IBTRIEN,3,XX)) Q:XX'=+XX D
  1. . S DXTYPE=$$GET1^DIQ(356.223,XX_","_IBTRIEN_",",.01,"I")
  1. . S DXCODE=$$GET1^DIQ(356.223,XX_","_IBTRIEN_",",.02,"I")
  1. . S DXDATE=$$GET1^DIQ(356.223,XX_","_IBTRIEN_",",.03,"I")
  1. . I DXTYPE="" D
  1. .. I XX=START,$$GET1^DIQ(356.22,IENS,10.01,"I")'="" S XX1="Diagnosis entry number "_XX_" Diagnosis Type must be defined if Home Health Start Date is defined."
  1. .. E S XX1="Diagnosis entry number "_XX_" Diagnosis Type is required."
  1. .. S MISSING=MISSING+1,MISSING("Diagnosis Type "_XX)=XX1
  1. . I DXCODE="" D
  1. .. I XX=START,$$GET1^DIQ(356.22,IENS,10.01,"I")'="" S XX1="Diagnosis entry number "_XX_" Diagnosis Code must be defined if Home Health Start Date is defined."
  1. .. E S XX1="Diagnosis entry number "_XX_" Diagnosis Code is required."
  1. .. S MISSING=MISSING+1,MISSING("Diagnosis Code "_XX)=XX1
  1. . I DXDATE="",XX=START,$$GET1^DIQ(356.22,IENS,10.01,"I")'="" D
  1. .. S XX1="Diagnosis Date Known must be defined if Home Health Start Date is defined."
  1. .. S MISSING=MISSING+1,MISSING("Diagnosis Date Known "_XX)=XX1
  1. . I DXTYPE'="",DXTYPE'=3,DXTYPE'=7,XX=START,$$GET1^DIQ(356.22,IENS,10.01,"I")'="" D
  1. .. S YY=$$GET1^DIQ(356.223,XX_","_IBTRIEN_",",.01)
  1. .. S XX="Diagnosis Type: '"_YY_"' must be 'Principal Diagnosis'"
  1. .. S MISSING=MISSING+1,MISSING("Diagnosis Type")=XX
  1. Q
  1. ;
  1. SVCMISS(IBTRIEN,MISSING) ; Checks for a Procedure code on every Service Line
  1. ; Input: IBTRIEN - IEN of the entry being checked
  1. ; MISSING - Current array and count of missing required fields
  1. ; Output: MISSING - Updated array and count of missing required fields
  1. N PCODE,PTYP,SIEN,XX,YY,TYPE,REV,UNIT,COUNT
  1. S SIEN=0
  1. F D Q:+SIEN=0
  1. . S SIEN=$O(^IBT(356.22,IBTRIEN,16,SIEN))
  1. . Q:+SIEN=0
  1. . S YY="Service Line #"_$$SLINE(IBTRIEN,SIEN)
  1. . S PTYPE=$$GET1^DIQ(356.2216,SIEN_","_IBTRIEN_",",1.01,"I")
  1. . I PTYPE="N4" S PCODE=$$GET1^DIQ(356.2216,SIEN_","_IBTRIEN_",",12.01,"I")
  1. . E S PCODE=$$GET1^DIQ(356.2216,SIEN_","_IBTRIEN_",",1.02,"I")
  1. . S TYPE=$$GET1^DIQ(356.2216,SIEN_","_IBTRIEN_",",1.12,"I")
  1. . S REV=$$GET1^DIQ(356.2216,SIEN_","_IBTRIEN_",",2.06,"I")
  1. . I PTYPE="" D
  1. .. I TYPE="I",REV'="" Q ; for Institutional Lines, Service Line Revenue Code may be used instead of Proc Code
  1. .. S XX=YY_" is missing the Procedure Coding Method"
  1. .. S MISSING=MISSING+1,MISSING(YY_" A")=XX
  1. . I PCODE="" D
  1. .. I TYPE="I",REV'="" Q ; for Institutional Lines, Service Line Revenue Code may be used instead of Proc Code
  1. .. S XX=YY_" is missing the Procedure Code"
  1. .. S MISSING=MISSING+1,MISSING(YY_" B")=XX
  1. . I TYPE'="D" D ;Dental lines do not have Unit Count or Unit Measurement Indicator
  1. .. S UNIT=$$GET1^DIQ(356.2216,SIEN_","_IENS,1.1),COUNT=$$GET1^DIQ(356.2216,SIEN_","_IENS,1.11)
  1. .. I (UNIT=""&(COUNT'=""))!(UNIT'=""&(COUNT="")) D ;If either Unit Measurement Code or Service Unit Count exist, both are required
  1. ... I UNIT="" D MISSING(YY_" C",YY_" is missing the Units Count measurement indicator.") Q
  1. ... D MISSING(YY_" D",YY_" is missing the Unit Count for the service.")
  1. . S UNIT=$$GET1^DIQ(356.2216,SIEN_","_IENS,5.01),COUNT=$$GET1^DIQ(356.2216,SIEN_","_IENS,5.02)
  1. . I (UNIT=""&(COUNT'=""))!(UNIT'=""&(COUNT="")) D ;If either HCSD Quant Qual or HCSD Serv Unit Count exits, both are required
  1. .. I UNIT="" D MISSING(YY_" E",YY_" is missing the HCSD Quantity Qualifier for this service line.") Q
  1. .. D MISSING(YY_" F",YY_" is missing the HCSD Service Unit Count for this service line.")
  1. . I $$GET1^DIQ(356.2216,SIEN_","_IENS,5.05)="",$$GET1^DIQ(356.2216,SIEN_","_IENS,5.06)'="" D
  1. .. D MISSING(YY_" G",YY_" is missing the HCSD Time Period Qualifier value that describes the HCSD Perdio Count.")
  1. . I $D(^IBT(356.22,IBTRIEN,16,SIEN,4)) D
  1. .. N TOO
  1. .. S TOO=0 F S TOO=$O(^IBT(356.22,IBTRIEN,16,SIEN,4,TOO)) Q:TOO'=+TOO D
  1. ... I $$GET1^DIQ(356.22164,TOO_","_SIEN_","_IENS,.01)="" D MISSING(YY_" Tooth "_TOO,YY_" Tooth multiple "_TOO_" is missing the required Tooth Code.")
  1. . I $D(^IBT(356.22,IBTRIEN,16,SIEN,6)) D
  1. .. N AT
  1. .. S AT=0 F S AT=$O(^IBT(356.22,IBTRIEN,16,SIEN,6,AT)) Q:AT'=+AT D
  1. ... I $$GET1^DIQ(356.22166,AT_","_SIEN_","_IENS,.01)="" D MISSING(YY_" Attachments .01"_AT,YY_" Attachment multiple "_AT_" is missing the required Report Type Code.")
  1. ... I $$GET1^DIQ(356.22166,AT_","_SIEN_","_IENS,.02)="" D MISSING(YY_" Attachments .02"_AT,YY_" Attachment multiple "_AT_" is missing the required Report Transmission Code.")
  1. Q
  1. ;
  1. SLINE(IBTRIEN,SIEN) ; Returns the Service line number for a line
  1. ; Input: IBTRIEN - IEN of the entry being checked
  1. ; SIEN - IEN of the service line being checked
  1. ; Returns: Service line number
  1. N CNT,IEN
  1. S (CNT,IEN)=0
  1. F D Q:+IEN=0!(SIEN=IEN)
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,16,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. Q CNT
  1. ;
  1. ATTMISS(IBTRIEN,MISSING) ; Checks for an Attending Physician multiple for
  1. ; inpatient entries
  1. ; Input: IBTRIEN - IEN of the entry being checked
  1. ; MISSING - Current array and count of missing required fields
  1. ; Output: MISSING - Updated array and count of missing required fields
  1. N DXCODE,DXDATE,DXTYPE,FOUND,IEN,XX,YY
  1. Q:$$GET1^DIQ(356.22,IBTRIEN_",",.04,"I")="O" ; Outpatient entry
  1. S (FOUND,IEN)=0
  1. F D Q:+IEN=0!FOUND
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,13,IEN))
  1. . Q:+IEN=0
  1. . S XX=$$GET1^DIQ(356.2213,IEN_","_IBTRIEN_",",.01,"I")
  1. . S XX=$$GET1^DIQ(365.022,XX_",",.01,"I")
  1. . Q:XX'=71
  1. . S:$$GET1^DIQ(356.2213,IEN_","_IBTRIEN_",",.03,"I")'="" FOUND=1
  1. Q:FOUND
  1. ;
  1. S XX="Attending Physician must be defined for inpatient entries"
  1. S MISSING=MISSING+1,MISSING("Attending Physician")=XX
  1. Q
  1. ;
  1. PERSON(PROV) ;EP
  1. ; Checks to see if the specified Provider Type PTYPE is a Person or Non-Person
  1. ; Input: PROV - IEN of the Provider
  1. ; Output: 1 if PROV is a Person, 2 - Otherwise
  1. N PTYPE,XX
  1. S XX=$P(PROV,";",2) ; What file is it filed in?
  1. I XX="VA(200," Q 1
  1. I XX="DIC(4," Q 2
  1. S XX=$P(PROV,";",1)
  1. S PTYPE=$$GET1^DIQ(355.93,XX_",",.02,"I")
  1. Q:PTYPE=2 1
  1. Q 2
  1. ;
  1. CRT278(IBTRIEN) ;EP
  1. ; Creates a 278 Request for the selected worklist event
  1. ; Input: IBTRIEN - Internal IEN of the selected event
  1. ; Output: 278 Request created for the selected worklist event.
  1. ; Returns: 1 - if the user exited 'normally', 0 if user '^' exited
  1. N CNARY,DA,DIE,DFN,DR,DTOUT,IBBACK,IBCCAT,IBCERTCD,IBDISDT,IBDXCTR,IBEVDT
  1. N IBEXIT,IBFILT,IBMLN,IBNEW,IBOXYET,IBREQCAT,IBRESP,IBPSTAT,IBSSTYP,IBSTYP,IBTEMP
  1. N IBUPOUT,NODE19,PATLINE,VADM,X,XX,XX2,Y,YY,Z
  1. ; New special effects characters
  1. N IOHTS,IOHUP,IOICH,IOIND,IOINH,IOINLOW,IOINORM,IOINSERT,IOIRM0,IOIRM1
  1. N IOKP0,IOKP1,IOPK2,IOPK3,IOKP4,IOKP5,IOREMOVE,IORESET,IORLF,IORVOFF,IORVON
  1. N IOSC,IOSELECT,IOSGR0,IOSMPLX,IOSTBM,IOSWL,IOTBC,IOTBCALL,IOUOFF,IOUON,IOUPAR
  1. S DA=IBTRIEN,DIE=356.22,DR="[IB ADD/EDIT 278]",IBUPOUT=0
  1. S NODE19=$G(^IBT(356.22,IBTRIEN,19))
  1. ; Set-up special effects characters (next 3 lines)
  1. D HOME^%ZIS
  1. S X="IORVON;IORVOFF"
  1. D ENS^%ZISS
  1. D FULL^VALM1
  1. ; Set up Patient Data line
  1. S DFN=$$GET1^DIQ(356.22,IBTRIEN_",",.02,"I")
  1. S Z=""
  1. I +$G(DFN) D
  1. . D DEM^VADPT
  1. . S PATLINE="Patient: "_$E(VADM(1),1,28),Z=Z_$J("",35-$L(Z))_$P(VADM(2),"^",2)
  1. . S PATLINE=PATLINE_" DOB: "_$P(VADM(3),"^",2)_" AGE: "_VADM(4)
  1. W @IOF
  1. ; Set 'in-progress mark'
  1. I $$STATUS^IBTRH2(IBTRIEN)="0" D PRMARK1^IBTRH1(IBTRIEN,"01")
  1. ; Set Initial Values
  1. S IBRESP=$P($G(^IBT(356.22,IBTRIEN,0)),"^",18) ; 1 - Created from Response
  1. S IBOXYET=$$OXYET^IBTRH5C(IBTRIEN) ; Oxygen Equip Type 'D' or 'E'
  1. S IBPSTAT=$$GET1^DIQ(356.22,IBTRIEN_",",.04,"I") ; Patient Status of the entry
  1. S IBEVDT=$$GET1^DIQ(356.22,IBTRIEN_",",.07,"I") ; Internal Event Date, which may be a range.
  1. S IBDISDT=$P(IBEVDT,"-",2) ; Grab second "-" piece for Discharge Date.
  1. S IBEVDT=$P(IBEVDT,"-",1) ; Grab first "-" piece for Event Date.
  1. I IBPSTAT="I" D
  1. . I IBDISDT'="" S IBDISDT=$$FMTE^XLFDT(IBDISDT,"5Z") Q
  1. . S IBDISDT=$$GET1^DIQ(356.22,IBTRIEN_",",2.22,"I")
  1. . I IBDISDT'="" S IBDISDT=$$FMTE^XLFDT(IBDISDT,"5Z") Q
  1. . ; Attempt to pull discharge date from Patient Movement file.
  1. . N VAIP
  1. . S VAIP("D")=IBEVDT
  1. . D IN5^VADPT
  1. . S IBDISDT=$G(VAIP(17,1))
  1. . I IBDISDT="" Q
  1. . S IBDISDT=$$FMTE^XLFDT(IBDISDT,"5Z")
  1. S IBEVDT=$$FMTE^XLFDT(IBEVDT,"5Z") ; Format Event Date
  1. K DUOUT
  1. D ^DIE
  1. S XX=$S(IBUPOUT:0,$D(Y):0,1:1) ; Detect '^' exit
  1. I 'XX,"^01^03^"[(U_$$STATUS^IBTRH2(IBTRIEN)_U) D:$$CLRASK^IBTRH5K() CLRENTRY^IBTRH5K(IBTRIEN)
  1. Q XX
  1. ;
  1. COMQUAL() ;Function EP for Screening Communication Qualifier fields
  1. ; This Function is called from the 356.22 Dictionary Communication Qualifier fields.
  1. ; These fields include the following:
  1. ; 356.22 - 19.01, 19.02, 19.03
  1. ; 356.2213 - .07, .08, .09
  1. ; 356.22168 - .07, .08, .09
  1. ; Screens some specific entries from 365.021
  1. ; Input: DA - IEN of the 356.22 entry being edited
  1. ; 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. ; First Get all of IENS that we want to filter out
  1. F CDE="ED","HP","WP" D
  1. . S IEN=$O(^IBE(365.021,"B",CDE,""))
  1. . S:IEN'="" IENS(IEN)=""
  1. Q:$D(IENS(Y)) 0
  1. Q 1
  1. ;
  1. MISSING(SUB,DESC) ; Function to generate MISSING array
  1. ; Input: SUB - subscript of MISSING array
  1. ; DESC - description of error condition
  1. ; Returns: MISSING array
  1. ;
  1. S MISSING=MISSING+1
  1. S MISSING(SUB)=DESC
  1. Q