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

BOPT2.m

Go to the documentation of this file.
  1. BOPT2 ;IHS/ILC/ALG/CIA/PLS - ILC Send and Receive (cont);28-Feb-2006 14:42;SM
  1. ;;1.0;AUTOMATED DISPENSING INTERFACE;**1**;Jul 26, 2005
  1. ;not an entry point
  1. Q
  1. MSH ;EP - Build Header
  1. ;set encoding characrters
  1. N MCID,PROCID,VERID,TIME,OUT1
  1. S FLD="|",HLFS="|"
  1. S ENCD="^~\&",HLECH="^~\&"
  1. S COM=$E(ENCD,1)
  1. S REP=$E(ENCD,2)
  1. S ESC=$E(ENCD,3)
  1. S SCOM=$E(ENCD,4)
  1. ;GET DATA
  1. S RECAPP=$P($G(^BOP(90355,1,0)),U,3)
  1. S:RECAPP="" RECAPP="AOW-MEDSTN"
  1. S MCID=$P(NODE,"^",7)
  1. S PROCID=$P(NODE,"^",8)
  1. S VERID=$P(NODE,"^",9)
  1. S SNDAPP=RECAPP
  1. S NODE1=$G(^BOP(90355.1,COUNTER,1))
  1. S SITE=$P(NODE1,"^",11)
  1. S TIME=$P(NODE,"^",5)
  1. S TIME=$$HLDATE^HLFNC(TIME),TIME=$P(TIME,"-",1)
  1. S OUT1=$C(11)_"MSH"_FLD_ENCD_FLD_SNDAPP_FLD_SITE_FLD_RECAPP_FLD_FLD_TIME_FLD_FLD_TYPE_COM_ACTION
  1. S OUT1=OUT1_FLD_MCID_FLD_PROCID_FLD_VERID_"|"_$C(13)
  1. S CONT=CONT+1
  1. S OUT(CONT)=OUT1
  1. Q
  1. EVN ;EP - BUILD EVENT SEGMENT
  1. N EVNDT,OUT2
  1. S EVNDT=$P(NODE,"^",3)
  1. S:$P(EVNDT,".",2)=24 $P(EVNDT,".",2)=2359
  1. S EVNDT=$$HLDATE^HLFNC(EVNDT),EVNDT=$P(EVNDT,"-",1)
  1. S OUT2="EVN"_FLD_ACTION_FLD_EVNDT_"|||"_$C(13)
  1. S CONT=CONT+1
  1. S OUT(CONT)=OUT2
  1. Q
  1. PID ;EP - BUILD PID
  1. N PID1,PNAM,BDAY,SEX,RACE,PHH,PHW,PAN,SSN,OUT3,ADR,BOPWHO,X
  1. S PID1=$P(NODE1,"^",2)
  1. S X=$P(NODE1,"^",3)
  1. S PNAM=$$HLNAME^HLFNC(X)
  1. S BDAY=$P(NODE1,"^",4)
  1. I $E(BDAY,4,5)="00" S $E(BDAY,4,5)="01"
  1. I $E(BDAY,6,7)="00" S $E(BDAY,6,7)="01"
  1. S BDAY=$$HLDATE^HLFNC(BDAY),BDAY=$P(BDAY,"-",1)
  1. S SEX=$P(NODE1,"^",5)
  1. S RACE=$P(NODE1,"^",6)
  1. S ADR=$$ADRFIX(NODE1)
  1. S PHH=$P(NODE1,"^",12)
  1. S PHW=$P(NODE1,"^",13)
  1. S PAN=$P(NODE1,"^",14)
  1. S SSN=$P(NODE1,"^",15)
  1. ;
  1. ; for omnicell
  1. S BOPWHO=$$INTFACE^BOPTU(1) I $G(BOPWHO)="O" S (BDAY,SEX,ADDR,PHH,PHW)=""
  1. S OUT3="PID"_FLD_$G(BOPWHO)_FLD_FLD_PID1_COM_COM_COM_SITE_FLD_FLD_PNAM_FLD_FLD_BDAY ;DUG 2/11/04
  1. S OUT3=OUT3_FLD_SEX_FLD_FLD_FLD_ADR_FLD_FLD_PHH_FLD_PHW_FLD_FLD_FLD_FLD
  1. S OUT3=OUT3_PAN_"|"_$C(13)
  1. S CONT=CONT+1
  1. S OUT(CONT)=OUT3
  1. Q
  1. ;
  1. ADRFIX(DATA) ;FIX ADDRESS TO HL7
  1. N ADR1,ADR2,ADR3,ADR4
  1. S ADR1=$P(DATA,"^",7)
  1. S ADR2=$P(DATA,"^",8)
  1. S ADR3=$P(DATA,"^",9)
  1. S ADR4=$P(DATA,"^",10)
  1. Q ADR1_COM_ADR2_COM_ADR3_COM_ADR4
  1. ;
  1. PV1 ;EP - Build PV1
  1. N OUT4,PCLSS,LOCAT,LOCAT2,PLOCAT,PDOC,SERV,ACTSAT,ADMTM,BOPWHO
  1. S NODE10=^BOP(90355.1,COUNTER,10)
  1. S PCLSS=$P(NODE10,"^",1)
  1. ;
  1. ;Location
  1. S LOCAT=$P(NODE10,"^",2)
  1. ;
  1. ;Room/Bed
  1. S LOCAT2=$P(NODE10,"^",3)
  1. ;
  1. S OLDLOC=$P(NODE10,"^",10)
  1. S PTYPE=$P(NODE10,U,11)
  1. ;handle room and bed
  1. S X=$P(NODE10,"^",4)
  1. S PDOC=$$HLNAME^HLFNC(X)
  1. ; new code for consult doc
  1. S X=$P(NODE10,"^",20)
  1. S CDOC=$$HLNAME^HLFNC(X) S:CDOC'="" CDOC=COM_CDOC
  1. ; end of code
  1. S SERV=$P(NODE10,"^",5)
  1. ;
  1. ;Defaults
  1. I '$G(BOPTYPE) S BOPTPE=0
  1. I $G(BOPITE)="" S BOPITE="AEC"
  1. ;
  1. ;Here is where location is paired with the room/bed and put into the
  1. ;string PLOCAT. PLOCAT is sent across the interface is its structure
  1. ;is: plocation ^ proom ^ pbed (as seen by the client)
  1. ;BOPTYPE is used for a calculation type
  1. ;
  1. ;TYPE=2 (Ex: Hines)
  1. ;
  1. ;The location is sent as the Plocation
  1. ;The VISTA room/bed can be in 3 formats: xxx-yyy converted to xxx^yyy
  1. ;xxx-yyy-NNNN converted to xxx^yyy or xxx-yyy-N converted to xxxyyy^N
  1. ;
  1. I BOPTYPE=2 D
  1. .S LX=LOCAT2,LOCAT=$TR(LOCAT,"-","")
  1. .I $L(LOCAT2,"-")=2 S LX=$P(LOCAT2,"-")_COM_$P(LOCAT2,"-",2)
  1. .I $L(LOCAT2,"-")=3,$P(LOCAT2,"-",3)?4N.N S LX=$P(LOCAT2,"-")_COM_$P(LOCAT2,"-",2)
  1. .I $L(LOCAT2,"-")=3,$P(LOCAT2,"-",3)?1N S LX=$P(LOCAT2,"-")_$P(LOCAT2,"-",2)_COM_$P(LOCAT2,"-",3)
  1. .S PLOCAT=LOCAT_COM_LX_COM_SITE
  1. ;
  1. ;The following code is for facilities that use the
  1. ;NursingUnit-Room-Bed as the format of the Room-Bed field.
  1. I $S(BOPTYPE=1:1,BOPITE["PALO-ALTO":1,1:0) D
  1. .N I,L S PLOCAT=""
  1. .F I=1:1:3 S L=$P(LOCAT2,"-",I) S PLOCAT=PLOCAT_L_COM
  1. .S PLOCAT=PLOCAT_SITE
  1. ;
  1. ; The following is for sites where the ward location is
  1. ; 6DM but the nursing unit is 6D and they want the 6DM to go out to
  1. ; remote system
  1. I BOPTYPE=3 S PLOCAT=LOCAT_COM_$P(LOCAT2,"-",2)_COM_$P(LOCAT2,"-",3)_COM_SITE
  1. ;
  1. ; The following code is for type 4 sites. location room bed ignore '-' piece 3
  1. I BOPTYPE=4 S PLOCAT=LOCAT_COM_$P(LOCAT2,"-")_COM_$P(LOCAT2,"-",2)_COM_SITE
  1. ;
  1. ;The following code is for the default handling of Nursing Units,
  1. ;Rooms and Beds, BOPTYPE=0 (or ""). The Nursing Unit is
  1. ;correct and the Room-Bed can be separated as the first and second
  1. ;"-" pieces.
  1. I +BOPTYPE=0!(BOPTYPE=5) D
  1. .I BOPTYPE=5,$L(LOCAT2,"-")=3 S LOCAT2=$P(LOCAT2,"-")_$P(LOCAT2,"-",2)
  1. .S PLOCAT=LOCAT_COM_$P(LOCAT2,"-")_COM_$P(LOCAT2,"-",2)_COM_SITE
  1. ;
  1. S BFLD="||||||||||"
  1. S ACTSAT=$P(NODE10,"^",8)
  1. S ADMTM=$P(NODE10,"^",6)
  1. S:$P(ADMTM,".",2)=24 $P(ADMTM,".",2)=2359
  1. ;DO CHANGE FORMAT TO HL7 TIME
  1. S ADMTM=$$HLDATE^HLFNC(ADMTM),ADMTM=$P(ADMTM,"-",1)
  1. S DISDT=$P(NODE10,"^",7)
  1. S:$P(DISDT,".",2)=24 $P(DISDT,".",2)=2359
  1. S DISDT=$$HLDATE^HLFNC(DISDT),DISDT=$P(DISDT,"-",1)
  1. ;
  1. ; for omnicell
  1. S BOPWHO=$$INTFACE^BOPTU(1) I $G(BOPWHO)]"" S (SERV,ACTSAT)=""
  1. ; S OUT4="PV1"_FLD_FLD_PCLSS_FLD_PLOCAT_FLD_FLD_FLD_COM_OLDLOC_FLD_COM_PDOC_FLD_FLD_FLD_SERV_BFLD_BFLD
  1. S OUT4="PV1"_FLD_FLD_PCLSS_FLD_PLOCAT_FLD_FLD_FLD_COM_OLDLOC_FLD_COM_PDOC_FLD_FLD_CDOC_FLD_SERV_$E(BFLD,1,7)_COM_PDOC_FLD_PTYPE_FLD_BFLD
  1. S OUT4=OUT4_BFLD_ACTSAT_FLD_FLD_FLD_FLD_FLD_ADMTM
  1. S OUT4=OUT4_FLD_DISDT_"|"_$C(13)
  1. S CONT=CONT+1
  1. S OUT(CONT)=OUT4
  1. K OUT4,PCLSS,LOCAT,LOCAT2,PLOCAT,PDOC,SERV,ACTSAT,ADMTM,BOPWHO
  1. Q
  1. MRG ;EP - Build a merge
  1. S PRIOR=""
  1. Q