BIDUR1 ;IHS/CMI/MWR - RETRIEVE/STORE PATIENTS.; MAY 10, 2010
;;8.5;IMMUNIZATION;;SEP 01,2011
;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
;; RETRIEVE/STORE PATIENTS FOR DUE LISTS & LETTERS.
;
;
;----------
STORE(BIDFN,BIFDT,BIORD,BIERR,BIVAL,BISITE) ;EP
;---> Store this patient in the Order specified.
;---> Parameters:
; 1 - BIDFN (req) Patient's IEN (DFN).
; 2 - BIFDT (req) Forecast date.
; 3 - BIORD (req) Order of listing (default=1, by age).
; 4 - BIERR (ret) Error Code.
; 5 - BIVAL (opt) Value to set ^TMP(Patient...) node equal to.
; 6 - BISITE (req) Site IEN.
;
;---> Check for required Variables.
I '$G(BIDFN) S BIERR=201 Q
I '$G(BIFDT) S BIERR=616 Q
S:'$G(BIORD) BIORD=1
S:'$G(BISITE) BISITE=$G(DUZ(2)) I '$G(BISITE) S BIERR=109 Q
;
;---> Store this patient in the Order specified:
;
;---> By Patient Alphabetically.
I BIORD=2 D Q
.N X,Y,Z
.S X=1,Y=1,Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By HRCN/Chart#.
I BIORD=3 D Q
.N X,Y,Z
.S X=1,Y=1,Z=$$HRCN^BIUTL1(BIDFN,BISITE,1)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Case Manager.
I BIORD=4 D Q
.N X,Y,Z
.S X=$$CMGR^BIUTL1(BIDFN,1),Y=1,Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Case Manager, then Current Community.
I BIORD=5 D Q
.N X,Y,Z
.S X=$$CMGR^BIUTL1(BIDFN,1),Y=$$CURCOM^BIUTL11(BIDFN,1)
.S Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Current Community, then Case Manager.
I BIORD=6 D Q
.N X,Y,Z
.S X=$$CURCOM^BIUTL11(BIDFN,1),Y=$$CMGR^BIUTL1(BIDFN,1)
.S Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Current Community, then Patient Age.
I BIORD=7 D Q
.N X,Y,Z
.S X=$$CURCOM^BIUTL11(BIDFN,1),Y=9999999-$$DOB^BIUTL1(BIDFN)
.S Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Current Community, then Patient Name.
I BIORD=8 D Q
.N X,Y,Z
.S X=$$CURCOM^BIUTL11(BIDFN,1),Y=1,Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Current Community, then Patient Chart#.
I BIORD=9 D Q
.N X,Y,Z
.S X=$$CURCOM^BIUTL11(BIDFN,1),Y=1,Z=$$HRCN^BIUTL1(BIDFN,BISITE,1)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Zipcode, then Patient Name.
I BIORD=10 D Q
.N X,Y,Z
.S X=$$ZIP^BIUTL1(BIDFN),Y=1,Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Designated Provider.
I BIORD=11 D Q
.N X,Y,Z
.S X=$$DPRV^BIUTL1(BIDFN,1),Y=1,Z=$$NAME^BIUTL1(BIDFN)
.S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
;
;---> By Patient Age (Default, BIORD=1).
N X,Y,Z
S X=1,Y=9999999-$$DOB^BIUTL1(BIDFN),Z=$$NAME^BIUTL1(BIDFN)
S ^TMP("BIDUL",$J,X,Y,Z,BIDFN)=$G(BIVAL)
Q
;
;
;----------
BENT(BIDFN,BIBEN) ;EP
;---> Beneficiary Type indicator.
;---> Return 1 if not selecting all Beneficiary Types and if this
;---> patient's Beneficiary Type is not one of the ones selected.
;
Q:'$G(BIDFN) 1
Q:$D(BIBEN("ALL")) 0
N BIBENT S BIBENT=$$BENTYP^BIUTL11(BIDFN)
Q:'BIBENT 1
Q:'$D(BIBEN(BIBENT)) 1
Q 0
BIDUR1 ;IHS/CMI/MWR - RETRIEVE/STORE PATIENTS.; MAY 10, 2010
+1 ;;8.5;IMMUNIZATION;;SEP 01,2011
+2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
+3 ;; RETRIEVE/STORE PATIENTS FOR DUE LISTS & LETTERS.
+4 ;
+5 ;
+6 ;----------
STORE(BIDFN,BIFDT,BIORD,BIERR,BIVAL,BISITE) ;EP
+1 ;---> Store this patient in the Order specified.
+2 ;---> Parameters:
+3 ; 1 - BIDFN (req) Patient's IEN (DFN).
+4 ; 2 - BIFDT (req) Forecast date.
+5 ; 3 - BIORD (req) Order of listing (default=1, by age).
+6 ; 4 - BIERR (ret) Error Code.
+7 ; 5 - BIVAL (opt) Value to set ^TMP(Patient...) node equal to.
+8 ; 6 - BISITE (req) Site IEN.
+9 ;
+10 ;---> Check for required Variables.
+11 IF '$GET(BIDFN)
SET BIERR=201
QUIT
+12 IF '$GET(BIFDT)
SET BIERR=616
QUIT
+13 IF '$GET(BIORD)
SET BIORD=1
+14 IF '$GET(BISITE)
SET BISITE=$GET(DUZ(2))
IF '$GET(BISITE)
SET BIERR=109
QUIT
+15 ;
+16 ;---> Store this patient in the Order specified:
+17 ;
+18 ;---> By Patient Alphabetically.
+19 IF BIORD=2
Begin DoDot:1
+20 NEW X,Y,Z
+21 SET X=1
SET Y=1
SET Z=$$NAME^BIUTL1(BIDFN)
+22 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+23 ;
+24 ;---> By HRCN/Chart#.
+25 IF BIORD=3
Begin DoDot:1
+26 NEW X,Y,Z
+27 SET X=1
SET Y=1
SET Z=$$HRCN^BIUTL1(BIDFN,BISITE,1)
+28 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+29 ;
+30 ;---> By Case Manager.
+31 IF BIORD=4
Begin DoDot:1
+32 NEW X,Y,Z
+33 SET X=$$CMGR^BIUTL1(BIDFN,1)
SET Y=1
SET Z=$$NAME^BIUTL1(BIDFN)
+34 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+35 ;
+36 ;---> By Case Manager, then Current Community.
+37 IF BIORD=5
Begin DoDot:1
+38 NEW X,Y,Z
+39 SET X=$$CMGR^BIUTL1(BIDFN,1)
SET Y=$$CURCOM^BIUTL11(BIDFN,1)
+40 SET Z=$$NAME^BIUTL1(BIDFN)
+41 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+42 ;
+43 ;---> By Current Community, then Case Manager.
+44 IF BIORD=6
Begin DoDot:1
+45 NEW X,Y,Z
+46 SET X=$$CURCOM^BIUTL11(BIDFN,1)
SET Y=$$CMGR^BIUTL1(BIDFN,1)
+47 SET Z=$$NAME^BIUTL1(BIDFN)
+48 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+49 ;
+50 ;---> By Current Community, then Patient Age.
+51 IF BIORD=7
Begin DoDot:1
+52 NEW X,Y,Z
+53 SET X=$$CURCOM^BIUTL11(BIDFN,1)
SET Y=9999999-$$DOB^BIUTL1(BIDFN)
+54 SET Z=$$NAME^BIUTL1(BIDFN)
+55 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+56 ;
+57 ;---> By Current Community, then Patient Name.
+58 IF BIORD=8
Begin DoDot:1
+59 NEW X,Y,Z
+60 SET X=$$CURCOM^BIUTL11(BIDFN,1)
SET Y=1
SET Z=$$NAME^BIUTL1(BIDFN)
+61 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+62 ;
+63 ;---> By Current Community, then Patient Chart#.
+64 IF BIORD=9
Begin DoDot:1
+65 NEW X,Y,Z
+66 SET X=$$CURCOM^BIUTL11(BIDFN,1)
SET Y=1
SET Z=$$HRCN^BIUTL1(BIDFN,BISITE,1)
+67 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+68 ;
+69 ;---> By Zipcode, then Patient Name.
+70 IF BIORD=10
Begin DoDot:1
+71 NEW X,Y,Z
+72 SET X=$$ZIP^BIUTL1(BIDFN)
SET Y=1
SET Z=$$NAME^BIUTL1(BIDFN)
+73 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+74 ;
+75 ;---> By Designated Provider.
+76 IF BIORD=11
Begin DoDot:1
+77 NEW X,Y,Z
+78 SET X=$$DPRV^BIUTL1(BIDFN,1)
SET Y=1
SET Z=$$NAME^BIUTL1(BIDFN)
+79 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
End DoDot:1
QUIT
+80 ;
+81 ;---> By Patient Age (Default, BIORD=1).
+82 NEW X,Y,Z
+83 SET X=1
SET Y=9999999-$$DOB^BIUTL1(BIDFN)
SET Z=$$NAME^BIUTL1(BIDFN)
+84 SET ^TMP("BIDUL",$JOB,X,Y,Z,BIDFN)=$GET(BIVAL)
+85 QUIT
+86 ;
+87 ;
+88 ;----------
BENT(BIDFN,BIBEN) ;EP
+1 ;---> Beneficiary Type indicator.
+2 ;---> Return 1 if not selecting all Beneficiary Types and if this
+3 ;---> patient's Beneficiary Type is not one of the ones selected.
+4 ;
+5 IF '$GET(BIDFN)
QUIT 1
+6 IF $DATA(BIBEN("ALL"))
QUIT 0
+7 NEW BIBENT
SET BIBENT=$$BENTYP^BIUTL11(BIDFN)
+8 IF 'BIBENT
QUIT 1
+9 IF '$DATA(BIBEN(BIBENT))
QUIT 1
+10 QUIT 0