source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OB63C.m@ 613

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1LR7OB63C ;slc/dcm - Get SP,EM,CY data ;8/11/97
2 ;;5.2;LAB SERVICE;**121,187**;Sep 27, 1994
3SS(LRSS) ;Process SP,CY,EM data
4 N IFN,IFN1,IFN2,X0,X1,X2,X3,X4,X5,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y18,CTR1,PATH,SUB,NNN,NN1
5 Q:'$G(IVDT)
6 S NNN=$S(LRSS="SP":"",LRSS="CY":9,LRSS="EM":2,1:""),NN1=+("63."_$S(LRSS="SP":8,1:NNN)_19)
7 Q:'$D(^LR(LRDFN,LRSS,IVDT)) S X0=^(IVDT,0),Y6=$S(+$G(CORRECT):"C",$P(X0,"^",11):"F",$P(X0,"^",3):"R",1:"I"),CTR1=0
8 S:+X0 $P(^TMP("LRX",$J,69,CTR,68),"^",4)=+X0 ;DT Specimen Taken
9 S:$P(X0,"^",10) $P(^TMP("LRX",$J,69,CTR,68),"^",5)=$P(X0,"^",10) ;DT Received
10 S:$P(X0,"^",3) $P(^TMP("LRX",$J,69,CTR,68),"^",6)=$P(X0,"^",3) ;DT Completed
11 S PATH=$P(X0,"^",2) ;Pathologist
12 S Y18=";CH;"_IVDT
13 S CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,68,CTR1)=$S($D(^TMP("LRX",$J,69,1)):$P(^TMP("LRX",$J,69,1),"^"),1:"")_"^^"_PATH_"^"_$P(X0,"^",3)
14 D WP(.1,"SPECIMEN","","ST")
15 D WP(.2,"BRIEF CLINICAL HISTORY","","TX")
16 D WP(.3,"PREOPERATIVE DIAGNOSIS","","TX")
17 D WP(.4,"OPERATIVE FINDINGS","","TX")
18 D WP(.5,"POSTOPERATIVE DIAGNOSIS","","TX")
19 D WP(1,"GROSS DESCRIPTION","&GDT","TX"),MOD(7,"MODIFIED GROSS DESCRIPTION")
20 D WP(1.1,"MICROSCOPIC DESCRIPTION","&MDT","TX"),MOD(4,"MODIFIED MICROSCOPIC DESCRIPTION")
21 D WP(1.3,"FROZEN SECTION","","TX"),MOD(6,"MODIFIED FROZEN SECTION")
22 D WP(1.4,"DIAGNOSIS","","TX"),MOD(5,"MODIFIED DIAGNOSIS")
23 S IFN=0 N X1
24 F S IFN=$O(^LR(LRDFN,LRSS,IVDT,1.2,IFN)) Q:IFN<1 S X=^(IFN,0),IFN1=0 D
25 . F S IFN1=$O(^LR(LRDFN,LRSS,IVDT,1.2,IFN,1,IFN1)) Q:IFN1<1 S CTR1=CTR1+1,X1=^(IFN1,0),^TMP("LRX",$J,69,CTR,63,CTR1)="SUPPLEMENTARY REPORT~"_+X_"^"_X1_"^^^^"_Y6_"^^TX^^^^^^^SUPPLEMNT RPT^^^"_Y18
26 S IFN=0,SUB=0
27 F S IFN=$O(^LR(LRDFN,LRSS,IVDT,2,IFN)) Q:IFN<1 S X=^(IFN,0) D
28 . S SUB=SUB+1,CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,63,CTR1)="ORGAN/TISSUE^"_$$POINTER^LR7OB63(+("63."_NNN_12),.01,+X)_"^^^^"_Y6_"^"_SUB_"^CE^"_$P($G(^LAB(61,+X,0)),"^",2)_"^SNM^&ANT^^^^ORG/TISS^^^"_Y18
29 . D PTR(1,"DISEASE",+("63."_NNN_15),.01,61.4,"")
30 . S IFN1=0
31 . F S IFN1=$O(^LR(LRDFN,LRSS,IVDT,2,IFN,2,IFN1)) Q:IFN1<1 S X=^(IFN1,0) D
32 .. S CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,63,CTR1)="MORPHOLOGY"_"^"_$$POINTER^LR7OB63(+("63."_NNN_16),.01,+X)_"^^^^"_Y6_"^"_SUB_"^CE^"_$P($G(^LAB(61.1,+X,0)),"^",2)_"^SNM^&IMP^^^^_MORPH^^^"_Y18
33 .. S IFN2=0
34 .. F S IFN2=$O(^LR(LRDFN,LRSS,IVDT,2,IFN,2,IFN1,1,IFN2)) Q:IFN2<1 S X=^(IFN2,0) D
35 ... S CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,63,CTR1)="ETIOLOGY^"_$$POINTER^LR7OB63(+("63."_NNN_17),.01,+X)_"^^^^"_Y6_"^"_SUB_"^CE^"_$P($G(^LAB(61.2,+X,0)),"^",2)_"^SNM^^^^^ETIOLOGY^^^"_Y18
36 . D PTR(3,"FUNCTION",+("63."_NNN_85),.01,61.3,"")
37 . D PTR(4,"PROCEDURE",+("63."_NNN_82),.01,61.5,"&CNP")
38 . S IFN1=0 F S IFN1=$O(^LR(LRDFN,LRSS,IVDT,2,IFN,5,IFN1)) Q:IFN1<1 S X=^(IFN1,0),IFN2=0 F S IFN2=$O(^LR(LRDFN,LRSS,IVDT,2,IFN,5,IFN1,1,IFN2)) Q:IFN2<1 S X1=^(IFN2,0) D
39 .. S CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,3,CTR1)="SPECIAL STUDIES "_$$SET^LR7OB63(NN1,.01,$P(X,"^"))_"~"_$P(X,"^",2)_"^"_X1_"^^^^^^TX^^^^^^^SPEC STUDIES"_$$SET^LR7OB63(NN1,.01,$P(X,"^"))_"~"_$P(X,"^",2)_"^^^"_Y18
40 S IFN=0 F S IFN=$O(^LR(LRDFN,LRSS,IVDT,3,IFN)) Q:IFN<1 S X=^(IFN,0),CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,63,CTR1)="ICD DIAGNOSIS^"_$P($G(^ICD9(+X,0)),"^",3)_"^^^^"_Y6_"^^CE^"_$P($G(^ICD9(+X,0)),"^")_"^ICD9^&IMP^^^^^ICD DIAG^^^"_Y18
41 Q
42WP(I,NAME,ID,VALTYP) ;Store word processing fields
43 ;I=Node at ^LR(LRDFN,LRSS,IVDT,I)
44 ;NAME= Field name
45 ;ID=Coded HL7 ID
46 ;VALTYP="TX" for text, "CE" for Coded
47 N IFN,IFN1,X
48 Q:'I Q:'$L(NAME)
49 S IFN=0 F S IFN=$O(^LR(LRDFN,LRSS,IVDT,I,IFN)) Q:IFN<1 S X=^(IFN,0) D SPLIT^LR7OU1(X,"^TMP(""LRX"",$J,69,CTR,63)",.CTR1,80,NAME_"^","^^^^"_Y6_"^^"_VALTYP_"^^^"_ID_"^^^^"_NAME_"^^^"_Y18)
50 Q
51PTR(I,NAME,FILE,FIELD,SNMFILE,ID) ;Store ptr fields for ORGAN/TISSUE multiple
52 ;I=Node at ^LR(LRDFN,LRSS,ICDT,2,IFN,I)
53 ;NAME=Field name
54 ;FILE=File #
55 ;FIELD=Field #
56 ;SNMFILE=Snomed file # for coded entry
57 ;ID=Procedure ID Natl
58 N IFN1
59 Q:'I Q:'$L(NAME)
60 S IFN1=0
61 F S IFN1=$O(^LR(LRDFN,LRSS,IVDT,2,IFN,I,IFN1)) Q:IFN1<1 S X=^(IFN1,0) D
62 . S CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,63,CTR1)=NAME_"^"_$$POINTER^LR7OB63(FILE,FIELD,+X)_"^^^^"_Y6_"^"_SUB_"^CE^"_$P($G(@("^LAB("_SNMFILE_","_+X_",0)")),"^",2)_"^SNM^"_ID_"^^^^"_NAME_"^^^"_Y18
63 Q
64MOD(IFN,FLDNM) ;Process Modified text fields
65 ;IFN=Internal # of modified node
66 ;FLDNM=Field name
67 Q:'$D(^LR(LRDFN,LRSS,IVDT,+IFN)) S IFN1=0
68 N X,X1
69 F S IFN1=$O(^LR(LRDFN,LRSS,IVDT,+IFN,IFN1)) Q:IFN1<1 S X=^(IFN1,0),IFN2=0 D
70 . F S IFN2=$O(^LR(LRDFN,LRSS,IVDT,+IFN,IFN1,1,IFN2)) Q:IFN2<1 S X1=^(IFN2,0),CTR1=CTR1+1,^TMP("LRX",$J,69,CTR,63,CTR1)=FLDNM_"~"_+X_"^"_X1_"^^^^"_Y6_"^^TX^^^^^^^"_FLDNM_"^^^"_Y18
71 Q
Note: See TracBrowser for help on using the repository browser.