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

BIPATER1.m

Go to the documentation of this file.
  1. BIPATER1 ;IHS/CMI/MWR - EDIT PATIENT ERRORS.; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;;SEP 01,2011
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; EDIT/DELETE PATIENT ERRORS.
  1. ;
  1. ;
  1. ;----------
  1. INIT(BIT,BIACT) ;EP
  1. ;---> Initialize variables and list array.
  1. ;---> Parameters:
  1. ; 1 - BIT (ret) Total Patient Errors.
  1. ; 2 - BIACT (opt) BIACT=1 include ONLY ACTIVE Patients;
  1. ; BIACT=""/0 include ALL PATIENTS.
  1. ;
  1. S VALMSG="Enter ?? for more actions."
  1. S VALM("TITLE")=" (Immunization v"_$$VER^BILOGO_")"
  1. ;
  1. ;---> Order Patient Errors and get Total Patients for Header.
  1. K ^TMP("BIPTER",$J),^TMP("BIPTER1",$J),^TMP("BIPTER2",$J)
  1. ;
  1. ;---> First, order the errors by DOB,Patient Name.
  1. N BIIEN S BIIEN=0
  1. F S BIIEN=$O(^BIPERR(BIIEN)) Q:'BIIEN D
  1. .N BIDFN,BIDOB,BINAME
  1. .S BIDFN=$P(^BIPERR(BIIEN,0),U)
  1. .;
  1. .;---> Quit if report is ACTIVE ONLY and this patient is not Active.
  1. .I $G(BIACT) Q:$$ACTIVE^BIUTL1(BIDFN)'="Active"
  1. .;
  1. .S BIDOB=9999999-$$DOB^BIUTL1(BIDFN),BINAME=$$NAME^BIUTL1(BIDFN)
  1. .;---> If there's a bogus patient error, delete the error and quit.
  1. .I ('BIDFN)!(BINAME="") D Q
  1. ..N DA,DIK S DA=BIIEN,DIK="^BIPERR(" D ^DIK
  1. .;---> Store in order.
  1. .S ^TMP("BIPTER1",$J,BIDOB,BINAME,BIIEN)=^BIPERR(BIIEN,0)
  1. .S BIT=$G(BIT)+1
  1. ;
  1. ;---> Now place Patient Error lines in Listmanager array.
  1. N BIENT,BILINE,BIN
  1. S (BIENT,BILINE,BIN,BIT)=0
  1. F S BIN=$O(^TMP("BIPTER1",$J,BIN)) Q:'BIN D
  1. .N BIM S BIM=0
  1. .F S BIM=$O(^TMP("BIPTER1",$J,BIN,BIM)) Q:BIM="" D
  1. ..N BIIEN S BIIEN=0
  1. ..F S BIIEN=$O(^TMP("BIPTER1",$J,BIN,BIM,BIIEN)) Q:'BIIEN D
  1. ...N BI0 S BI0=^TMP("BIPTER1",$J,BIN,BIM,BIIEN)
  1. ...N BIDFN S BIDFN=$P(BI0,U)
  1. ...;
  1. ...;---> Set Item# and build Item# array=IEN of Vaccine.
  1. ...S BIENT=BIENT+1,^TMP("BIPTER2",$J,BIENT)=BIIEN
  1. ...;
  1. ...;---> Item#.
  1. ...S X=" "_$S(BIENT<10:" "_BIENT,BIENT<100:" "_BIENT,1:BIENT)
  1. ...;
  1. ...;---> Patient Name.
  1. ...S X=X_" "_$E($$NAME^BIUTL1(BIDFN),1,25)
  1. ...S X=$$PAD^BIUTL5(X,33,".")
  1. ...;
  1. ...;---> Active Status.
  1. ...S X=X_$E($$ACTIVE^BIUTL1(BIDFN))_" "
  1. ...;
  1. ...;---> Chart#.
  1. ...S X=X_$J($$HRCN^BIUTL1(BIDFN,$G(DUZ(2))),6)
  1. ...S X=$$PAD^BIUTL5(X,47," ")
  1. ...;
  1. ...;---> Age.
  1. ...N Y S Y=$$AGEF^BIUTL1(BIDFN)
  1. ...S Y=$P(Y," ")_$E($P(Y," ",2)) S:+Y<10 Y=" "_Y
  1. ...S X=X_Y
  1. ...;
  1. ...;---> Vaccine Group.
  1. ...S X=$$PAD^BIUTL5(X,53," ")
  1. ...S X=X_$P(BI0,U,3)
  1. ...;
  1. ...;---> Error Text.
  1. ...S X=$$PAD^BIUTL5(X,60," ")
  1. ...D ERRCD^BIUTL2($P(BI0,U,2),.Y,,1)
  1. ...S X=X_Y
  1. ...;
  1. ...;---> Set this Patient Error display row and index in ^TMP.
  1. ...D WRITE(.BILINE,X,,BIENT)
  1. ...S BIT=$G(BIT)+1
  1. ;
  1. I BILINE=0 D
  1. .N X S X=" Currently there are no Patient Errors stored"
  1. .S:$G(BIACT) X=X_" for ACTIVE Patients" S X=X_"."
  1. .D WRITE(.BILINE),WRITE(.BILINE,X)
  1. ;
  1. ;---> Finish up Listmanager List Count.
  1. S VALMCNT=BILINE
  1. I VALMCNT>13 D
  1. .S VALMSG="Scroll down to view more. Type ?? for more actions."
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. WRITE(BILINE,BIVAL,BIBLNK,BIENT) ;EP
  1. ;---> Write lines to ^TMP (see documentation in ^BIW).
  1. ;---> Parameters:
  1. ; 1 - BILINE (ret) Last line# written.
  1. ; 2 - BIVAL (opt) Value/text of line (Null=blank line).
  1. ;
  1. Q:'$D(BILINE)
  1. D WL^BIW(.BILINE,"BIPTER",$G(BIVAL),$G(BIBLNK),$G(BIENT))
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. EDITDEL(BIX) ;EP
  1. ;---> Edit/Delete a Patient Error.
  1. ;---> Parameters:
  1. ; 1 - BIX (opt) If BIX="" call Edit, if BIX=1 call Delete.
  1. ;
  1. ;---> Call the Listmanager Generic Selector of items displayed.
  1. N VALMY
  1. D EN^VALM2(XQORNOD(0),"OS")
  1. ;
  1. ;---> Check that a Listman Item was passed.
  1. I '$D(VALMY) D ERRCD^BIUTL2(406,,1) D RESET^BIPATER Q
  1. ;---> Now set Y=Item# selected from the list.
  1. N Y S Y=$O(VALMY(0))
  1. I '$G(Y) D ERRCD^BIUTL2(406,,1) D RESET^BIPATER Q
  1. ;
  1. N BIIEN S BIIEN=$G(^TMP("BIPTER2",$J,Y))
  1. I 'BIIEN D ERRCD^BIUTL2(661,,1) D RESET^BIPATER Q
  1. ;
  1. ;---> If this is a call to DELETE an error, delete it and quit.
  1. I $G(BIX) D Q
  1. .N DA,DIK S DA=BIIEN,DIK="^BIPERR("
  1. .D ^DIK,RESET^BIPATER
  1. ;
  1. ;---> This must be a call to EDIT and error.
  1. N BIDFN S BIDFN=$P($G(^BIPERR(BIIEN,0)),U)
  1. I 'BIDFN D ERRCD^BIUTL2(216,,1) D RESET^BIPATER Q
  1. ;
  1. D
  1. .N BIACT
  1. .D HAVEPAT^BIPATVW(BIDFN,DT)
  1. D RESET^BIPATER
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DELALL ;EP
  1. ;---> Clear/Delete ALL Patient Errors.
  1. ;
  1. W !!?3,"Do you REALLY wish to delete ALL Patient Errors?"
  1. S DIR("?")=" Enter YES to DELETE ALL Patient Errors."
  1. S DIR(0)="Y",DIR("A")=" Enter Yes or No",DIR("B")="NO"
  1. D ^DIR W !
  1. I $D(DIRUT)!('Y) D Q
  1. .W !!?3,"No changes made." D DIRZ^BIUTL3()
  1. ;
  1. D ZGBL^BIUTL8("^BIPERR(")
  1. D RESET^BIPATER
  1. Q