source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORMBLDLR.m@ 1607

Last change on this file since 1607 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.0 KB
Line 
1ORMBLDLR ; SLC/MKB - Build outgoing Lab ORM msgs ;11/17/00 11:10
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**97,190,195**;Dec 17, 1997
3HL7DATE(DATE) ; -- FM -> HL7 format
4 Q $$FMTHL7^XLFDT(DATE) ;**97
5 ;
6PTR(NAME) ; -- Returns ptr value of prompt in Dialog file
7 Q $O(^ORD(101.41,"AB",$E(NAME,1,63),0))
8 ;
9AP ; -- new Lab AP order
10 ; fall through to CH - no difference at this time
11CH ; -- new Lab CH order
12 N IP,OI,START,STOP,URG,CMMT,INST,I,J,X
13 S START=$P($G(^OR(100,IFN,0)),U,8),STOP=$P($G(^(0)),U,9)
14 S OI=$$PTR("OR GTX ORDERABLE ITEM"),URG=$$PTR("OR GTX LAB URGENCY")
15 S CMMT=$$PTR("OR GTX WORD PROCESSING 1")
16 S IP="" ;$S($D(^OR(100,<ISOLATION ORDER FOR DFN>)):1,1:0)
17 S $P(ORMSG(4),"|",8)="^^^"_$$HL7DATE(START)_U_$$HL7DATE(STOP)
18 S I=4,INST=0 F S INST=$O(ORDIALOG(OI,INST)) Q:INST'>0 D
19 . S X=+$G(ORDIALOG(URG,INST)),X=$P($G(^LAB(62.05,X,0)),U,4)_";"_X
20 . S I=I+1,ORMSG(I)="OBR||||"_$$USID^ORMBLD(ORDIALOG(OI,INST))_"|||||||"_$$COLLTYPE_"|"_IP_"|||"_$$SPEC_"||||||||||||^^^^^"_X
21 . S J=$O(^TMP("ORWORD",$J,CMMT,INST,0)) Q:'J ; no comments for test
22 . S I=I+1,ORMSG(I)="NTE|"_INST_"|P|"_^TMP("ORWORD",$J,CMMT,INST,J,0)
23 . S L=0 F S J=$O(^TMP("ORWORD",$J,CMMT,INST,J)) Q:J'>0 S L=L+1,ORMSG(I,L)=^(J,0)
24 ; Add DG1 & ZCL segment(s) for Billing Aware
25 D DG1^ORWDBA3($G(IFN),"I",I)
26 Q
27 ;
28BB ; -- new Lab BB order
29 N START,QUAN,WP,I,J
30 S QUAN=+$G(ORDIALOG($$PTR("OR GTX QUANTITY"),1))
31 S START=$P(^OR(100,IFN,0),U,8),WP=$$PTR("OR GTX WORD PROCESSING 1")
32 S $P(ORMSG(4),"|",8)=QUAN_"^^^"_$$HL7DATE(START)
33 S ORMSG(5)="OBR||||"_$G(ORDIALOG($$PTR("OR GTX ORDERABLE ITEM"),1))
34 S I=$O(^TMP("ORWORD",$J,WP,1,0)) Q:'I
35 S ORMSG(6)="NTE|1|P|"_$G(^TMP("ORWORD",$J,WP,1,I,0)),J=0
36 F S I=$O(^TMP("ORWORD",$J,WP,1,I)) Q:I'>0 S J=J+1,ORMSG(6,J)=$G(^(I,0))
37 Q
38 ;
39COLLTYPE() ; -- Returns collection type for current INST
40 N TYPE,X
41 S TYPE=$G(ORDIALOG($$PTR("OR GTX COLLECTION TYPE"),INST))
42 S X=$S(TYPE="LC":"L",TYPE="WC":"O",TYPE="SP":1,TYPE="I":2,1:"")
43 Q X
44 ;
45SPEC() ; -- Returns specimen/sample string for current INST
46 N SAMP,SPEC,X,X0
47 S SPEC=+$G(ORDIALOG($$PTR("OR GTX SPECIMEN"),INST))
48 S X0=$G(^LAB(61,SPEC,0)),X=$P(X0,U,2)_";"_$P(X0,U)_";SNM"
49 S SAMP=+$G(ORDIALOG($$PTR("OR GTX COLLECTION SAMPLE"),INST))
50 S X=X_";"_SAMP_";"_$P($G(^LAB(62,+SAMP,0)),U)_";99LRS^^^"_SPEC_";"_$P(X0,U)_";99LRX"
51 Q X
52 ;
53XO ; -- Send XO message to Lab
54 N OR0,DG,ORMSG,ORNEW,OI,URG,I,CNT,INST,ORDIALOG,TEST,CMMT,J,L,OROLD
55 S OR0=$G(^OR(100,+IFN,0)),DG=$P($G(^ORD(100.98,+$P(OR0,U,11),0)),U,3)
56 S DG="LR"_$S(DG="AP":"AP",DG="BB":"BB",1:"CH"),ORDIALOG=+$P(OR0,U,5)
57 S OROLD=+$P(^OR(100,IFN,3),U,5),$P(ORMSG(4),"|",4)=$G(^OR(100,+OROLD,4))_U_DG
58 S OI=$$PTR("OR GTX ORDERABLE ITEM"),URG=$$PTR("OR GTX URGENCY")
59 S CMMT=$$PTR("OR GTX WORD PROCESSING 1"),CNT=3
60 S I=0 F S I=$O(^OR(100,+IFN,4.5,I)) Q:I'>0 I $P($G(^(I,0)),U,2)=OI S TEST=$G(^(1)),ORNEW(TEST)=^(0) ; new set of tests
61 S I=0 F S I=$O(^OR(100,OROLD,4.5,I)) Q:I'>0 I $P($G(^(I,0)),U,2)=OI S TEST=$G(^(1)),OROLD(TEST)=^(0) ; orig set of tests
62XO1 D GETDLG1^ORCD(ORDIALOG),GETORDER^ORCD(+IFN)
63 S I=0 F S I=$O(ORNEW(I)) Q:I'>0 I '$D(OROLD(I)) D
64 . S CNT=CNT+1,TEST=I,INST=$P(ORNEW(I),U,3)
65 . S ORMSG(CNT)="OBR|"_(CNT-3)_"|||"_$$USID^ORMBLD(TEST)_"|||||||A||||"_$$SPEC_"||||||||||||^^^^^"_$P($G(^ORD(101.42,+$G(ORDIALOG(URG,INST)),0)),U,2)
66 . S J=$O(^TMP("ORWORD",$J,CMMT,INST,0)) Q:'J ; no comments for test
67 . S CNT=CNT+1,ORMSG(CNT)="NTE|"_INST_"|L|"_^TMP("ORWORD",$J,CMMT,INST,J,0)
68 . S L=0 F S J=$O(^TMP("ORWORD",$J,CMMT,INST,J)) Q:J'>0 S L=L+1,ORMSG(CNT,L)=^(J,0)
69 S I=ORDIALOG K ORDIALOG S ORDIALOG=I
70 D GETDLG1^ORCD(ORDIALOG),GETORDER^ORCD(OROLD)
71 S I=0 F S I=$O(OROLD(I)) Q:I'>0 I '$D(ORNEW(I)) D
72 . S CNT=CNT+1,TEST=I,INST=$P(OROLD(I),U,3)
73 . S ORMSG(CNT)="OBR|"_(CNT-3)_"|||"_$$USID^ORMBLD(TEST)_"|||||||3||||"_$$SPEC_"||||||||||||^^^^^"_$P($G(^ORD(101.42,+$G(ORDIALOG(URG,INST)),0)),U,2)
74 . S J=$O(^TMP("ORWORD",$J,CMMT,INST,0)) Q:'J ; no comments for test
75 . S CNT=CNT+1,ORMSG(CNT)="NTE|"_INST_"|L|"_^TMP("ORWORD",$J,CMMT,INST,J,0)
76 . S L=0 F S J=$O(^TMP("ORWORD",$J,CMMT,INST,J)) Q:J'>0 S L=L+1,ORMSG(CNT,L)=^(J,0)
77 D MSG^XQOR("OR EVSEND "_DG,.ORMSG)
78 Q
Note: See TracBrowser for help on using the repository browser.