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

BMCFPIN.m

Go to the documentation of this file.
BMCFPIN ; IHS/ITSC/FCJ - PRINT IN-HOUSE REFERRAL FORM ;     
 ;;4.0;REFERRED CARE INFO SYSTEM;**9**;JAN 09, 2006;Build 101
 ;IHS/ITSC/FCJ
 ;ORIGINAL ROUTINE FROM BMCFPRN
 ;11-1-12 BMC*4.0*9 IHS.OIT.FCJ ADDED ICD-10 CALL
 ;
PRINT ;
 ;print referral form
 S BMCR0=^BMCREF(BMCREF,0),BMCPG=0,BMCDFN=$P(BMCR0,U,3)
 D @("HEAD"_(2-($E(IOST,1,2)="C-")))
 S BMCQUIT=0
 I $$VAL^XBDIQ1(90001,BMCREF,.04)'="IN-HOUSE" W !,"   Please select an IN-HOUSE Referral" S BMCQUIT=1 Q
 D REFTYP,REFTO,DATE,PURPOSE Q
REFTYP ;REFERRAL TYPE  
 D L
 S X="In-House Referral",N=1,C=1,T=0 D W Q:BMCQUIT
 W !
 S X="Referral Number: "_$$VAL^XBDIQ1(90001,BMCREF,.02),N=0,C=1,T=0 D W Q:BMCQUIT
 Q
REFTO ;
 D L
 S X="Referred to:  "_$$VAL^XBDIQ1(90001,BMCREF,.23)_" clinic",N=1,C=0,T=0 D W Q:BMCQUIT
 S X="Address:  "_$$VAL^XBDIQ1(9999999.06,DUZ(2),.14),N=1,C=0,T=4 D W Q:BMCQUIT
 S X=$$VAL^XBDIQ1(9999999.06,DUZ(2),.15)_",",N=1,C=0,T=14 D W Q:BMCQUIT
 S X=$$VAL^XBDIQ1(9999999.06,DUZ(2),.16),N=0,C=0,T=0 D W Q:BMCQUIT
 S X="  "_$$VAL^XBDIQ1(9999999.06,DUZ(2),.17),N=0,C=0,T=0 D W Q:BMCQUIT
 Q
DATE ;
 D L
 S X=$$VAL^XBDIQ1(90001,BMCREF,.14)_" Services",N=1,C=1,T=0 D W Q:BMCQUIT
 S X=$S($P(BMCR0,U,14)="I":"Admission Date",1:"Appointment Date")_":  "_$$AVDOS^BMCRLU(BMCREF,"E"),N=1,C=0,T=0 D W Q:BMCQUIT
 S X="Expected Ending Date: "_$$VAL^XBDIQ1(90001,BMCREF,1107),C=0,T=40,N=0 D W Q:BMCQUIT
 I $P($G(^BMCREF(BMCREF,0)),U,14)="O" S X="# of Outpatient Visits: "_$$VAL^XBDIQ1(90001,BMCREF,1111),C=0,T=0,N=1 D W Q:BMCQUIT
 D L Q
PURPOSE ;
 S X="Purpose/Services Requested: "_$$VAL^XBDIQ1(90001,BMCREF,1201)
 I $L(X)>IOM D  I 1
 .S BMCX=X S X=$E(BMCX,1,IOM),N=1,C=0,T=0 D W Q:BMCQUIT
 .S X=$E(BMCX,(IOM+1),IOM),N=1,C=0,T=22 D W Q:BMCQUIT
 E  S C=0,N=1,T=0 D W Q:BMCQUIT
 ;CHECK FOR DX
 I $D(^BMCDX("AD",BMCREF)) D
 .W !,"DIAGNOSIS: "
 .S BMCX=0,X=0 F  S BMCX=$O(^BMCDX("AD",BMCREF,BMCX)) Q:BMCX'?1N.N  D
 ..S X=X+1 W:X>1 ", "
 ..;BMC*4.0*9 11-1-12 IHS/OIT/FCJ;NEW LINE FOR ICD-10 CHANGES
 ..;W $$VAL^XBDIQ1(90001.01,BMCX,.01)
 ..S BMCDOS=$$AVDOS^BMCRLU(BMCRIEN,"N")            ;BMC*4.0*9
 ..W $P($$ICDDX^ICDEX($P(^BMCDX(BMCX,0),U),BMCDOS,,"I"),U,2)
 ;CHECK FOR CPT
 I $D(^BMCPX("AD",BMCREF)) D
 .W !,"PROCEDURE: "
 .S BMCX=0,X=0 F  S BMCX=$O(^BMCPX("AD",BMCREF,BMCX)) Q:BMCX'?1N.N  D
 ..S X=X+1 W:X>1 ", "
 ..W $$VAL^XBDIQ1(90001.02,BMCX,.01)
 D L
PERTMED ;
 S X="Pertinent Medical History: ",C=0,T=0,N=1 D W Q:BMCQUIT
 S BMCCMT=0
 F  S BMCCMT=$O(^BMCCOM("AD",BMCREF,BMCCMT)) Q:BMCCMT'?1N.N  D
 .Q:$P(^BMCCOM(BMCCMT,0),U,5)'="M"
 .S BMCNODE=1,BMCIOM=70,BMCFILE=90001.03,BMCDA=BMCCMT
 .D WP K BMCIOM
 .S Y=0 F  S Y=$O(BMCWP(Y)) Q:Y'=+Y!(BMCQUIT)  D
 ..I $Y>(IOSL-3) D HEAD Q:BMCQUIT
 ..W !?5,BMCWP(Y)
ADDMED ;
 D L
 S X="Additional Medical Information Attached:  "_$S($$VAL^XBDIQ1(90001,BMCREF,.34)]"":$$VAL^XBDIQ1(90001,BMCREF,.34),1:" Not Documented by Provider"),C=0,T=0,N=1 D W Q:BMCQUIT
FLUP ;FOLLOW UP INFO   
 D L
 W "Follow up visit MUST be approved by an IHS physcian.",!,"Please provide additional Notes:  ",!!!!
PRIORITY ;
 D L
 S X="Procedure Category:  "_$$VAL^XBDIQ1(90001,BMCREF,.13),C=0,T=0,N=1 D W Q:BMCQUIT
 S X="Medical Priority:  "_$$VAL^XBDIQ1(90001,BMCREF,.32),C=0,T=54,N=0 D W Q:BMCQUIT
 S X="Review/Approval by CHS/Managed Care Committee",C=1,T=0,N=2 D W Q:BMCQUIT
 W !! F I=1:1:40 W "_"
 W ?45,"____________________"
 W !,"SIGNATURE",?45,"DATE"
REFFROM ;
 D L
 W "Referring Facility:  ",$$VAL^XBDIQ1(9999999.06,DUZ(2),.01)
 W !,"Referring Provider:  "
 W !! F I=1:1:40 W "_"
 W ?45,"____________________"
 W !,"SIGNATURE",?45,"DATE",!
DEMO ;Demographic Data
 Q:BMCQUIT
 S X="Patient Identification (Name,DOB and HRN)",C=0,T=0,N=1 D W Q:BMCQUIT
 S X="Patient Name:  "_$$VAL^XBDIQ1(90001,BMCREF,.03),C=0,T=0,N=1 D W Q:BMCQUIT
 S X="DOB:  "_$$VAL^XBDIQ1(2,$P(BMCR0,U,3),.03),N=1,T=0,C=0 D W Q:BMCQUIT
 S X="Health Record Number:  "_$$HRN^AUPNPAT($P(BMCR0,U,3),DUZ(2),2),N=0,T=40,C=0 D W Q:BMCQUIT
ADDINFO ;
 D L
 S X="INCLUDE WHICH OF THE FOLLOWING ITEMS?",C=0,T=0,N=1 D W Q:BMCQUIT
 W !,"PCC VISIT FORM: ",$$VAL^XBDIQ1(90001,BMCREF,401)
 W ?28,"SPECIALTY CLINIC NOTES: ",$$VAL^XBDIQ1(90001,BMCREF,402)
 W ?55,"PRENATAL RECORD/S: ",$$VAL^XBDIQ1(90001,BMCREF,403)
 W !,"FACE SHEET: ",$$VAL^XBDIQ1(90001,BMCREF,405)
 W ?28,"HEALTH SUMMARY: ",$$VAL^XBDIQ1(90001,BMCREF,406)
 W ?55,"MOST RECENT EKG: ",$$VAL^XBDIQ1(90001,BMCREF,407)
 W !,"HISTORY AND PHYSICAL: ",$$VAL^XBDIQ1(90001,BMCREF,408)
 W ?28,"E-RAY/REPORT: ",$$VAL^XBDIQ1(90001,BMCREF,409)
 W ?55,"MOST RECENT LAB REPORT: ",$$VAL^XBDIQ1(90001,BMCREF,412)
 W !?32,"E-RAY FILM: ",$$VAL^XBDIQ1(90001,BMCREF,410)
 W !,"ADDITIONAL DOCUMENTS: "
 S BMCNODE=5,BMCIOM=70,BMCFILE=90001,BMCDA=BMCREF D WP K BMCIOM
 S Y=0 F  S Y=$O(BMCWP(Y)) Q:Y'=+Y!(BMCQUIT)  D
 .I $Y>(IOSL-3) D HEAD Q:BMCQUIT
 .W !?5,BMCWP(Y)
 Q
W ;
 Q:X=""
 NEW %
 S %=$L(X)
 I $Y>(IOSL-4) D HEAD Q:BMCQUIT
 I N F I=1:1:N W !
 I $G(C) W ?(IOM-$L(X)/2),X Q
 S %=$S($G(T):T,1:0) W ?%,X
 Q
L ;
 S T=0,X=$TR($J(" ",IOM)," ","_") S N=1,C=0 D W Q:BMCQUIT
 Q
D ;
 S T=0,X=$TR($J(" ",IOM)," ","-") S N=1,C=0 D W Q:BMCQUIT
 Q
S ;
 S T=0,X=$TR($J(" ",IOM)," ","*") S N=1,C=0 D W Q:BMCQUIT
 Q
WP ;
 D WP^BMCFDR
 Q
 NEW N,T,C,X,Y
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BMCQUIT=1 Q
HEAD1 ;
 W:$D(IOF) @IOF
HEAD2 ;
 I 'BMCPG S BMCPG=BMCPG+1 Q
 S BMCPG=BMCPG+1 W:$D(IOF) @IOF W !,?(IOM-20),"Page ",BMCPG
 Q