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

BIUTL4.m

Go to the documentation of this file.
  1. BIUTL4 ;IHS/CMI/MWR - UTIL: SCREENMAN CODE; OCT 15, 2010
  1. ;;8.5;IMMUNIZATION;**12**;MAY 01,2016
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; UTILITY: SCREENMAN CODE: VAC SELECT ACTIONS, SERIES VALID,
  1. ;; LOC BRANCHING LOGIC, VISIT LOC DEF, SKIN TEST READ MM.
  1. ;; PATCH 2: Comment out code that would disable VFC Elig field for
  1. ; patients >19yrs. OLDDATE+15
  1. ;; PATCH 5: Add NDC to reset fields when vaccine is changed. VACCHG+14
  1. ;; PATCH 5: Add leading zero to default volume if less than 1. VISVOL+21
  1. ;; PATCH 9: Make VIS Presented Date default to Visit Date (when changed). OLDATE+9
  1. ;; PATCH 10: Only stuff VIS Presented Date if this is a V Imm. OLDDATE+18
  1. ;; PATCH 12: If date not today, Inj Site not required OLDDATE+17
  1. ;
  1. ;----------
  1. VACSCR ;EP
  1. ;---> Set Screen for vaccine selection in Screen field of
  1. ;---> "Form Only Field Parameters" of the Form BI FORM-IMM VISIT ADD/EDIT
  1. ;---> when selecting vaccine.
  1. ;---> Screen: If this vaccine is Active OR if this is an Historical Event
  1. ;---> AND this is NOT a Skin Test.
  1. ;
  1. S DIR("S")="I ('$P(^AUTTIMM(Y,0),U,7)!($G(BI(""I""))=""E""))"
  1. S DIR("S")=DIR("S")_"&('$P(^AUTTIMM(Y,0),U,8))"
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. VACSEL(BIVAC) ;EP
  1. ;---> For IMMUNIZATIONS:
  1. ;---> Actions to take in Screenman when Vaccine is selected.
  1. ;---> Called by the POST ACTION of Field 2, Vaccine
  1. ;---> of the Form BI FORM-IMM VISIT ADD/EDIT.
  1. ;---> Parameters:
  1. ; 1 - BIVAC (req) IEN of Vaccine in IMM File (9999999.14).
  1. ;
  1. ;---> Display Vaccine Short Name below Vaccine Name.
  1. Q:('$G(BIVAC))
  1. S BI("B")=BIVAC
  1. D PUT^DDSVALF(2.5,,,"("_$$VNAME^BIUTL2(BIVAC)_")")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. VACSELC(BIVAC) ;EP
  1. ;---> For CONTRAINDICATIONS:
  1. ;---> Actions to take in Screenman when Vaccine is selected.
  1. ;---> Called by the POST ACTION of Field 2, Vaccine
  1. ;---> of the Form BI FORM-CONTRAINDICATION ADD.
  1. ;---> Parameters:
  1. ; 1 - BIVAC (req) IEN of Vaccine in IMM File (9999999.14).
  1. ;
  1. ;---> If a vaccine has not been chosen, then disable the Reason field.
  1. I '$G(BIVAC) D Q
  1. .D HLP^DDSUTL("You must first choose a vaccine."),HLP^DDSUTL("$$EOP")
  1. .;---> Make Reason uneditable.
  1. .D UNED^DDSUTL(4,,,1)
  1. ;
  1. ;---> Make Reason editable.
  1. D UNED^DDSUTL(4,,,0)
  1. ;---> Display Vaccine Short Name below Vaccine Name.
  1. S BI("B")=BIVAC
  1. D PUT^DDSVALF(2.5,,,"("_$$VNAME^BIUTL2(BIVAC)_")")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. VACCHG(BIVAC) ;EP
  1. ;---> Actions to take in Screenman when the Vaccine is selected
  1. ;---> or changed.
  1. ;---> Called by the POST ACTION ON CHANGE of Field 2, Vaccine"
  1. ;---> of the Form BI FORM-IMM VISIT ADD/EDIT.
  1. ;---> Parameters:
  1. ; 1 - BIVAC (req) IEN of Vaccine IMMUNIZATION File (9999999.14).
  1. ;
  1. Q:'$G(BIVAC)
  1. ;
  1. ;---> If this is NOT a new visit, inform user that Dose#, Lot#,
  1. ;---> Reaction, and VIS will be deleted and replaced.
  1. D:$G(BI("K"))
  1. .N BIMSG
  1. .;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
  1. .;---> Add NDC to reset fields when vaccine is changed.
  1. .S BIMSG="* NOTE: Because you have changed the vaccine, Dose Override,"
  1. .S BIMSG=BIMSG_"Lot#, NDC, and any Reaction and VIS will be removed or replaced"
  1. .S BIMSG=BIMSG_" with defaults for the new vaccine."
  1. .D HLP^DDSUTL(BIMSG),HLP^DDSUTL("$$EOP")
  1. ;
  1. ;---> Clear data relating to previous Vaccine (if any).
  1. D PUT^DDSVALF(3) S BI("D")="" ;Lot# IEN
  1. D PUT^DDSVALF(13) S BI("O")="" ;Reaction
  1. D PUT^DDSVALF(10) S BI("Q")="" ;VIS
  1. D PUT^DDSVALF(14) S BI("S")="" ;Dose Override
  1. D PUT^DDSVALF(5) S BI("W")="" ;Volume
  1. D PUT^DDSVALF(3.8) S BI("H")="" ;NDC
  1. ;**********
  1. ;
  1. ;---> If Category is Historical Event, do not stuff Lot# and VIS defaults.
  1. Q:$G(BI("I"))="E"
  1. ;
  1. ;---> If this Vaccine has a Default ("Current") Lot#, then stuff it.
  1. N BIX
  1. I '$G(BI("D")) D
  1. .S BIX=$$LOTDEF^BIUTL2(BIVAC)
  1. .I BIX D PUT^DDSVALF(3,,,BIX,"I") S BI("D")=BIX
  1. ;
  1. D VISVOL(BIVAC)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. VISVOL(BIVAC) ;EP
  1. ;---> Stuff VIS and Volume defaults for a Lot Number on
  1. ;---> the Form BI FORM-IMM VISIT ADD/EDIT.
  1. ;---> Parameters:
  1. ; 1 - BIVAC (req) IEN of Vaccine in IMM File (9999999.14).
  1. ;
  1. Q:'$G(BIVAC)
  1. N BIX
  1. ;---> If this Vaccine has a Default VIS, stuff it.
  1. D:'$G(BI("Q"))
  1. .S BIX=$$VISDEF^BIUTL2(BIVAC)
  1. .I BIX D PUT^DDSVALF(10,,,BIX,"I") S BI("Q")=BIX
  1. ;
  1. ;---> If this is a new visit, stuff Volume Default.
  1. D:'$G(BI("K"))
  1. .N X S X=$$CODE^BIUTL2(BIVAC,5)
  1. .Q:'X
  1. .;---> For Influenza CVX 15, if patient is <36 mths change default=.25 ml.
  1. .D:BIVAC=148
  1. ..Q:'$G(BIDFN) S:$$AGE^BIUTL1(BIDFN)<36 X=".25"
  1. .;
  1. .;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
  1. .;---> Add leading zero to default volume if less than 1.
  1. .S:(X<1) X="0"_X
  1. .;**********
  1. .S BI("W")=X D PUT^DDSVALF(5,,,BI("W"),"I")
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. LOTDUP(BILIEN) ;EP
  1. ;---> Return 1 if the Lot# has a duplicate in the IMMUNIZATION LOT
  1. ;---> File; 0 if it is unique.
  1. ;---> Parameters:
  1. ; 1 - BILIEN (req) IEN of Lot# in IMMUNIZATION LOT File.
  1. ;
  1. Q:'$G(BILIEN) 0
  1. Q:'$D(^AUTTIML(BILIEN,0)) 0
  1. ;
  1. ;---> If Lot# is duplicated in the IMM LOT File, return 1.
  1. N Y,Z S Y=$P(^AUTTIML(BILIEN,0),U) S Z=$O(^AUTTIML("B",Y,0))
  1. Q:$O(^AUTTIML("B",Y,Z)) 1
  1. ;---> Lot# is unique, return 0.
  1. Q 0
  1. ;
  1. ;
  1. ;----------
  1. LOTHELP(BILIEN) ;EP
  1. ;---> If chosen Lot# is a duplicate, provide help message.
  1. ;---> Parameters:
  1. ; 1 - BILIEN (req) IEN of Lot# in IMMUNIZATION LOT File.
  1. N BIPOP,X
  1. Q:'$$LOTDUP(BILIEN)
  1. ;
  1. D TITLE^BIUTL5("DUPLICATE LOT NUMBERS")
  1. S X="--> Lot# "_$$LOTTX^BIUTL6(BILIEN)_" <--" D CENTERT^BIUTL5(.X)
  1. W X,!
  1. D
  1. .I $$MAYMANAG^BIUTL11 D Q
  1. ..D TEXT2^BIUTL6,DIRZ^BIUTL3(.BIPOP)
  1. ..Q:$G(BIPOP)
  1. ..D TITLE^BIUTL5("DUPLICATE LOT NUMBERS"),TEXT3^BIUTL6
  1. .D TEXT1^BIUTL6
  1. D:'$G(BIPOP) DIRZ^BIUTL3()
  1. D REFRESH^DDSUTL
  1. S BI("D")="",DDSBR=3 D PUT^DDSVALF(3)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. LOTSCR ;EP
  1. ;---> Set Screen for Lot Number selection in Screen field of
  1. ;---> "Form Only Field Parameters" of the Form BI FORM-IMM VISIT ADD/EDIT
  1. ;---> when selecting Lot Number.
  1. ;---> Screen: If this Lot Number is Active, AND if no Vaccine has been selected OR
  1. ;---> this Lot Number is assigned to the selected Vaccine,
  1. ;---> AND if EITHER [it has no specific Location] OR
  1. ;---> [its Location matches the user's Location (DUZ(2))].
  1. ;
  1. N BILOC S BILOC=$P($G(^AUTTIML(+Y,0)),U,14)
  1. ;
  1. ;---> Next line: Concat to avoid suspected naked ref.
  1. S DIR("S")="I $P(^"_"(0),U,3)=0,($G(BI(""B""))=""""!$D(^AUTTIML(""C"",+$G(BI(""B"")),Y)))"
  1. S DIR("S")=DIR("S")_",(('$P($G(^AUTTIML(Y,0)),U,14))!($P($G(^AUTTIML(Y,0)),U,14)=$G(DUZ(2))))"
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. LOTSEL(BIX) ;EP
  1. ;---> Action to take after Lot Number has been selected.
  1. ;---> Parameters:
  1. ; 1 - BIX (req) X=Internal Value of Lot Number selected.
  1. ;
  1. ;---> Executed from the "POST ACTION ON CHANGE" field of the
  1. ;---> "Form ONly Field Properties" of the Form BI FORM-IMM VISIT ADD/EDIT.
  1. ;
  1. ;---> Action: If a Vaccine was not chosen, but instead a Lot Number was entered first,
  1. ;---> then populate the Vaccine field on the form (which triggers VACCHG above).
  1. ;
  1. Q:'BIX
  1. ;
  1. D
  1. .;---> Don't change the Vaccine if it has already been selected.
  1. .Q:(+$G(BI("B")))
  1. .;---> Stuff Vaccine IEN for this Lot Number.
  1. .N BIVAC S BIVAC=$$LOTTX^BIUTL6(BIX,1)
  1. .D PUT^DDSVALF(2,,,BIVAC,"I")
  1. .D VACSEL(BIVAC)
  1. .D LOTWARN^BIUTL7($G(BI("D")),$G(BI("E")),$G(BI("F")))
  1. .D VISVOL(BIVAC)
  1. ;
  1. D
  1. .;---> Stuff default NDC IEN for this Lot Number.
  1. .Q:(+$G(BI("H")))
  1. .N BINDC S BINDC=$$LOTTX^BIUTL6(BIX,3)
  1. .I BINDC D PUT^DDSVALF(3.8,,,BINDC,"I")
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. NDCSCR ;EP
  1. ;---> Set Screen for NDC Code selection in Screen field of
  1. ;---> "Form Only Field Parameters" of the Form BI FORM-IMM VISIT ADD/EDIT
  1. ;---> when selecting NDC Code.
  1. ;---> Screen: If this NDC is Active, AND this NDC is assigned to the selected
  1. ;---> vaccine in BI("B").
  1. ;
  1. ;W !!,"This screen in NDCSCR^BIUTL4",! X ^O
  1. S DIR("S")="I $P(^BINDC(Y,0),U,6)'=1,$D(^BINDC(""C"",+$G(BI(""B"")),Y))"
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. CREASCR ;EP
  1. ;---> Set Screen for Contraindication Reason selection in Reason field
  1. ;---> "Form Only Field Parameters" of the Form BI FORM-CONTRAINDICATION ADD.
  1. ;---> Screen: If this Reason is Active AND if this Reason is Skin Test
  1. ;---> related AND this Vaccine is a Skin Test.
  1. ;
  1. ;---> If no vaccine chosen, then screen says all reasons are invalid.
  1. I '$G(BI("B")) S DIR("S")="I 0" Q
  1. ;
  1. S DIR("S")="I ($P(^BICONT(Y,0),U,3))&(+$P(^BICONT(Y,0),U,4)"
  1. S DIR("S")=DIR("S")_"=+$P(^AUTTIMM(BI(""B""),0),U,8))"
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. HISTORY(X) ;EP
  1. ;---> See BIUTL9.
  1. D HISTORY^BIUTL9(X)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. OLDDATE(X) ;EP
  1. ;---> Add/Edit Screenman actions to take ON POST-CHANGE of Date Field.
  1. ;---> If date entered is earlier than today, Category default changes to
  1. ;---> Historical. If the date is more than 5 days earlier than today,
  1. ;---> user as default Provider is removed.
  1. ;---> Parameters:
  1. ; 1 - X (opt) X=Internal Value of Date of Visit entered.
  1. ;
  1. ;
  1. ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. ;---> Make VIS Presented Date default to Visit Date (when changed).
  1. N BIDATEE S BIDATEE=X
  1. ;
  1. I '$G(BI("K"))&($P(X,".")'=DT) D
  1. .D PUT^DDSVALF(11,,,"E","I") S BI("I")="E"
  1. .I ($G(DT)-X)>5 D NOPROV^BIUTL7("E")
  1. .;
  1. .;********** PATCH 12, v8.5, MAY 01,2016, IHS/CMI/MWR
  1. .;---> If Date not today, set Injection Site and Volume fields not required.
  1. .D REQ^DDSUTL(4,"","",0),REQ^DDSUTL(5,"","",0)
  1. ;
  1. ;
  1. ;********** PATCH 10, v8.5, MAY 30,2015, IHS/CMI/MWR
  1. ;---> Only stuff VIS Presented Date if this is a V Imm.
  1. ;D PUT^DDSVALF(10.2,,,BIDATEE,"E") S BI("QQ")=BIDATEE
  1. I $G(BIVTYPE)="I" D PUT^DDSVALF(10.2,,,BIDATEE,"E") S BI("QQ")=BIDATEE
  1. ;
  1. ;********** PATCH 12, v8.5, MAY 01,2016, IHS/CMI/MWR
  1. ;---> Insert missing Q.
  1. Q
  1. ;**********
  1. ;
  1. ;
  1. ;----------
  1. SKINCHG(BISKIEN) ;EP
  1. ;---> Actions to take in Screenman when the Skin Test is selected
  1. ;---> or changed.
  1. ;---> Called by the POST ACTION ON CHANGE of Field 2, Skin Test"
  1. ;---> of the Form BI FORM-SKIN VISIT ADD/EDIT.
  1. ;---> Parameters:
  1. ; 1 - BISKIEN (opt) IEN of Vaccine IMMUNIZATION File (9999999.14).
  1. ; (Not used for now.)
  1. Q:'$G(BISKIEN)
  1. ;
  1. ;---> If this is NOT a new visit, inform user that Dose#, Lot#,
  1. ;---> Reaction, and VIS will be deleted and replaced.
  1. D:$G(BI("K"))
  1. .N BIMSG
  1. .S BIMSG="* NOTE: Because you have changed the Skin Test, the Result,"
  1. .S BIMSG=BIMSG_" Reading, Date of Reading, and Reader will be removed."
  1. .D HLP^DDSUTL(BIMSG),HLP^DDSUTL("$$EOP")
  1. ;
  1. ;---> Clear data relating to previous Skin Test (if any).
  1. D PUT^DDSVALF(3) S BI("L")="" ;Result
  1. D PUT^DDSVALF(4) S BI("M")="" ;Reading
  1. D PUT^DDSVALF(5) S BI("N")="" ;Date of Reading
  1. D PUT^DDSVALF(10) S BI("X")="" ;Reader
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. SERVAL(BIDOSE,BIVAC) ;EP
  1. ;---> Validate Dose# for this Immunization Visit.
  1. ;---> Parameters:
  1. ; 1 - BIDOSE (req) Dose# entered by the user.
  1. ; 2 - BIVAC (req) IEN of Vaccine IMMUNIZATION File (9999999.14).
  1. ;
  1. Q:'BIDOSE Q:'BIVAC
  1. S BIMAX=$$VMAX^BIUTL2(BIVAC)
  1. ;
  1. ;---> If Dose# entered is greater than Max Dose# for this Vaccine,
  1. ;---> reject value and display help text.
  1. I BIDOSE>BIMAX S DDSERROR=1 D
  1. .N Z
  1. .S Z="The Maximum Dose# for "_$$VNAME^BIUTL2(BIVAC)_" is "_BIMAX
  1. .S Z=Z_". Please enter a number between 1 and "_BIMAX_"."
  1. .D HLP^DDSUTL(Z)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. INACTV(X) ;EP
  1. ;---> Called by the POST ACTION of Field 4, "Inactive Date"
  1. ;---> of the Form BI FORM-CASE DATA EDIT.
  1. ;---> Actions to take in Screenman when Patient is made Inactive
  1. ;---> by adding a date to Field 4, Inactive Date, of the Form.
  1. ;---> Parameters:
  1. ; 1 - X (req) Internal value of the date entered.
  1. ;
  1. ;---> If no Inactive Date entered, set Reason="" and "Moved to"=""
  1. ;---> and disable navigation to and editing of the fields.
  1. I '$G(X) D Q
  1. .D PUT^DDSVALF(5),PUT^DDSVALF(5.5)
  1. .D UNED^DDSUTL(5,,,1),UNED^DDSUTL(5.5,,,1)
  1. .S (BI("F"),BI("I"))="@"
  1. ;---> A date has been entered, so enable edit and navigation.
  1. D UNED^DDSUTL(5,,,0),UNED^DDSUTL(5.5,,,0)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. LOCBR ;EP
  1. ;---> Location Type branching logic for Add/Edit Imm Visit Form:
  1. ;---> "Location" field.
  1. ;
  1. ;---> If Location Type is "Other":
  1. I (X="O")&($G(DDSOLD)'="O") D
  1. .;
  1. .;---> Disable IHS Loc (7) and put a null value in IHS Loc (7).
  1. .D UNED^DDSUTL(7,,,1),PUT^DDSVALF(7)
  1. .;
  1. .;---> Set IHS Location IEN in BI array =null (ADD+18^BIVISIT).
  1. .S BI("F")=""
  1. .;
  1. .;---> Enable Other Loc (8).
  1. .D UNED^DDSUTL(8,,,0)
  1. .;
  1. .;---> Make Other Loc required, and IHS Loc not required.
  1. .D REQ^DDSUTL(8,,,1),REQ^DDSUTL(7,,,0)
  1. ;
  1. ;
  1. ;---> If Location Type is "IHS":
  1. I (X="I")&($G(DDSOLD)'="I") D
  1. .;
  1. .;---> Disable Other Loc (8) and put a null value in Other Loc (8).
  1. .D UNED^DDSUTL(8,,,1),PUT^DDSVALF(8)
  1. .;
  1. .;---> Set Outside Location text in BI array =null (ADD+19^BIVISIT).
  1. .S BI("G")=""
  1. .;
  1. .;---> Enable IHS Loc (7).
  1. .D UNED^DDSUTL(7,,,0)
  1. .;
  1. .;---> Make IHS Loc required, and Other Loc not required.
  1. .D REQ^DDSUTL(7,,,1),REQ^DDSUTL(8,,,0),DEFSITE
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. VISDATE ;EP
  1. ;---> Enable/disable and if necessary clear VIS Date, based on
  1. ;---> YES/NO answer of VIS Given question.
  1. ;
  1. ;---> If VIS Given=YES (1), then enable editing of VIS Date.
  1. I X=1 D Q
  1. .D UNED^DDSUTL(13,,,0)
  1. .;---> If no VIS Date present, get default from IMMUNIZATION File.
  1. .Q:$$GET^DDSVALF(13)
  1. .N BIY S BIY=$$GET^DDSVALF(2)
  1. .D PUT^DDSVALF(13,,,$$VISDEF^BIUTL2(BIY))
  1. ;
  1. ;---> Otherwise, stuff null in VIS Date and make it uneditable.
  1. D PUT^DDSVALF(13) S BI("Q")=""
  1. D UNED^DDSUTL(13,,,1)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DEFSITE ;EP
  1. ;---> Code to stuff default Location of Visit in Add/Edit Imm Visit
  1. ;---> form. If Location Type is IHS and current value is null,
  1. ;---> stuff user's DUZ(2) as default.
  1. ;
  1. Q:$$GET^DDSVALF(6)'="I"
  1. Q:$$GET^DDSVALF(7)]""
  1. D PUT^DDSVALF(7,"","",DUZ(2),"I")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. BADREAD ;EP
  1. ;---> Code to check Skin Test results: If the result is Negative,
  1. ;---> the Reading must be <15mm; in that case,
  1. ;---> display help message and reject value.
  1. ;
  1. N X
  1. S X="If the result is NEGATIVE, the Reading must be less than 15 millimeters."
  1. D HLP^DDSUTL(X)
  1. S DDSERROR=""
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. BADRDAT ;EP
  1. ;---> If the Read Date is earlier than the initial visit date or later
  1. ;---> than today, advise and return to Read Date field.
  1. ;
  1. I Y<$$GET^DDSVALF(1) S DDSERROR="" D Q
  1. .D HLP^DDSUTL(" * Date of Reading may not be prior to date of initial visit.")
  1. I Y>DT S DDSERROR="" D Q
  1. .D HLP^DDSUTL(" * Date of Reading may not be later than today.")
  1. Q