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

BLRPCCVC.m

Go to the documentation of this file.
  1. BLRPCCVC ;IHS/OIT/MKK - IHS LAB LINK TO PCC ; 11-Apr-2016 07:53 ; MKK
  1. ;;5.2;IHS LABORATORY;**1022,1024,1025,1027,1033,1039**;NOV 01, 1997;Build 38
  1. ;
  1. ; Create BLRAPI4 INPUT array so that call to GETVISIT^APCDAPI4 will have
  1. ; valid INPUT variables.
  1. EP ; EP
  1. K BLRAPI4 ; Initialize the array
  1. NEW OUT,SCIEN,TODAY,USER,VISITDT
  1. ;
  1. S BLRAPI4("NEVER ADD")=1 ; Try to find PCC Visit first
  1. ;
  1. ; ----- BEGIN IHS/OIT/MKK LR*5.2*1024 MODIFICATIONS
  1. S BLRAPI4("ANCILLARY")=1 ; Create Noon Visit
  1. ; ----- END IHS/OIT/MKK LR*5.2*1024 MODIFICATIONS
  1. ;
  1. S BLRAPI4("PAT")=APCDALVR("APCDPAT") ; Patient IEN
  1. ;
  1. S TODAY=$P($$NOW^XLFDT,".",1) ; Today -- Date only
  1. ;
  1. ; If order is today, then use Order Date/Time to try to match
  1. I $P($G(BLRODT),".",1)=TODAY S VISITDT=BLRODT
  1. ; Use Collection Date/Time if Order Date/Time not today
  1. I $P($G(BLRODT),".",1)'=TODAY S VISITDT=$G(BLRCDT)
  1. ;
  1. ; ----- BEGIN IHS/OIT/MKK LR*5.2*1025 MODIFICATIONS
  1. ; Use Collection Date/Time if FAST BYPASS option selected
  1. I $$UP^XLFSTR($G(BLROPT))["FASTORD" S VISITDT=$G(BLRCDT)
  1. ; ----- END IHS/OIT/MKK LR*5.2*1025 MODIFICATIONS
  1. ;
  1. ; Use NOW if no Collection Date/Time and Order Date/Time not today
  1. I $G(BLRCDT)=""&($P($G(BLRODT),".",1)'=TODAY) S VISITDT=$$NOW^XLFDT
  1. ;
  1. ; ----- BEGIN IHS/OIT/MKK LR*5.2*1039 MODIFICATIONS
  1. ; If the BLR COLL DT PCC VISIT CREATION parameter is set, then use the
  1. ; Collection Date for Visit Creation.
  1. I +$$GET^XPAR("PKG","BLR COLL DT PCC VISIT CREATION",1,"Q") S VISITDT=$G(BLRCDT,VISITDT)
  1. ; ----- END IHS/OIT/MKK LR*5.2*1039 MODIFICATIONS
  1. ;
  1. S BLRAPI4("VISIT DATE")=VISITDT
  1. ;
  1. I +$G(BLRORDL1)>0 S BLRAPI4("SITE")=BLRORDL1 ; Order site
  1. ;
  1. ; If no Order Site
  1. I +$G(BLRORDL1)<1 D
  1. . I +$G(BLRQSITE)>0 S BLRAPI4("SITE")=+$G(BLRQSITE) ; Default
  1. . I +$G(BLRQSITE)<1 S BLRAPI4("SITE")=+$G(DUZ(2)) ; User's Site
  1. ;
  1. ; VISIT TYPE stored in PCC MASTER CONTROL file in the
  1. ; "type of visit" field
  1. S BLRAPI4("VISIT TYPE")=$P($G(^APCCCTRL(DUZ(2),0)),"^",4)
  1. ;
  1. ; Service Category IEN
  1. S BLRAPI4("SRV CAT")=$G(BLRVCAT)
  1. S BLRAPI4("TIME RANGE")=-1 ; Don't use Time Range
  1. ;
  1. ; Try to determine the user who entered the data
  1. I +$G(BLRLOGDA)>0 S USER=$P($G(^BLRTXLOG(BLRLOGDA,20)),"^",6)
  1. I +$G(USER)<1 S USER=$G(BLRDUZ) ; IHS/OIT/MKK MODIFICATIONS LR*5.2*1027
  1. I +$G(USER)<1 S USER=DUZ
  1. S BLRAPI4("USR")=USER
  1. ;
  1. ; Optional - Provider (Dict 200), if possible
  1. S:+$G(BLROPRV)>0 BLRAPI4("PROVIDER")=BLROPRV
  1. ;
  1. ; Optional - Set Hospital Location (Dict. 44), if possible
  1. S:+$G(BLRORDL)>0 BLRAPI4("HOS LOC")=BLRORDL
  1. S:+$G(BLRORDL)<1&(+$G(ORDLOC)>0) BLRAPI4("HOS LOC")=ORDLOC
  1. ;
  1. ; Optional - Default Clinic Code (Dict 40.7), if possible
  1. S:$G(BLRCLIN)'="" BLRAPI4("CLINIC CODE")=$P(BLRCLIN,"`",2)
  1. ;
  1. Q
  1. ;
  1. ; ----- BEGIN IHS/OIT/MKK LR*5.2*1027
  1. ; PCC VISIT -- VISIT CREATED BY field is populated by the DUZ.
  1. ; LOC. OF ENCOUNTER field is populated by DUZ(2)
  1. RESETDUZ ; EP
  1. NEW USER,TSTR,NEWDUZ2,TMPORD,TMP1,TMP2
  1. ;
  1. ; If ^BLRTXLOG Txn # existent, try VERIFIER field
  1. S USER=$P($G(^BLRTXLOG(+$G(BLRLOGDA),20)),"^",6)
  1. I +$G(USER)>0 D Q
  1. . S TSTR="DUZ"_"=USER"
  1. . S @TSTR
  1. . D RESETDZ2
  1. ;
  1. ; If still not changed
  1. S USER=$P($G(^LRO(68,+$G(BLRAA),1,+$G(BLRAD),1,+$G(BLRAN),0)),"^",10)
  1. I +$G(USER)<1 Q
  1. ;
  1. S TSTR="DUZ"_"=USER"
  1. S @TSTR
  1. ;
  1. D RESETDZ2
  1. ;
  1. Q
  1. ;
  1. RESETDZ2 ; EP -- Reset DUZ(2), if possible
  1. NEW REDO
  1. ;
  1. S NEWDUZ2=$P($G(^BLRTXLOG(+$G(BLRLOGDA),0)),"^",9)
  1. S REDO="DUZ(2)"_"=NEWDUZ2"
  1. I $G(NEWDUZ2)'="" S @REDO Q
  1. ;
  1. ; If possible, reset DUZ(2) to Order Site
  1. S REDO="DUZ(2)"_"=BLRORDL1"
  1. I +$G(BLRORDL1)>0 S @REDO Q
  1. ;
  1. ; If still not reset, try default
  1. S REDO="DUZ(2)"_"=BLRQSITE"
  1. I +$G(BLRQSITE)>0 S @REDO
  1. ;
  1. Q
  1. ; ----- END IHS/OIT/MKK LR*5.2*1027