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

BIPATVW2.m

Go to the documentation of this file.
  1. BIPATVW2 ;IHS/CMI/MWR - ADD/EDIT/DELETE VISITS; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;**10**;MAY 30,2015
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;;BIB PROTOTYPE; JAN 31,2015
  1. ;; ADD, EDIT, DELETE VISITS VIA LIST MANAGER.
  1. ;; PATCH 1: Do not stuff default VFC if patient < 19 yrs. ADDIMM+33
  1. ;; PATCH 9: Add Admin Date and VIS Presented Date to array. EDITIMM+87
  1. ;; If patient is adult, set Eligibility default="V01". ADDIMM+40
  1. ;; PATCH 10: Add Skin Test Lot Number. EDITIMM+113
  1. ;
  1. ;
  1. ;----------
  1. ADDIMM ;EP
  1. ;---> Add an Immunization via List Manager.
  1. ;---> Steps:
  1. ; 1) This entry point is called by the Protocol:
  1. ; BI IMMUNIZATION VISIT ADD, an action on the
  1. ; List Manager menu protocol: BI MENU PATIENT VIEW
  1. ;
  1. ; 2) This code calls ScreenMan form:
  1. ; BI FORM-IMM VISIT ADD/EDIT to build BI local array
  1. ; of data for add/edit of Immunization visit.
  1. ; Data already stored in the BI local array is loaded
  1. ; into the form by LOADVIS^BIUTL7, which is called
  1. ; by the Pre-Action of Blocks for Imm/Skin Edits.
  1. ;
  1. ; 3) SAVISIT^BIUTL7 uses BI local array to build data
  1. ; to pass to ADDEDIT^BIRPC3 (which is also called by
  1. ; the Broker from the GUI).
  1. ;
  1. ; 4) BIRPC3 calls ADDV^BIVISIT, which adds the
  1. ; Visit to the V Files.
  1. ;
  1. ;---> Variables:
  1. ; 1 - BIDFN (req) Patient DFN.
  1. ; 2 - BIDUZ2 (req) DUZ(2) of User (for Site Parameters).
  1. ; 3 - BIDEFDT (opt) Default date of new Visit.
  1. ;
  1. ;---> Check that DFN for this patient is present.
  1. I '$G(BIDFN) D ERRCD^BIUTL2(405,,1) D RESET Q
  1. ;
  1. ;
  1. ;********** BARCODE PROTO, v8.5, JAN 31,2015, IHS/CMI/MWR
  1. ;---> Parse parameter of scanned values for adding new Lot Numbers.
  1. ;N BI S BI("A")=BIDFN
  1. I '$G(BISCANA) N BI
  1. S BI("A")=BIDFN
  1. ;**********
  1. ;
  1. ;---> Set default VFC Eligibility.
  1. ;---> If Patient Ben Type is 01 (Am Indian/AK Native), set VFC default=4.
  1. ;
  1. ;********** PATCH 1, v8.3.1, Dec 30,2008, IHS/CMI/MWR
  1. ;---> Do NOT stuff VFC default if patient is not < 19 years old.
  1. ;I $$BENTYP^BIUTL11(BIDFN,2)="01" S BI("P")=4
  1. ;--> If patient was less than 19yrs set default=V01 and quit.
  1. ;Q:($$AGE^BIUTL1(BIDFN,1,BIDATE)>18)
  1. ;
  1. ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. ;---> If patient is adult, set Eligibility default="V01".
  1. D
  1. .I $$AGE^BIUTL1(BIDFN,1)<19,$$BENTYP^BIUTL11(BIDFN,2)="01" S BI("P")=4 Q
  1. .;---> Otherwise patient is adult, set default="V01" and quit.
  1. .S BI("P")=1
  1. ;**********
  1. ;
  1. ;---> Set default date.
  1. S BI("E")=$G(BIDEFDT)
  1. ;
  1. ;---> Get Site IEN for parameters.
  1. S:'$G(BIDUZ2) BIDUZ2=$G(DUZ(2))
  1. I '$G(BIDUZ2) D ERRCD^BIUTL2(105,,1) Q
  1. S BI("Z")=BIDUZ2
  1. ;
  1. ;---> Call Screenman to build BI local array of data by user.
  1. ;---> NOTE: The absence of BI("K") (IEN of Old V File entry) signals
  1. ;---> a NEW V Immunizaton.
  1. ;---> BISAVE=Flag to call BIUTL7 to save data (below). vvv83
  1. ;---> BITOLONG=Flag used in Screenman to display pop-up: Other Loc too long.
  1. N BISAVE,BITOLONG
  1. N DR S DR="[BI FORM-IMM VISIT ADD/EDIT]"
  1. D DDS^BIFMAN(9000001,DR,BIDFN,"S",.BISAVE,.BIPOP)
  1. ;
  1. ;---> If user saved data, call ^BIUTL7 to save it.
  1. D:$G(BISAVE) SAVISIT^BIUTL7("I",.BI)
  1. ;
  1. D RESET
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. ADDSK ;EP
  1. ;---> Add a Skin Test via List Manager.
  1. ;---> Steps are the same as ADDIMM above.
  1. ;
  1. ;---> Check that DFN for this patient is present.
  1. I '$G(BIDFN) D ERRCD^BIUTL2(405,,1) D RESET Q
  1. N BI S BI("A")=BIDFN
  1. ;
  1. ;---> Set default date and volume.
  1. S BI("E")=$G(BIDEFDT),BI("W")=.1
  1. ;
  1. ;---> Get Site IEN for parameters.
  1. S:'$G(BIDUZ2) BIDUZ2=$G(DUZ(2))
  1. I '$G(BIDUZ2) D ERRCD^BIUTL2(105,,1) Q
  1. S BI("Z")=BIDUZ2
  1. ;
  1. ;---> Call Screenman to build BI local array of data by user.
  1. ;---> NOTE: The absence of BI("K") (IEN of Old V File entry) signals
  1. ;---> a NEW V Skin Test.
  1. ;---> BISAVE=Flag to call BIUTL7 to save data (below). vvv83
  1. ;---> BITOLONG=Flag used in Screenman to display pop-up: Other Loc too long.
  1. N BISAVE,BITOLONG
  1. N DR S DR="[BI FORM-SKIN VISIT ADD/EDIT]"
  1. D DDS^BIFMAN(9000001,DR,BIDFN,"S",.BISAVE,.BIPOP)
  1. ;
  1. ;---> If user saved data, call ^BIUTL7 to save it.
  1. D:$G(BISAVE) SAVISIT^BIUTL7("S",.BI)
  1. ;
  1. D RESET
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. EDITIMM ;EP
  1. ;---> Edit an Immunization via List Manager.
  1. ;---> Steps:
  1. ; 1) This entry point is called by the Protocol:
  1. ; BI V FILE VISIT EDIT, an action on the
  1. ; List Manager menu protocol: BI MENU PATIENT VIEW
  1. ;
  1. ; 2) This code gets an Imm Visit from List Manager
  1. ; and loads the data into the Screenman form:
  1. ; BI FORM-IMM VISIT ADD/EDIT to build BI local array
  1. ; of data for add/edit of Immunization visit.
  1. ; Data already stored in the BI local array is loaded
  1. ; into the form by LOADVIS^BIUTL7, which is called
  1. ; by the Pre-Action of Blocks for Imm/Skin Edits.
  1. ;
  1. ; 3) SAVISIT^BIUTL7 uses BI local array to build data
  1. ; to pass to ADDEDIT^BIRPC3 (which is also called by
  1. ; the Broker from the GUI).
  1. ;
  1. ; 4) BIRPC3 calls DELETE^BIVISIT and ADDV^BIVISIT,
  1. ; which broker Visits to the V Files.
  1. ;
  1. ;
  1. ;---> Call the List Manager Generic Selector of items displayed.
  1. N VALMY
  1. D EN^VALM2(XQORNOD(0),"OS")
  1. ;
  1. ;---> Check that Imm History string for this patient is present.
  1. ;---> If Imm History not supplied, set Error Code and quit.
  1. I '$G(BIDFN) D ERRCD^BIUTL2(405,,1) D RESET Q
  1. I $G(BIHX(BIDFN))']"" D ERRCD^BIUTL2(303,,1) D RESET Q
  1. ;
  1. ;---> Check that a Listman Item was passed; if so, set Y=which
  1. ;---> item (Imm Visit) was passed/selected.
  1. ;I '$D(VALMY) D ERRCD^BIUTL2(406,,1) D RESET Q
  1. I '$D(VALMY) D RESET Q
  1. N Y S Y=$O(VALMY(0))
  1. I '$G(Y) D ERRCD^BIUTL2(406,,1) D RESET Q
  1. ;
  1. ;---> Get V Type: Imm or Skin.
  1. N BIVTYPE S BIVTYPE=$P($P(BIHX(BIDFN),U,Y),"|")
  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,,1) D RESET
  1. ;
  1. ;---> Set BIVFIEN=V File IEN.
  1. N BIVFIEN S BIVFIEN=$P($P(BIHX(BIDFN),U,Y),"|",4)
  1. ;
  1. ;---> Gather data for this Visit to load for Screenman edit.
  1. D GET^BIRPC1(.Y,BIVFIEN,BIVTYPE)
  1. ;
  1. ;---> If an error is passed back, display it and quit.
  1. N BI31,BIERR S BI31=$C(31)_$C(31)
  1. S BIERR=$P(Y,BI31,2)
  1. I BIERR]"" D IO^BIO(BIERR),DIRZ^BIUTL3() D RESET Q
  1. ;
  1. ;---> If no error, then set Y=data (1st BI31 piece).
  1. S Y=$P(Y,BI31)
  1. ;
  1. ;---> Build BI array of Visit data for ScreenMan Edit form.
  1. N BI,DR,V S V="|"
  1. ;
  1. ;---> Build array for Immunization Visit.
  1. D:BIVTYPE="I"
  1. .S BI("A")=+BIDFN ;Patient DFN.
  1. .S BI("B")=+$P(Y,V,7) ;Vaccine Name IEN.
  1. .S BI("C")=$P(Y,V,3) ;Dose# of Immunization.
  1. .S BI("D")=$P(Y,V,9) ;Lot Number IEN.
  1. .S BI("E")=$P(Y,V,6) ;Date/Time of Imm Visit (ext form).
  1. .S BI("F")=+$P(Y,V,11) ;Location of Encounter IEN.
  1. .S BI("G")=$P(Y,V,13) ;Other Location of Encounter Text.
  1. .S BI("I")=$P(Y,V,12) ;Catgegory of Visit (A,E,I).
  1. .S BI("J")=$P(Y,V,22) ;Visit IEN.
  1. .S BI("K")=BIVFIEN ;Old V File IEN - indicates EDIT of previous Imm.
  1. .S BI("O")=+$P(Y,V,15) ;Reaction to Immunization on this Visit.
  1. .S BI("P")=$P(Y,V,23) ;VFC Eligibility. vvv83
  1. .S BI("Q")=$P(Y,V,17) ;Release/Revision Date of VIS (DD-Mmm-YYYY).
  1. .S BI("R")=$P(Y,V,18) ;Immunization Provider.
  1. .S BI("S")=$P(Y,V,19) ;Dose Override.
  1. .S BI("T")=$P(Y,V,20) ;Injection Site.
  1. .S BI("W")=$P(Y,V,21) ;Volume.
  1. .S BI("Y")=$P(Y,V,24) ;Imported From Outside Source (=1).
  1. .S BI("H")=$P(Y,V,25) ;NDC Code pointer IEN.
  1. .;
  1. .;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. .;---> Add VIS Presented Dateand Admin Date to array for Screenman.
  1. .S BI("QQ")=$P(Y,V,30) ;Date VIS Presented to Patient.
  1. .S BI("EE")=$P(Y,V,31) ;Admin/shot Date ONLY (not Visit); can be null.
  1. .;**********
  1. .;X ^O
  1. .;
  1. .S DR="[BI FORM-IMM VISIT ADD/EDIT]"
  1. ;
  1. ;---> Build array for Skin Test Visit.
  1. D:BIVTYPE="S"
  1. .S BI("A")=+BIDFN ;Patient DFN.
  1. .S BI("B")=+$P(Y,V,13) ;Skin Test IEN.
  1. .S BI("E")=$P(Y,V,4) ;Date/Time of Skin Test Visit (ext form).
  1. .S BI("F")=+$P(Y,V,5) ;Location of Encounter IEN.
  1. .S BI("G")=$P(Y,V,7) ;Other Location of Encounter Text.
  1. .S BI("I")=$P(Y,V,6) ;Catgegory of Visit (A,E,I).
  1. .S BI("J")=$P(Y,V,18) ;Visit IEN.
  1. .S BI("K")=BIVFIEN ;Old V File IEN (for edits).
  1. .S BI("L")=$P(Y,V,9) ;Skin Test Result.
  1. .S BI("M")=$P(Y,V,10) ;Skin Test Reading.
  1. .S BI("N")=$P(Y,V,11) ;Skin Test Date Read.
  1. .S BI("R")=$P(Y,V,14) ;Skin Test Provider.
  1. .S BI("T")=$P(Y,V,15) ;Injection Site.
  1. .S BI("W")=$P(Y,V,16) ;Volume.
  1. .S BI("X")=$P(Y,V,17) ;Skin Test Reader.
  1. .;
  1. .;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. .;---> Add Skin Test Lot Number.
  1. .S BI("LL")=$P(Y,V,19)
  1. .;**********
  1. .S DR="[BI FORM-SKIN VISIT ADD/EDIT]"
  1. ;
  1. ;
  1. ;---> Get Site IEN for parameters.
  1. S:'$G(BIDUZ2) BIDUZ2=$G(DUZ(2))
  1. I '$G(BIDUZ2) D ERRCD^BIUTL2(105,,1) Q
  1. S BI("Z")=BIDUZ2
  1. ;
  1. ;---> Call Screenman to build BI local array of data edited by user.
  1. ;---> BISAVE=Flag to call BIUTL7 to save data (below). vvv83
  1. ;---> BITOLONG=Flag used in Screenman to display pop-up: Other Loc too long.
  1. N BISAVE,BITOLONG
  1. D DDS^BIFMAN(9000001,DR,BIDFN,"S",.BISAVE,.BIPOP)
  1. ;
  1. ;---> If user saved data, call ^BIUTL7 to save it.
  1. D:$G(BISAVE) SAVISIT^BIUTL7(BIVTYPE,.BI)
  1. ;
  1. D RESET
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DELETIMM ;EP
  1. ;---> Delete an Immunization or Skin Test via List Manager.
  1. ;---> Steps:
  1. ; 1) This entry point is called by the Protocol:
  1. ; BI V FILE VISIT DELETE, an action on the
  1. ; List Manager menu protocol: BI MENU PATIENT VIEW
  1. ;
  1. ; 2) This code gets an Imm or Skin Visit from List Manager
  1. ; and calls DELETE^BIRPC3 (which is also called by
  1. ; the Broker from the GUI).
  1. ;
  1. ; 5) BIRPC3 calls DELETE^BIVISIT, which will
  1. ; delete the V File entry.
  1. ;
  1. ;---> Call the List Manager Generic Selector of items displayed.
  1. N VALMY
  1. D EN^VALM2(XQORNOD(0),"OS")
  1. ;
  1. ;---> Check that Imm History string for this patient is present.
  1. ;---> If Imm History not provided, set Error Code and quit.
  1. I '$G(BIDFN) D ERRCD^BIUTL2(405,,1) D RESET Q
  1. I $G(BIHX(BIDFN))']"" D ERRCD^BIUTL2(303,,1) D RESET Q
  1. ;
  1. ;---> Check that a Listman Item was passed.
  1. I '$D(VALMY) D ERRCD^BIUTL2(406,,1) D RESET Q
  1. N Y S Y=$O(VALMY(0))
  1. I '$G(Y) D ERRCD^BIUTL2(406,,1) D RESET Q
  1. ;
  1. S Y=$P(BIHX(BIDFN),U,Y)
  1. I Y']"" D ERRCD^BIUTL2(303,,1) D RESET Q
  1. ;
  1. D FULL^VALM1
  1. ;
  1. ;---> Display visit for confirmation.
  1. N BIVFIEN,BIVTYPE,V S V="|"
  1. ;
  1. S BIVTYPE=$P(Y,V)
  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,,1) D RESET Q
  1. ;
  1. ;---> Set Immunization confirmation display fields and Visit IEN.
  1. I BIVTYPE="I" D
  1. .S X=$P(Y,V,7)_" "_$P(Y,V,2)_" "_$P(Y,V,5)
  1. .S BIVFIEN=$P(Y,V,4)
  1. ;
  1. ;---> Set Skin Test confirmation display fields and Visit IEN.
  1. I BIVTYPE="S" D
  1. .S X=$P(Y,V,7)_" "_$P(Y,V,11)_" "_$P(Y,V,8)_" "_$P(Y,V,9)
  1. .S:$P(Y,V,9) X=X_" mm"
  1. .S X=X_" "_$P(Y,V,5)
  1. .S BIVFIEN=$P(Y,V,4)
  1. ;
  1. ;
  1. D TITLE^BIUTL5("DELETE AN IMMUNIZATION VISIT")
  1. N A
  1. S A(1)="Do you really wish to DELETE this Visit?"
  1. S A(1,"F")="!!?3"
  1. S A(2)="Patient: "_$E($$NAME^BIUTL1(BIDFN),1,25)
  1. S A(2)=A(2)_" Chart#: "_$$HRCN^BIUTL1(BIDFN)
  1. S A(2,"F")="!!?10"
  1. S A(3)=X,A(3,"F")="!!?10"
  1. S A(4,"F")="!"
  1. D EN^DDIOL(.A)
  1. ;
  1. N B,BIERR S BIERR=0
  1. S B(1)=" Enter YES to DELETE this Visit."
  1. S B(2)=" Enter NO to leave it unchanged."
  1. D DIR^BIFMAN("Y",.Y,," Enter Yes or No","NO",B(2),B(1))
  1. ;
  1. ;---> Failed to confirm.
  1. I Y<1 D Q
  1. .D IO^BIO("NO changes made.")
  1. .D DIRZ^BIUTL3(),RESET
  1. ;
  1. ;---> Delete the visit.
  1. S BIERR=""
  1. D DELETE^BIRPC3(.BIERR,BIVFIEN,BIVTYPE)
  1. ;
  1. ;---> If an error is passed back, display it.
  1. N BI31 S BI31=$C(31)_$C(31),BIERR=$P(BIERR,BI31,2)
  1. I BIERR]"" D IO^BIO(BIERR),DIRZ^BIUTL3()
  1. D RESET
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. RESET ;EP
  1. ;---> Update partition for return to Listman.
  1. I $D(VALMQUIT) S VALMBCK="Q" Q
  1. D TERM^VALM0 S VALMBCK="R"
  1. D HDR^BIPATVW(),INIT^BIPATVW
  1. Q