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

BIRPC1.m

Go to the documentation of this file.
  1. BIRPC1 ;IHS/CMI/MWR - REMOTE PROCEDURE CALLS; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;**10**;MAY 30,2015
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; RETURNS PATIENT DATA, DATA FOR AN IMMUNIZATION OR SKIN TEST VISIT.
  1. ;; PATCH 3: Add Eligibility Code to default Hx string. GET+35
  1. ;; PATCH 5: Add Admin Note to default Hx string. GET+38
  1. ;; PATCH 9: Add Date VIS Presented and Admin Date to data string. GET+40
  1. ;; PATCH 10: Add Skin Test Lot Number IEN and Text. GET+86
  1. ;
  1. ;
  1. ;----------
  1. PDATA(BIDATA,BIDFN) ;EP
  1. ;---> Return Patient Data in 5 ^-delimited pieces:
  1. ;---> 1 - DOB in format: OCT 01,1994.
  1. ;---> 2 - Age in format: 35 Months.
  1. ;---> 3 - Text of Patient's sex.
  1. ;---> 4 - HRCN in the format XX-XX-XX.
  1. ;---> 5 - Text of ACTIVE/INACTIVE Status.
  1. ;---> Parameters:
  1. ; 1 - BIDATA (ret) String of patient data||error.
  1. ; 2 - BIDFN (req) DFN of patient.
  1. ;
  1. ;---> Delimiter to pass error with result to GUI.
  1. N BI31,BIERR S BI31=$C(31)_$C(31)
  1. S BIDATA="",BIERR=""
  1. ;
  1. ;---> If DFN not supplied, set Error Code and quit.
  1. I '$G(BIDFN) D Q
  1. .D ERRCD^BIUTL2(201,.BIERR) S BIDATA=BI31_BIERR
  1. ;
  1. ;---> DOB.
  1. S BIDATA=$$TXDT1^BIUTL5($$DOB^BIUTL1(BIDFN))
  1. ;
  1. ;---> Age.
  1. S BIDATA=BIDATA_U_$$AGEF^BIUTL1(BIDFN)
  1. ;
  1. ;---> Text of sex.
  1. S BIDATA=BIDATA_U_$$SEXW^BIUTL1(BIDFN)
  1. ;
  1. ;---> HRCN, format XX-XX-XX.
  1. S BIDATA=BIDATA_U_$$HRCN^BIUTL1(BIDFN)
  1. ;
  1. ;---> Active/Inactive Status.
  1. S BIDATA=BIDATA_U_$$ACTIVE^BIUTL1(BIDFN)
  1. ;
  1. S BIDATA=BIDATA_BI31
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. GET(BIDATA,BIDA,BIVTYPE,BIDE) ;PEP - Return data for one Immunization or Skin Test.
  1. ;---> Return data for one Immunization or Skin Test.
  1. ;---> Called by RPC: BI VISIT GET.
  1. ;---> Parameters:
  1. ; 1 - BIDATA (ret) Visit Data or Text of Error Code if any.
  1. ; 2 - BIDA (req) IEN of V IMM or V SKIN entry for data retrieval.
  1. ; 3 - BIVTYPE (req) "I"=Immunization Visit, "S"=Skin Text Visit.
  1. ; 4 - BIDE (opt) Local array for Data Elements to be returned.
  1. ;
  1. ;---> Delimiter to pass error with result to GUI.
  1. N BI31,BIERR S BI31=$C(31)_$C(31)
  1. S BIDATA="",BIERR=""
  1. ;
  1. ;---> If BIVTYPE does not="I" (Immunization Visit) and it does
  1. ;---> not="S" (Skin Test Visit), then set Error Code and quit.
  1. I ($G(BIVTYPE)'="I")&($G(BIVTYPE)'="S") D Q
  1. .D ERRCD^BIUTL2(410,.BIERR) S BIDATA=BI31_BIERR
  1. ;
  1. ;---> If BIDA not supplied, set Error Code and quit.
  1. I '$G(BIDA) D Q
  1. .D ERRCD^BIUTL2(409,.BIERR) S BIDATA=BI31_BIERR
  1. ;
  1. ;---> Set required variables, kill ^BITMP($J).
  1. D SETVARS^BIUTL5 K ^BITMP($J)
  1. ;
  1. ;---> Set BIDE local array for Data Elements to be returned.
  1. ;---> IENs are in ^BIEXPDD(, the BI TABLE DATA ELEMENT File.
  1. ;---> The Pieces (PC) indicate position in the returned data string,
  1. ;---> BIDATA, below.
  1. ;---> Branching logic for Immunization versus Skin Test Visits.
  1. ;
  1. ;---> IMMUNIZATION:
  1. ;---> If this is an Immunization Visit, collect these Data Elements.
  1. N I
  1. ;---> Next line: 6 (Dose#) defunct, but serves as a place holder. v8.0
  1. ;
  1. ;********** PATCH 3, v8.5, SEP 10,2012, IHS/CMI/MWR
  1. ;---> Add Eligibility Code Text and NDC Code Text to default Hx string.
  1. ;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
  1. ;---> Add Admin Note to default Hx string.
  1. ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. ;---> Add Date VIS Presented to Patient (YYYYMMDD) and Date of Event ONLY.
  1. ;I '$D(BIDE),BIVTYPE="I" F I=4,6,24,27,29:1:37,43,49,51,61,65,67,68,76,77,78,80,82,84,87 S BIDE(I)=""
  1. I '$D(BIDE),BIVTYPE="I" D
  1. .F I=4,6,24,27,29:1:37,43,49,51,61,65,67,68,76,77,78,80,82,84,85,87,90,91 S BIDE(I)=""
  1. ;**********
  1. ;
  1. ;---> IEN PC DATA
  1. ;---> --- -- ----
  1. ;---> 1 = Visit Type: "I"=Immunization, "S"=Skin Test.
  1. ;---> 4 2 = Vaccine Name, Short.
  1. ;---> 6 3 = Dose#. v8.0 No longer used.
  1. ;---> 24 4 = V IMMUNIZATION IEN.
  1. ;---> 27 5 = Vaccine Group ("Series Type").
  1. ;---> 29 6 = Date of Immunization (DD-Mmm-YYYY @HH:MM).
  1. ;---> 30 7 = Vaccine Name, IEN.
  1. ;---> 31 8 = Vaccine maximum Dose#.
  1. ;---> 32 9 = Vaccine Lot Number, IEN.
  1. ;---> 33 10 = Vaccine Lot Number.
  1. ;---> 34 11 = Location IEN.
  1. ;---> 35 12 = Category of Visit (A,E, or I)
  1. ;---> 36 13 = Location Other (text).
  1. ;---> 37 14 = Location IHS (text).
  1. ;---> 43 15 = Vaccine Reaction.
  1. ;---> 49 16 = VIS Statement Info (Yes/No).
  1. ;---> 51 17 = Release/Revision Date of VIS (DD-Mmm-YYYY).
  1. ;---> 61 18 = Immunization Provider IEN.
  1. ;---> 65 19 = Dose Override.
  1. ;---> 67 20 = Injection Site.
  1. ;---> 68 21 = Volume.
  1. ;---> 76 22 = Visit IEN.
  1. ;---> 77 23 = Eligibility Code IEN.
  1. ;---> 78 24 - Imported from Outside Registry (1=imported, 2=imported & edited).
  1. ;---> 80 25 = NDC Code pointer IEN.
  1. ;---> 82 26 = Eligibility Code Text.
  1. ;---> 84 27 = NDC Code Text.
  1. ;---> 85 28 = Date of Event OR Visit; Admin Shot Date (1201 of V File) in MM/DD/YY
  1. ;---> If 1201 is not populated, this element returns the Visit Date!
  1. ;---> 87 29 = Administrative Note.
  1. ;---> 90 30 = Date VIS Presented to Patient.
  1. ;---> 91 31 = Date of Event (1201) ONLY; if 1201 is null, return null.
  1. ;
  1. ;
  1. ;---> SKIN TEST:
  1. ;---> If this is a Skin Test Visit, collect these Data Elements.
  1. ;
  1. ;********** PATCH 10, v8.5, MAY 30,2015, IHS/CMI/MWR
  1. ;---> Add Skin Test Lot Number IEN and Text.
  1. ;I '$D(BIDE),BIVTYPE="S" F I=24,26,29,34:1:42,61,67,68,70,76 S BIDE(I)=""
  1. I '$D(BIDE),BIVTYPE="S" F I=24,26,29,34:1:42,61,67,68,70,76,92,93 S BIDE(I)=""
  1. ;
  1. ;---> IEN PC DATA
  1. ;---> --- -- ----
  1. ;---> 1 = Visit Type: "I"=Immunization, "S"=Skin Test.
  1. ;---> 24 2 = V File IEN.
  1. ;---> 26 3 = Location (or Outside Location) of Visit.
  1. ;---> 29 4 = Date of Skin Test (DD-Mmm-YYYY @HH:MM).
  1. ;---> 34 5 = Location IEN.
  1. ;---> 35 6 = Category of Visit (A,E, or I)
  1. ;---> 36 7 = Location Other (text).
  1. ;---> 37 8 = Location IHS (text).
  1. ;---> 38 9 = Skin Test Result.
  1. ;---> 39 10 = Skin Test Reading.
  1. ;---> 40 11 = Skin Test Date Read.
  1. ;---> 41 12 = Skin Test Name.
  1. ;---> 42 13 = Skin Test Name IEN.
  1. ;---> 61 14 = Immunization Provider IEN.
  1. ;---> 67 15 = Injection Site.
  1. ;---> 68 16 = Volume.
  1. ;---> 70 17 = Skin Test Reader (Provider) IEN.
  1. ;---> 76 18 = Visit IEN.
  1. ;---> 92 19 = Skin Test Lot Number IEN.
  1. ;---> 93 20 = Skin Test Lot Number Text.
  1. ;**********
  1. ;
  1. ;
  1. ;---> Now, gather data from one V File Visit.
  1. ; 1 - BIDA (req) IEN of V File Visit.
  1. ; 2 - BIDE (req) Data Elements array (null if HL7)
  1. ; 3 - BIFMT (req) Format: 0=ASCII Split, 1=ASCII, 2=HL7, 3=IMM/SERVE
  1. ; 4 - BIVTYPE (req) Visit Type: "I"=Immunization, "S"=Skin Test.
  1. ; 5 - BIDATA (opt) Data returned in this param if desired.
  1. ;
  1. D HISTORY1^BIEXPRT3(BIDA,.BIDE,1,BIVTYPE,,.BIERR)
  1. I BIERR]"" S BIDATA=BI31_BIERR Q
  1. ;
  1. ;
  1. ;---> Set parameters for writing data as a string in BIDATA.
  1. ;---> Parameters:
  1. ; 1 - BIEXP (req) Export: 0=screen, 1=host file, 2=string
  1. ; 2 - BIFMT (req) Format: 1=ASCII, 2=HL7, 3=IMM/SERVE
  1. ; 3 - BIFLNM (opt) File name
  1. ; 4 - BIPATH (opt) BI Path name for host files
  1. ; 5 - BIDATA (ret) Immunization History in "|"-delimited string
  1. ; NOTE: Since this is necessarily only one
  1. ; record, strip "^"-delimiter at end.
  1. ;
  1. D WRITE^BIEXPRT4(2,1,,,.BIDATA)
  1. ;
  1. ;---> Returned data string, with error delimiter concatenated.
  1. S BIDATA=$P(BIDATA,U)_BI31
  1. Q