KIDS Distribution saved on Jan 23, 2020@18:35:49
Fixes to word wrap on intake note and CT Eval typos
**KIDS**:SAMI*18.0*2^

**INSTALL NAME**
SAMI*18.0*2
"BLD",11431,0)
SAMI*18.0*2^SAMI^0^3200123^y
"BLD",11431,1,0)
^^2^2^3200123^
"BLD",11431,1,1,0)
Fixes word wrapping problem with intake note
"BLD",11431,1,2,0)
Fixes typos and punctuation in CT Eval report
"BLD",11431,4,0)
^9.64PA^^
"BLD",11431,6.3)
1
"BLD",11431,"KRN",0)
^9.67PA^1.5^24
"BLD",11431,"KRN",.4,0)
.4
"BLD",11431,"KRN",.401,0)
.401
"BLD",11431,"KRN",.402,0)
.402
"BLD",11431,"KRN",.403,0)
.403
"BLD",11431,"KRN",.5,0)
.5
"BLD",11431,"KRN",.84,0)
.84
"BLD",11431,"KRN",1.5,0)
1.5
"BLD",11431,"KRN",1.6,0)
1.6
"BLD",11431,"KRN",1.61,0)
1.61
"BLD",11431,"KRN",1.62,0)
1.62
"BLD",11431,"KRN",3.6,0)
3.6
"BLD",11431,"KRN",3.8,0)
3.8
"BLD",11431,"KRN",9.2,0)
9.2
"BLD",11431,"KRN",9.8,0)
9.8
"BLD",11431,"KRN",9.8,"NM",0)
^9.68A^3^3
"BLD",11431,"KRN",9.8,"NM",1,0)
SAMINOT1^^0^B305486339
"BLD",11431,"KRN",9.8,"NM",2,0)
SAMICTR3^^0^B143725495
"BLD",11431,"KRN",9.8,"NM",3,0)
SAMICTR4^^0^B29262141
"BLD",11431,"KRN",9.8,"NM","B","SAMICTR3",2)

"BLD",11431,"KRN",9.8,"NM","B","SAMICTR4",3)

"BLD",11431,"KRN",9.8,"NM","B","SAMINOT1",1)

"BLD",11431,"KRN",19,0)
19
"BLD",11431,"KRN",19.1,0)
19.1
"BLD",11431,"KRN",101,0)
101
"BLD",11431,"KRN",409.61,0)
409.61
"BLD",11431,"KRN",771,0)
771
"BLD",11431,"KRN",779.2,0)
779.2
"BLD",11431,"KRN",870,0)
870
"BLD",11431,"KRN",8989.51,0)
8989.51
"BLD",11431,"KRN",8989.52,0)
8989.52
"BLD",11431,"KRN",8994,0)
8994
"BLD",11431,"KRN","B",.4,.4)

"BLD",11431,"KRN","B",.401,.401)

"BLD",11431,"KRN","B",.402,.402)

"BLD",11431,"KRN","B",.403,.403)

"BLD",11431,"KRN","B",.5,.5)

"BLD",11431,"KRN","B",.84,.84)

"BLD",11431,"KRN","B",1.5,1.5)

"BLD",11431,"KRN","B",1.6,1.6)

"BLD",11431,"KRN","B",1.61,1.61)

"BLD",11431,"KRN","B",1.62,1.62)

"BLD",11431,"KRN","B",3.6,3.6)

"BLD",11431,"KRN","B",3.8,3.8)

"BLD",11431,"KRN","B",9.2,9.2)

"BLD",11431,"KRN","B",9.8,9.8)

"BLD",11431,"KRN","B",19,19)

"BLD",11431,"KRN","B",19.1,19.1)

"BLD",11431,"KRN","B",101,101)

"BLD",11431,"KRN","B",409.61,409.61)

"BLD",11431,"KRN","B",771,771)

"BLD",11431,"KRN","B",779.2,779.2)

"BLD",11431,"KRN","B",870,870)

"BLD",11431,"KRN","B",8989.51,8989.51)

"BLD",11431,"KRN","B",8989.52,8989.52)

"BLD",11431,"KRN","B",8994,8994)

"MBREQ")
0
"PKG",230,-1)
1^1
"PKG",230,0)
SAMI^SAMI^SCREENING APPLICATIONS MANAGEMENT - IELCAP
"PKG",230,22,0)
^9.49I^1^1
"PKG",230,22,1,0)
18.0^3191203
"PKG",230,22,1,"PAH",1,0)
2^3200123
"PKG",230,22,1,"PAH",1,1,0)
^^2^2^3200123
"PKG",230,22,1,"PAH",1,1,1,0)
Fixes word wrapping problem with intake note
"PKG",230,22,1,"PAH",1,1,2,0)
Fixes typos and punctuation in CT Eval report
"QUES","XPF1",0)
Y
"QUES","XPF1","??")
^D REP^XPDH
"QUES","XPF1","A")
Shall I write over your |FLAG| File
"QUES","XPF1","B")
YES
"QUES","XPF1","M")
D XPF1^XPDIQ
"QUES","XPF2",0)
Y
"QUES","XPF2","??")
^D DTA^XPDH
"QUES","XPF2","A")
Want my data |FLAG| yours
"QUES","XPF2","B")
YES
"QUES","XPF2","M")
D XPF2^XPDIQ
"QUES","XPI1",0)
YO
"QUES","XPI1","??")
^D INHIBIT^XPDH
"QUES","XPI1","A")
Want KIDS to INHIBIT LOGONs during the install
"QUES","XPI1","B")
NO
"QUES","XPI1","M")
D XPI1^XPDIQ
"QUES","XPM1",0)
PO^VA(200,:EM
"QUES","XPM1","??")
^D MG^XPDH
"QUES","XPM1","A")
Enter the Coordinator for Mail Group '|FLAG|'
"QUES","XPM1","B")

"QUES","XPM1","M")
D XPM1^XPDIQ
"QUES","XPO1",0)
Y
"QUES","XPO1","??")
^D MENU^XPDH
"QUES","XPO1","A")
Want KIDS to Rebuild Menu Trees Upon Completion of Install
"QUES","XPO1","B")
NO
"QUES","XPO1","M")
D XPO1^XPDIQ
"QUES","XPZ1",0)
Y
"QUES","XPZ1","??")
^D OPT^XPDH
"QUES","XPZ1","A")
Want to DISABLE Scheduled Options, Menu Options, and Protocols
"QUES","XPZ1","B")
NO
"QUES","XPZ1","M")
D XPZ1^XPDIQ
"QUES","XPZ2",0)
Y
"QUES","XPZ2","??")
^D RTN^XPDH
"QUES","XPZ2","A")
Want to MOVE routines to other CPUs
"QUES","XPZ2","B")
NO
"QUES","XPZ2","M")
D XPZ2^XPDIQ
"RTN")
3
"RTN","SAMICTR3")
0^2^B143725495
"RTN","SAMICTR3",1,0)
SAMICTR3 ;ven/gpl - ielcap: forms ; 1/23/19 5:14pm
"RTN","SAMICTR3",2,0)
 ;;18.0;SAMI;;;Build 1
"RTN","SAMICTR3",3,0)
 ;
"RTN","SAMICTR3",4,0)
 ;@license: see routine SAMIUL
"RTN","SAMICTR3",5,0)
 ;
"RTN","SAMICTR3",6,0)
 quit  ; no entry from top
"RTN","SAMICTR3",7,0)
 ;
"RTN","SAMICTR3",8,0)
EMPHYS(rtn,vals,dict) ;
"RTN","SAMICTR3",9,0)
 ; repgen4,repgen5
"RTN","SAMICTR3",10,0)
 ;  
"RTN","SAMICTR3",11,0)
 ;# Emphysema
"RTN","SAMICTR3",12,0)
 ;
"RTN","SAMICTR3",13,0)
 ;if $$XVAL("ceemv",vals)'="e" d  ;
"RTN","SAMICTR3",14,0)
 if $$XVAL("ceem",vals)'="" d  ;
"RTN","SAMICTR3",15,0)
 . if $$XVAL("ceem",vals)="nv" q  ;
"RTN","SAMICTR3",16,0)
 . if $$XVAL("ceem",vals)="no" q  ;
"RTN","SAMICTR3",17,0)
 . D HOUT("Emphysema: ")
"RTN","SAMICTR3",18,0)
 . D OUT($$XSUB("ceem",vals,dict)_para)
"RTN","SAMICTR3",19,0)
 ;
"RTN","SAMICTR3",20,0)
 D HOUT("Pleura: ")
"RTN","SAMICTR3",21,0)
 ; hputs "Pleura:"
"RTN","SAMICTR3",22,0)
 N pe s pe=0
"RTN","SAMICTR3",23,0)
 ;
"RTN","SAMICTR3",24,0)
 ; # Pleural Effusion
"RTN","SAMICTR3",25,0)
 ; 
"RTN","SAMICTR3",26,0)
 i $$XVAL("cepev",vals)="y" d  ;
"RTN","SAMICTR3",27,0)
 . if $$XVAL("ceper",vals)="-" d  ;
"RTN","SAMICTR3",28,0)
 . . if $$XVAL("cepel",vals)="-" d  ;
"RTN","SAMICTR3",29,0)
 . . . s @vals@("cepev")="e"
"RTN","SAMICTR3",30,0)
 . ;
"RTN","SAMICTR3",31,0)
 . if $$XVAL("cepev",vals)'="e" d  ;
"RTN","SAMICTR3",32,0)
 . . if $$XVAL("ceper",vals)'="-" d  ;
"RTN","SAMICTR3",33,0)
 . . . if $$XVAL("cepel",vals)'="-" d  ;
"RTN","SAMICTR3",34,0)
 . . . . if $$XVAL("cepel",vals)=$$XVAL("ceper",vals) d  ;
"RTN","SAMICTR3",35,0)
 . . . . . d OUT("Bilateral "_$$XSUB("cepe",vals,dict,"cepel")_" pleural effusions."_para)
"RTN","SAMICTR3",36,0)
 . . . . else  d  ;
"RTN","SAMICTR3",37,0)
 . . . . . d OUT("Bilateral pleural effusions ; "_$$XSUB("cepe",vals,dict,"cepel")_" on left,")
"RTN","SAMICTR3",38,0)
 . . . . . d OUT(" and "_$$XSUB("cepe",vals,dict,"ceper")_" on right."_para)
"RTN","SAMICTR3",39,0)
 . . . . . s pe=1
"RTN","SAMICTR3",40,0)
 . . . else  d  ;
"RTN","SAMICTR3",41,0)
 . . . . d OUT("On right "_$$XSUB("cepe",vals,dict,"cepr")_" pleural effusion")
"RTN","SAMICTR3",42,0)
 . . . . d OUT(" and on left "_$$XSUB("cepe",vals,dict,"cepel")_" pleural effusion."_para)
"RTN","SAMICTR3",43,0)
 . . . . s pe=1
"RTN","SAMICTR3",44,0)
 . . else  d  ;
"RTN","SAMICTR3",45,0)
 . . . d OUT("On right "_$$XSUB("cepe",vals,dict,"cepr")_" pleural effusion")
"RTN","SAMICTR3",46,0)
 . . . d OUT(" and on left "_$$XSUB("cepe",vals,dict,"cepel")_" pleural effusion."_para)
"RTN","SAMICTR3",47,0)
 . . . s pe=1
"RTN","SAMICTR3",48,0)
 . ;
"RTN","SAMICTR3",49,0)
 i $$XVAL("cepev",vals)'="y" d  ; 
"RTN","SAMICTR3",50,0)
 . d OUT("No pleural effusions."_para)
"RTN","SAMICTR3",51,0)
 ;  if { $pe == 0 } {
"RTN","SAMICTR3",52,0)
 ;    puts "[tr "No pleural effusions"].${para}"
"RTN","SAMICTR3",53,0)
 ;  }
"RTN","SAMICTR3",54,0)
 ;  
"RTN","SAMICTR3",55,0)
 n yespp s yespp=0
"RTN","SAMICTR3",56,0)
 ;
"RTN","SAMICTR3",57,0)
 if $$XVAL("cebatr",vals)="y" d  ;
"RTN","SAMICTR3",58,0)
 . d OUT("Rounded atelectasis in the ")
"RTN","SAMICTR3",59,0)
 . d OUT($$LOBESTR^SAMICTR2("cebatrl1^cebatrl2^cebatrl3^cebatrl4^cebatrl5",0)_".<br>")
"RTN","SAMICTR3",60,0)
 . s yespp=1
"RTN","SAMICTR3",61,0)
 ;
"RTN","SAMICTR3",62,0)
 if $$XVAL("cept",vals)="y" d  ;
"RTN","SAMICTR3",63,0)
 . s yespp=1
"RTN","SAMICTR3",64,0)
 . s numl=0
"RTN","SAMICTR3",65,0)
 . set str="Pleural thickening/plaques in the "
"RTN","SAMICTR3",66,0)
 . if $$XVAL("ceptrt",vals)="r" d  ;
"RTN","SAMICTR3",67,0)
 . . s str=str_"right"
"RTN","SAMICTR3",68,0)
 . . s numl=numl+1
"RTN","SAMICTR3",69,0)
 . if $$XVAL("ceptlt",vals)="l" d  ;
"RTN","SAMICTR3",70,0)
 . . i numl>0 d  ;
"RTN","SAMICTR3",71,0)
 . . . s str=str_" and"
"RTN","SAMICTR3",72,0)
 . . s str=str_" left"
"RTN","SAMICTR3",73,0)
 . . s numl=numl+1
"RTN","SAMICTR3",74,0)
 . ;if numl>1 d  ;
"RTN","SAMICTR3",75,0)
 . ;. s str=str_" lungs."
"RTN","SAMICTR3",76,0)
 . ;else  d  ;
"RTN","SAMICTR3",77,0)
 . ;. s str=str_" lung."
"RTN","SAMICTR3",78,0)
 . s str=str_"."
"RTN","SAMICTR3",79,0)
 . if numl=0 set str="Pleural thickening/plaques."
"RTN","SAMICTR3",80,0)
 . d OUT(str_"<br>")
"RTN","SAMICTR3",81,0)
 ;
"RTN","SAMICTR3",82,0)
 if $$XVAL("cepu",vals)="y" d  ;
"RTN","SAMICTR3",83,0)
 . s yespp=1
"RTN","SAMICTR3",84,0)
 . if $l($$XVAL("cepus",vals))'=0 d  ;
"RTN","SAMICTR3",85,0)
 . . d OUT("Pleural rumor: "_$$XVAL("cepus",vals))
"RTN","SAMICTR3",86,0)
 . e  d OUT("Pleural tumor.")
"RTN","SAMICTR3",87,0)
 . d OUT("<br>")
"RTN","SAMICTR3",88,0)
 ;
"RTN","SAMICTR3",89,0)
 i yespp=0 d OUT(para)
"RTN","SAMICTR3",90,0)
 ;
"RTN","SAMICTR3",91,0)
 d  ;
"RTN","SAMICTR3",92,0)
 . if $$XVAL("ceoppab",vals)'="" d OUT($$XVAL("ceoppab",vals)_"."_para)
"RTN","SAMICTR3",93,0)
 . else  d
"RTN","SAMICTR3",94,0)
 . . if yespp=1 d OUT(para)
"RTN","SAMICTR3",95,0)
 ;
"RTN","SAMICTR3",96,0)
 ;
"RTN","SAMICTR3",97,0)
 d HOUT("Coronary Artery Calcifications: ")
"RTN","SAMICTR3",98,0)
 ;# Coronary Calcification
"RTN","SAMICTR3",99,0)
 n vcac,cac,cacrec
"RTN","SAMICTR3",100,0)
 s (cac,cacrec)=""
"RTN","SAMICTR3",101,0)
 ;
"RTN","SAMICTR3",102,0)
 if $$XVAL("cecccac",vals)'="" d  ;
"RTN","SAMICTR3",103,0)
 . s @vals@("ceccv")="e"
"RTN","SAMICTR3",104,0)
 ;
"RTN","SAMICTR3",105,0)
 d  if $$XVAL("ceccv",vals)'="n" d  ;
"RTN","SAMICTR3",106,0)
 . set vcac=$$XVAL("cecccac",vals)
"RTN","SAMICTR3",107,0)
 . if vcac'="" d  ;
"RTN","SAMICTR3",108,0)
 . . s cacrec=""
"RTN","SAMICTR3",109,0)
 . . s cac="The Visual Coronary Artery Calcium (CAC) Score is "_vcac_". "
"RTN","SAMICTR3",110,0)
 . . s cacval=vcac
"RTN","SAMICTR3",111,0)
 . . i cacval>3 s cacrec=$g(@dict@("CAC_recommendation"))_para
"RTN","SAMICTR3",112,0)
 ;
"RTN","SAMICTR3",113,0)
 ;
"RTN","SAMICTR3",114,0)
 n samicac s samicac=0
"RTN","SAMICTR3",115,0)
 i $$XVAL("cecclm",vals)'="no" s samicac=1
"RTN","SAMICTR3",116,0)
 i $$XVAL("ceccld",vals)'="no" s samicac=1
"RTN","SAMICTR3",117,0)
 ;i $$XVAL("cecclf",vals)'="no" s samicac=1
"RTN","SAMICTR3",118,0)
 i $$XVAL("cecccf",vals)'="no" s samicac=1
"RTN","SAMICTR3",119,0)
 i $$XVAL("ceccrc",vals)'="no" s samicac=1
"RTN","SAMICTR3",120,0)
 ;
"RTN","SAMICTR3",121,0)
 i samicac=1 d  ;
"RTN","SAMICTR3",122,0)
 . d OUT($$XSUB("cecc",vals,dict,"cecclm")_" in left main, ")
"RTN","SAMICTR3",123,0)
 . d OUT($$XSUB("cecc",vals,dict,"ceccld")_" in left anterior descending, ")
"RTN","SAMICTR3",124,0)
 . ;d OUT($$XSUB("cecc",vals,dict,"cecclf")_" in circumflex, and ")
"RTN","SAMICTR3",125,0)
 . d OUT($$XSUB("cecc",vals,dict,"cecccf")_" in circumflex, and ")
"RTN","SAMICTR3",126,0)
 . d OUT($$XSUB("cecc",vals,dict,"ceccrc")_" in right coronary. "_cac_para)
"RTN","SAMICTR3",127,0)
 ; 
"RTN","SAMICTR3",128,0)
 if $$XVAL("cecca",vals)'="-" d  ;
"RTN","SAMICTR3",129,0)
 . d HOUT("Aortic Calcifications: ")
"RTN","SAMICTR3",130,0)
 . d OUT($$XSUB("cecc",vals,dict,"cecca"))
"RTN","SAMICTR3",131,0)
 ;
"RTN","SAMICTR3",132,0)
 d HOUT("Cardiac Findings: ")
"RTN","SAMICTR3",133,0)
 ;
"RTN","SAMICTR3",134,0)
 ;# Pericardial Effusion
"RTN","SAMICTR3",135,0)
 if $$XVAL("ceprevm",vals)'="-" d  ;
"RTN","SAMICTR3",136,0)
 . if $$XVAL("ceprevm",vals)'="no" d  ;
"RTN","SAMICTR3",137,0)
 . . if $$XVAL("ceprevm",vals)'="" d
"RTN","SAMICTR3",138,0)
 . . . d OUT("A "_$$XSUB("ceprevm",vals,dict,"ceprevm")_" pericardial effusion"_"."_para)
"RTN","SAMICTR3",139,0)
 . . . s pe=1
"RTN","SAMICTR3",140,0)
 . . else  d OUT("No pericardial effusion."_para)
"RTN","SAMICTR3",141,0)
 ;
"RTN","SAMICTR3",142,0)
 ;
"RTN","SAMICTR3",143,0)
 ;;# Pulmonary and Aortic Diameter
"RTN","SAMICTR3",144,0)
 i $$XVAL("cepaw",vals)'="" d  ;
"RTN","SAMICTR3",145,0)
 . d OUT("Widest main pulmonary artery diameter is "_$$XVAL("cepaw",vals)_" mm. ")
"RTN","SAMICTR3",146,0)
 . if $$XVAL("ceaow",vals)'="" d  ;
"RTN","SAMICTR3",147,0)
 . . d OUT("Widest ascending aortic diameter at the same level is "_$$XVAL("ceaow",vals)_" mm. ")
"RTN","SAMICTR3",148,0)
 . . if $$XVAL("cepar",vals)'="" d  ;
"RTN","SAMICTR3",149,0)
 . . . d OUT("The ratio is "_$$XVAL("cepar",vals)_".")
"RTN","SAMICTR3",150,0)
 . d OUT(para)
"RTN","SAMICTR3",151,0)
 ;
"RTN","SAMICTR3",152,0)
 ; #"Additional Comments on Cardiac Abnormalities:"
"RTN","SAMICTR3",153,0)
 if $$XVAL("cecommca",vals)'="" d  ;
"RTN","SAMICTR3",154,0)
 . d OUT($$XVAL("cecommca",vals)_"."_para)
"RTN","SAMICTR3",155,0)
 ;
"RTN","SAMICTR3",156,0)
 ;
"RTN","SAMICTR3",157,0)
 d HOUT("Mediastinum: ")
"RTN","SAMICTR3",158,0)
 n yesmm s yesmm=0
"RTN","SAMICTR3",159,0)
 n abn
"RTN","SAMICTR3",160,0)
 i ($$XVAL("ceoma",vals)="y")&($$XVAL("ceata",vals)="y") d  ;
"RTN","SAMICTR3",161,0)
 . s yeamm=1
"RTN","SAMICTR3",162,0)
 . s abn=$$CCMSTR("ceatc^ceaty^ceatm",vals)
"RTN","SAMICTR3",163,0)
 . ;d OUT("[abn="_abn_"]")
"RTN","SAMICTR3",164,0)
 . i abn="" d OUT("Noted in the thyroid.")
"RTN","SAMICTR3",165,0)
 . i abn'="" d OUT(abn_" thyroid.")
"RTN","SAMICTR3",166,0)
 . i $$XVAL("ceato",vals)="o" d OUT($$XVAL("ceatos",vals)_"<br>")
"RTN","SAMICTR3",167,0)
 i $$XVAL("ceaya",vals)="y" d  ;
"RTN","SAMICTR3",168,0)
 . s yesmm=1
"RTN","SAMICTR3",169,0)
 . s abn=$$CCMSTR("ceayc^ceayy^ceaym",vals)
"RTN","SAMICTR3",170,0)
 . i abn="" d OUT("Noted in the thymus")
"RTN","SAMICTR3",171,0)
 . i abn'="" d OUT(abn_" thymus.")
"RTN","SAMICTR3",172,0)
 . i $$XVAL("ceayo",vals)="o" d OUT($$XVAL("ceayos",vals)_"<br>")
"RTN","SAMICTR3",173,0)
 ;
"RTN","SAMICTR3",174,0)
 ;   # Non-calcified lymph nodes
"RTN","SAMICTR3",175,0)
 n lnlist,lnlistt
"RTN","SAMICTR3",176,0)
 set lnlist(1)="cemlnl1"
"RTN","SAMICTR3",177,0)
 set lnlist(2)="cemlnl2r"
"RTN","SAMICTR3",178,0)
 set lnlist(3)="cemlnl2l"
"RTN","SAMICTR3",179,0)
 set lnlist(4)="cemlnl3"
"RTN","SAMICTR3",180,0)
 set lnlist(5)="cemlnl4r"
"RTN","SAMICTR3",181,0)
 set lnlist(6)="cemlnl4l"
"RTN","SAMICTR3",182,0)
 set lnlist(7)="cemlnl5"
"RTN","SAMICTR3",183,0)
 set lnlist(8)="cemlnl6"
"RTN","SAMICTR3",184,0)
 set lnlist(9)="cemlnl7"
"RTN","SAMICTR3",185,0)
 set lnlist(10)="cemlnl8"
"RTN","SAMICTR3",186,0)
 set lnlist(11)="cemlnl9"
"RTN","SAMICTR3",187,0)
 set lnlist(12)="cemlnl10r"
"RTN","SAMICTR3",188,0)
 set lnlist(13)="cemlnl10l"
"RTN","SAMICTR3",189,0)
 ;
"RTN","SAMICTR3",190,0)
 set lnlistt(1)="high mediastinal"
"RTN","SAMICTR3",191,0)
 set lnlistt(2)="right upper paratracheal"
"RTN","SAMICTR3",192,0)
 set lnlistt(3)="left upper paratracheal"
"RTN","SAMICTR3",193,0)
 set lnlistt(4)="prevascular/retrotracheal"
"RTN","SAMICTR3",194,0)
 set lnlistt(5)="right lower paratracheal"
"RTN","SAMICTR3",195,0)
 set lnlistt(6)="left lower paratracheal"
"RTN","SAMICTR3",196,0)
 set lnlistt(7)="sub-aortic (A-P window)"
"RTN","SAMICTR3",197,0)
 set lnlistt(8)="para-aortic"
"RTN","SAMICTR3",198,0)
 set lnlistt(9)="subcarinal"
"RTN","SAMICTR3",199,0)
 set lnlistt(10)="para-esophageal"
"RTN","SAMICTR3",200,0)
 set lnlistt(11)="pulmonary ligament"
"RTN","SAMICTR3",201,0)
 set lnlistt(12)="right hilar"
"RTN","SAMICTR3",202,0)
 set lnlistt(13)="left hilar"
"RTN","SAMICTR3",203,0)
 ;
"RTN","SAMICTR3",204,0)
 ;
"RTN","SAMICTR3",205,0)
 if $$XVAL("cemln",vals)="y" d  ;
"RTN","SAMICTR3",206,0)
 . s yesmm=1
"RTN","SAMICTR3",207,0)
 . n llist,item
"RTN","SAMICTR3",208,0)
 . s (llist,item)=""
"RTN","SAMICTR3",209,0)
 . f  s item=$o(lnlist(item)) q:item=""  d  ;
"RTN","SAMICTR3",210,0)
 . . i $$XVAL(lnlist(item),vals)'="" s llist($o(llist(""),-1)+1)=lnlist(item)
"RTN","SAMICTR3",211,0)
 . n lnum,slnum
"RTN","SAMICTR3",212,0)
 . s lnum=$o(llist(""),-1)
"RTN","SAMICTR3",213,0)
 . i lnum=0 d OUT("Enlarged or growing lymph nodes are noted.")
"RTN","SAMICTR3",214,0)
 . i lnum>0 d  ;
"RTN","SAMICTR3",215,0)
 . . s slnum=lnum
"RTN","SAMICTR3",216,0)
 . . d OUT("Enlarged or growing lymph nodes in the ")
"RTN","SAMICTR3",217,0)
 . . s item=""
"RTN","SAMICTR3",218,0)
 . . f  s item=$o(llist(item)) q:item=""  d  ;
"RTN","SAMICTR3",219,0)
 . . . d OUT(lnlistt(item))
"RTN","SAMICTR3",220,0)
 . . . i lnum>2 d OUT(", ")
"RTN","SAMICTR3",221,0)
 . . . i lnum=2 d OUT(" and ")
"RTN","SAMICTR3",222,0)
 . . . s lnum=lnum-1
"RTN","SAMICTR3",223,0)
 . . i slnum>1 d OUT("locations.")
"RTN","SAMICTR3",224,0)
 . . i slnum=1 d OUT("location.")
"RTN","SAMICTR3",225,0)
 ;
"RTN","SAMICTR3",226,0)
 ;
"RTN","SAMICTR3",227,0)
 if $$XVAL("cemlncab",vals)="y" d  ;
"RTN","SAMICTR3",228,0)
 . set yesmm=1
"RTN","SAMICTR3",229,0)
 . d OUT("Calcified lymph nodes present.<br>")
"RTN","SAMICTR3",230,0)
 ;
"RTN","SAMICTR3",231,0)
 if $$XVAL("ceagaln",vals)="y" d  ;
"RTN","SAMICTR3",232,0)
 . set yesmm=1
"RTN","SAMICTR3",233,0)
 . d OUT("Enlarged or growing axillary lymph nodes without central fat are seen.")
"RTN","SAMICTR3",234,0)
 . d OUT($$XVAL("ceagalns",vals)_"<br>")
"RTN","SAMICTR3",235,0)
 ;
"RTN","SAMICTR3",236,0)
 if $$XVAL("cemva",vals)="y" d  ;
"RTN","SAMICTR3",237,0)
 . set yesmm=1
"RTN","SAMICTR3",238,0)
 . if $$XVAL("cemvaa",vals)="a" d  ;
"RTN","SAMICTR3",239,0)
 . . d OUT("Other vascular abnormalities are seen in the aorta.")
"RTN","SAMICTR3",240,0)
 . if $$XVAL("cemvaa",vals)="w" d  ;
"RTN","SAMICTR3",241,0)
 . . d OUT("Other vascular abnormalities are seen in the pulmonary series.")
"RTN","SAMICTR3",242,0)
 . d OUT($$XVAL("cemvaos",vals)_"<br>")
"RTN","SAMICTR3",243,0)
 ;
"RTN","SAMICTR3",244,0)
 ;   # Esophageal
"RTN","SAMICTR3",245,0)
 if $$XVAL("cemeln",vals)="y" d  ;
"RTN","SAMICTR3",246,0)
 . set yesmm=1
"RTN","SAMICTR3",247,0)
 . n elist s elist=""
"RTN","SAMICTR3",248,0)
 . set numl=0
"RTN","SAMICTR3",249,0)
 . if $$XVAL("cemelna",vals)="a" d  ;
"RTN","SAMICTR3",250,0)
 . . s elist($o(elist(""),-1)+1)="Air-fluid level"
"RTN","SAMICTR3",251,0)
 . . s numl=numl+1
"RTN","SAMICTR3",252,0)
 . if $$XVAL("cemelnw",vals)="w" d  ;
"RTN","SAMICTR3",253,0)
 . . s elist($o(elist(""),-1)+1)="Wall thickening"
"RTN","SAMICTR3",254,0)
 . . s numl=numl+1
"RTN","SAMICTR3",255,0)
 . if $$XVAL("cemelnm",vals)="m" d  ;
"RTN","SAMICTR3",256,0)
 . . s elist($o(elist(""),-1)+1)="A mass"
"RTN","SAMICTR3",257,0)
 . . s numl=numl+1
"RTN","SAMICTR3",258,0)
 . if numl=0 d OUT("Esophageal abnormality noted.")
"RTN","SAMICTR3",259,0)
 . e  d  ;
"RTN","SAMICTR3",260,0)
 . . d OUT($g(elist(1)))
"RTN","SAMICTR3",261,0)
 . . if numl=1 d OUT(" is ")
"RTN","SAMICTR3",262,0)
 . . e  d  ;
"RTN","SAMICTR3",263,0)
 . . . if numl=2 d  ;
"RTN","SAMICTR3",264,0)
 . . . . d OUT(" and ")
"RTN","SAMICTR3",265,0)
 . . . e  d OUT(", ")
"RTN","SAMICTR3",266,0)
 . . . d OUT($$LOWC($g(elist(2))))
"RTN","SAMICTR3",267,0)
 . . . if numl=3 d  ;
"RTN","SAMICTR3",268,0)
 . . . . d OUT(", and "_$$LOWC($g(elist(3))))
"RTN","SAMICTR3",269,0)
 . . d OUT("seen in the esophagus.")
"RTN","SAMICTR3",270,0)
 . d OUT($$XVAL("cemelnos",vals)_para)
"RTN","SAMICTR3",271,0)
 ;
"RTN","SAMICTR3",272,0)
 ;
"RTN","SAMICTR3",273,0)
 if $$XVAL("cehhn",vals)="y" d  ;
"RTN","SAMICTR3",274,0)
 . set yesmm=1
"RTN","SAMICTR3",275,0)
 . if $$XVAL("cehhnos",vals)'="" d OUT("Hiatal hernia: "_$$XVAL("cehhnos",vals))
"RTN","SAMICTR3",276,0)
 . if $$XVAL("cehhnos",vals)="" d OUT("Hiatal hernia.")
"RTN","SAMICTR3",277,0)
 . d OUT(para)
"RTN","SAMICTR3",278,0)
 ;
"RTN","SAMICTR3",279,0)
 if $$XVAL("ceomm",vals)="y" d  ;
"RTN","SAMICTR3",280,0)
 . set yesmm=1
"RTN","SAMICTR3",281,0)
 . n tval
"RTN","SAMICTR3",282,0)
 . set tval=$$XVAL("ceommos",vals)
"RTN","SAMICTR3",283,0)
 . set abn=$$CCMSTR("ceamc^ceamy^ceamm",vals)
"RTN","SAMICTR3",284,0)
 . if abn="" d OUT("Abnormality noted in the mediastinum. ")
"RTN","SAMICTR3",285,0)
 . e  d OUT(abn_" mediastinum. ")
"RTN","SAMICTR3",286,0)
 . d OUT(tval_"<br>")
"RTN","SAMICTR3",287,0)
 i yesmm=0 d OUT("No abnormalities."_para)
"RTN","SAMICTR3",288,0)
 i $$XVAL("ceotabnm",vals)'="" d  ;
"RTN","SAMICTR3",289,0)
 . d OUT($$XVAL("ceotabnm",vals)_"."_para)
"RTN","SAMICTR3",290,0)
 d OUT("<p>")
"RTN","SAMICTR3",291,0)
 ;
"RTN","SAMICTR3",292,0)
 ;
"RTN","SAMICTR3",293,0)
 q
"RTN","SAMICTR3",294,0)
 ;
"RTN","SAMICTR3",295,0)
 ;
"RTN","SAMICTR3",296,0)
CCMSTR(lst,vals) ; extrinsic that forms phrases
"RTN","SAMICTR3",297,0)
 n retstr s retstr=""
"RTN","SAMICTR3",298,0)
 n lblist s lblist=""
"RTN","SAMICTR3",299,0)
 n lb,ib s ib=""
"RTN","SAMICTR3",300,0)
 f lb=1:1:$l(lst,"^") d  ;
"RTN","SAMICTR3",301,0)
 . n lvar s lvar=$p(lst,"^",lb)
"RTN","SAMICTR3",302,0)
 . s ib=$$XVAL($p(lst,"^",lb),vals)
"RTN","SAMICTR3",303,0)
 . if ib'="" d  ;
"RTN","SAMICTR3",304,0)
 . . i ib="y" d  ; 
"RTN","SAMICTR3",305,0)
 . . . i $f("ceasc cealc ceapc ceapc ceaac ceakc",lvar)>0 s lblist($o(lblist(""),-1)+1)="Calcification"
"RTN","SAMICTR3",306,0)
 . . . ;i "ceasc cealc ceapc ceapc ceaac ceakc"[lb s lblist($o(lblist(""),-1)+1)="Calcification"
"RTN","SAMICTR3",307,0)
 . . . else  s lblist($o(lblist(""),-1)+1)="Cyst"
"RTN","SAMICTR3",308,0)
 . . i ib="c" s lblist($o(lblist(""),-1)+1)="Calcification"
"RTN","SAMICTR3",309,0)
 . . i ib="m" s lblist($o(lblist(""),-1)+1)="Mass"
"RTN","SAMICTR3",310,0)
 i $o(lblist(""),-1)=1 s retstr=retstr_lblist(1)_" is seen in the"
"RTN","SAMICTR3",311,0)
 e  i $o(lblist(""),-1)=2 s retstr=retstr_lblist(1)_" and "_$$LOWC(lblist(2))_" are seen in the"
"RTN","SAMICTR3",312,0)
 e  i $o(lblist(""),-1)=3 s retstr=retstr_"Calicification, cyst, and mass are seen in the"
"RTN","SAMICTR3",313,0)
 q retstr
"RTN","SAMICTR3",314,0)
 ;
"RTN","SAMICTR3",315,0)
LOWC(X) ;  CONVERT X TO LOWERCASE
"RTN","SAMICTR3",316,0)
 Q $TR(X,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
"RTN","SAMICTR3",317,0)
 ;
"RTN","SAMICTR3",318,0)
OUT(ln) ;
"RTN","SAMICTR3",319,0)
 s cnt=cnt+1
"RTN","SAMICTR3",320,0)
 n lnn
"RTN","SAMICTR3",321,0)
 ;s debug=1
"RTN","SAMICTR3",322,0)
 s lnn=$o(@rtn@(" "),-1)+1
"RTN","SAMICTR3",323,0)
 s @rtn@(lnn)=ln
"RTN","SAMICTR3",324,0)
 i $g(debug)=1 d  ;
"RTN","SAMICTR3",325,0)
 . i ln["<" q  ; no markup
"RTN","SAMICTR3",326,0)
 . n zs s zs=$STACK
"RTN","SAMICTR3",327,0)
 . n zp s zp=$STACK(zs-2,"PLACE")
"RTN","SAMICTR3",328,0)
 . s @rtn@(lnn)=zp_":"_ln
"RTN","SAMICTR3",329,0)
 q
"RTN","SAMICTR3",330,0)
 ;
"RTN","SAMICTR3",331,0)
HOUT(ln) ;
"RTN","SAMICTR3",332,0)
 d OUT("<p><span class='sectionhead'>"_ln_"</span>")
"RTN","SAMICTR3",333,0)
 q
"RTN","SAMICTR3",334,0)
 ;
"RTN","SAMICTR3",335,0)
XVAL(var,vals) ; extrinsic returns the patient value for var
"RTN","SAMICTR3",336,0)
 ; vals is passed by name
"RTN","SAMICTR3",337,0)
 n zr
"RTN","SAMICTR3",338,0)
 s zr=$g(@vals@(var))
"RTN","SAMICTR3",339,0)
 ;i zr="" s zr="["_var_"]"
"RTN","SAMICTR3",340,0)
 q zr
"RTN","SAMICTR3",341,0)
 ;
"RTN","SAMICTR3",342,0)
XSUB(var,vals,dict,valdx) ; extrinsic which returns the dictionary value defined by var
"RTN","SAMICTR3",343,0)
 ; vals and dict are passed by name
"RTN","SAMICTR3",344,0)
 ; valdx is used for nodules ala cect2co with the nodule number included
"RTN","SAMICTR3",345,0)
 ;n dict s dict=$$setroot^%wd("cteval-dict")
"RTN","SAMICTR3",346,0)
 n zr,zv,zdx
"RTN","SAMICTR3",347,0)
 s zdx=$g(valdx)
"RTN","SAMICTR3",348,0)
 i zdx="" s zdx=var
"RTN","SAMICTR3",349,0)
 s zv=$g(@vals@(zdx))
"RTN","SAMICTR3",350,0)
 ;i zv="" s zr="["_var_"]" q zr
"RTN","SAMICTR3",351,0)
 i zv="" s zr="" q zr
"RTN","SAMICTR3",352,0)
 s zr=$g(@dict@(var,zv))
"RTN","SAMICTR3",353,0)
 ;i zr="" s zr="["_var_","_zv_"]"
"RTN","SAMICTR3",354,0)
 q zr
"RTN","SAMICTR3",355,0)
 ;
"RTN","SAMICTR4")
0^3^B29262141
"RTN","SAMICTR4",1,0)
SAMICTR4 ;ven/gpl - ielcap: forms ; 3/19/19 1:27pm
"RTN","SAMICTR4",2,0)
 ;;18.0;SAMI;;;Build 1
"RTN","SAMICTR4",3,0)
 ;
"RTN","SAMICTR4",4,0)
 ;
"RTN","SAMICTR4",5,0)
 quit  ; no entry from top
"RTN","SAMICTR4",6,0)
 ;
"RTN","SAMICTR4",7,0)
BREAST(rtn,vals,dict) ;
"RTN","SAMICTR4",8,0)
 ; repgen6
"RTN","SAMICTR4",9,0)
 n destr s destr="is seen"
"RTN","SAMICTR4",10,0)
 n sba set sba=0
"RTN","SAMICTR4",11,0)
 ;   # Breast Abnormalities
"RTN","SAMICTR4",12,0)
 n bd,brt,blt
"RTN","SAMICTR4",13,0)
 s (bd,brt,blt)=0
"RTN","SAMICTR4",14,0)
 if $$XVAL("ceobard",vals)'="-" s brt=$$XVAL("ceobard",vals)
"RTN","SAMICTR4",15,0)
 if $$XVAL("ceobald",vals)'="-" s brt=$$XVAL("ceobald",vals)
"RTN","SAMICTR4",16,0)
 if (blt'=0)!(brt'=0) d  ;
"RTN","SAMICTR4",17,0)
 . d OUT("Breast:")
"RTN","SAMICTR4",18,0)
 . s bd=1
"RTN","SAMICTR4",19,0)
 if $$XVAL("ceara",vals)="y" d  ; our substitute for ceoba, which is null
"RTN","SAMICTR4",20,0)
 . if bd=0 d OUT("Breast:")
"RTN","SAMICTR4",21,0)
 . if $$XVAL("ceara",vals)="y" d  ;
"RTN","SAMICTR4",22,0)
 . . set sba=1
"RTN","SAMICTR4",23,0)
 . . n br
"RTN","SAMICTR4",24,0)
 . . set br=$$CCMSTR^SAMICTR3("ceobarc^ceobary^ceobarm",vals)
"RTN","SAMICTR4",25,0)
 . . if br="" d OUT("Noted in right breast: ")
"RTN","SAMICTR4",26,0)
 . . if br'="" d OUT(br_" right breast.")
"RTN","SAMICTR4",27,0)
 . . d OUT($$XVAL("ceobaros",vals)_"<br>")
"RTN","SAMICTR4",28,0)
 if $$XVAL("ceafa",vals)="y" d  ; our substitute for ceoba, which is null
"RTN","SAMICTR4",29,0)
 . if bd=0 d OUT("Breast:")
"RTN","SAMICTR4",30,0)
 . if $$XVAL("ceafa",vals)="y" d  ;
"RTN","SAMICTR4",31,0)
 . . set sba=1
"RTN","SAMICTR4",32,0)
 . . n br
"RTN","SAMICTR4",33,0)
 . . set br=$$CCMSTR^SAMICTR3("ceobafc^ceobafy^ceobafm",vals)
"RTN","SAMICTR4",34,0)
 . . if br="" d OUT("Noted in left breast: ")
"RTN","SAMICTR4",35,0)
 . . if br'="" d OUT(br_" left breast.")
"RTN","SAMICTR4",36,0)
 . . d OUT($$XVAL("ceobafos",vals)_"<br>")
"RTN","SAMICTR4",37,0)
 if bd=1 d  ;
"RTN","SAMICTR4",38,0)
 . if blt=brt d OUT("Density: "_$$XSUB("ceobad",vals,dict,"ceobald"))
"RTN","SAMICTR4",39,0)
 . else  d OUT("Density: Left "_$$XSUB("ceobad",vals,dict,"ceobald")_", Right "_$$XSUB("ceobad",vals,dict,"ceobard")_".")
"RTN","SAMICTR4",40,0)
 if $$XVAL("ceobrc",vals)'="" d OUT($$XVAL("ceobrc",vals)_para)
"RTN","SAMICTR4",41,0)
 else  if sba=1 d OUT(para)
"RTN","SAMICTR4",42,0)
 ;
"RTN","SAMICTR4",43,0)
 ;
"RTN","SAMICTR4",44,0)
 d OUT("Abdomen: ")
"RTN","SAMICTR4",45,0)
 n yesaa s yesaa=0
"RTN","SAMICTR4",46,0)
 ;  # Special Handling for the gallbladder
"RTN","SAMICTR4",47,0)
 ;
"RTN","SAMICTR4",48,0)
 if $$XVAL("ceaga",vals)="y" d  ;
"RTN","SAMICTR4",49,0)
 . d OUT("Limited view of the upper abdomen reveals the following: <br>")
"RTN","SAMICTR4",50,0)
 . set yesaa=1
"RTN","SAMICTR4",51,0)
 . if $$XVAL("ceagh",vals)="h" d  ;
"RTN","SAMICTR4",52,0)
 . . d OUT("status post cholecystectomy. <br>")
"RTN","SAMICTR4",53,0)
 . if $$XVAL("ceags",vals)="s" d  ;
"RTN","SAMICTR4",54,0)
 . . d OUT("Gallstones are noted. <br>")
"RTN","SAMICTR4",55,0)
 . if $$XVAL("ceagl",vals)="l" d  ;
"RTN","SAMICTR4",56,0)
 . . d OUT("Sludge is seen in the gall bladder. <br>")
"RTN","SAMICTR4",57,0)
 . if $$XVAL("ceago",vals)="y" d  ;
"RTN","SAMICTR4",58,0)
 . . d OUT("An abnormality was noted in the gall bladder: <br>")
"RTN","SAMICTR4",59,0)
 if $$XVAL("ceagos",vals)'="" d  ;
"RTN","SAMICTR4",60,0)
 . d OUT($$XVAL("ceagos",vals)_"<br>")
"RTN","SAMICTR4",61,0)
 ;
"RTN","SAMICTR4",62,0)
 n aalist
"RTN","SAMICTR4",63,0)
 s aalist(1,"spleen",0)=$$XVAL("ceasa",vals)
"RTN","SAMICTR4",64,0)
 s aalist(1,"spleen",1)="ceasc^ceasy^ceasm"
"RTN","SAMICTR4",65,0)
 s aalist(1,"spleen",2)=$$XVAL("ceasos",vals)
"RTN","SAMICTR4",66,0)
 s aalist(2,"liver",0)=$$XVAL("ceala",vals)
"RTN","SAMICTR4",67,0)
 s aalist(2,"liver",1)="cealc^cealy^cealm"
"RTN","SAMICTR4",68,0)
 s aalist(2,"liver",2)=$$XVAL("cealos",vals)
"RTN","SAMICTR4",69,0)
 s aalist(3,"pancreas",0)=$$XVAL("ceapa",vals)
"RTN","SAMICTR4",70,0)
 s aalist(3,"pancreas",1)="ceapc^ceapy^ceapm"
"RTN","SAMICTR4",71,0)
 s aalist(3,"pancreas",2)=$$XVAL("ceapos",vals)
"RTN","SAMICTR4",72,0)
 s aalist(4,"adrenals",0)=$$XVAL("ceaaa",vals)
"RTN","SAMICTR4",73,0)
 s aalist(4,"adrenals",1)="ceaac^ceaay^ceaam"
"RTN","SAMICTR4",74,0)
 s aalist(4,"adrenals",2)=$$XVAL("ceaaos",vals)
"RTN","SAMICTR4",75,0)
 s aalist(5,"kidneys",0)=$$XVAL("ceaka",vals)
"RTN","SAMICTR4",76,0)
 s aalist(5,"kidneys",1)="ceakc^ceaky^ceakm"
"RTN","SAMICTR4",77,0)
 s aalist(5,"kidneys",2)=$$XVAL("ceakos",vals)
"RTN","SAMICTR4",78,0)
 ;
"RTN","SAMICTR4",79,0)
 n zan,zaa s zaa=""
"RTN","SAMICTR4",80,0)
 f zan=1:1:5  d  ;
"RTN","SAMICTR4",81,0)
 . s zaa=$o(aalist(zan,""))
"RTN","SAMICTR4",82,0)
 . if aalist(zan,zaa,0)="y" d  ;
"RTN","SAMICTR4",83,0)
 . . n zout
"RTN","SAMICTR4",84,0)
 . . s zout=$$CCMSTR^SAMICTR3(aalist(zan,zaa,1),vals)
"RTN","SAMICTR4",85,0)
 . . set yesaa=1
"RTN","SAMICTR4",86,0)
 . . if zout="" d  ;
"RTN","SAMICTR4",87,0)
 . . . ;d OUT(aalist(zan,zaa,2))
"RTN","SAMICTR4",88,0)
 . . . if aalist(zan,zaa,2)'="" d OUT(aalist(zan,zaa,2)_"<br>")
"RTN","SAMICTR4",89,0)
 . . if zout'="" d  ;
"RTN","SAMICTR4",90,0)
 . . . d OUT("A "_$$LOWC^SAMICTR3(zout)_" "_zaa_". "_aalist(zan,zaa,2)_"<br>")
"RTN","SAMICTR4",91,0)
 ;
"RTN","SAMICTR4",92,0)
 ;# Other Abdominal Abnormalities
"RTN","SAMICTR4",93,0)
 ;
"RTN","SAMICTR4",94,0)
 if $$XVAL("ceaoab",vals)'="" d  ;
"RTN","SAMICTR4",95,0)
 . d OUT($$XVAL("ceaoab",vals)_"."_para)
"RTN","SAMICTR4",96,0)
 if yesaa=0  d  ;
"RTN","SAMICTR4",97,0)
 . d OUT("Limited view of the upper abdomen reveals no abnormalities."_para)
"RTN","SAMICTR4",98,0)
 ;
"RTN","SAMICTR4",99,0)
 d OUT("</p>")
"RTN","SAMICTR4",100,0)
 ;
"RTN","SAMICTR4",101,0)
 ;# Other Chest Abnormalities
"RTN","SAMICTR4",102,0)
 ;
"RTN","SAMICTR4",103,0)
 if $$XVAL("ceotab",vals)'="" d
"RTN","SAMICTR4",104,0)
 . d OUT("Other chest abnormalities:")
"RTN","SAMICTR4",105,0)
 . d OUT($$XVAL("ceotab",vals)_"."_para)
"RTN","SAMICTR4",106,0)
 ;
"RTN","SAMICTR4",107,0)
 ;# Bone Abnormalities
"RTN","SAMICTR4",108,0)
 ;
"RTN","SAMICTR4",109,0)
 if $$XVAL("ceaoabb",vals)'="" d  ;
"RTN","SAMICTR4",110,0)
 . d OUT("Bone:")
"RTN","SAMICTR4",111,0)
 . d OUT($$XVAL("ceaoabb",vals)_para)
"RTN","SAMICTR4",112,0)
 d  ;
"RTN","SAMICTR4",113,0)
 . q  ; LungRADS moved to SAMICTRA
"RTN","SAMICTR4",114,0)
 . n lradModifiers
"RTN","SAMICTR4",115,0)
 . s lradModifiers=$$XVAL("celradc",vals)_$$XVAL("celrads",vals)
"RTN","SAMICTR4",116,0)
 . ;
"RTN","SAMICTR4",117,0)
 . i ($$XVAL("celrad",vals)'="-")&($$XVAL("celrad",vals)'="") d  ;
"RTN","SAMICTR4",118,0)
 . . d OUT("The LungRADS category for this scan is: "_$$XVAL("celrad",vals)_" "_lradModifiers)
"RTN","SAMICTR4",119,0)
 . . d OUT(para)
"RTN","SAMICTR4",120,0)
 q
"RTN","SAMICTR4",121,0)
 ;
"RTN","SAMICTR4",122,0)
 ;
"RTN","SAMICTR4",123,0)
OUT(ln) ;
"RTN","SAMICTR4",124,0)
 s cnt=cnt+1
"RTN","SAMICTR4",125,0)
 n lnn
"RTN","SAMICTR4",126,0)
 ;s debug=1
"RTN","SAMICTR4",127,0)
 s lnn=$o(@rtn@(" "),-1)+1
"RTN","SAMICTR4",128,0)
 s @rtn@(lnn)=ln
"RTN","SAMICTR4",129,0)
 i $g(debug)=1 d  ;
"RTN","SAMICTR4",130,0)
 . i ln["<" q  ; no markup
"RTN","SAMICTR4",131,0)
 . n zs s zs=$STACK
"RTN","SAMICTR4",132,0)
 . n zp s zp=$STACK(zs-2,"PLACE")
"RTN","SAMICTR4",133,0)
 . s @rtn@(lnn)=zp_":"_ln
"RTN","SAMICTR4",134,0)
 q
"RTN","SAMICTR4",135,0)
 ;
"RTN","SAMICTR4",136,0)
HOUT(ln) ;
"RTN","SAMICTR4",137,0)
 d OUT("<p><span class='sectionhead'>"_ln_"</span>")
"RTN","SAMICTR4",138,0)
 q
"RTN","SAMICTR4",139,0)
 ;
"RTN","SAMICTR4",140,0)
XVAL(var,vals) ; extrinsic returns the patient value for var
"RTN","SAMICTR4",141,0)
 ; vals is passed by name
"RTN","SAMICTR4",142,0)
 n zr
"RTN","SAMICTR4",143,0)
 s zr=$g(@vals@(var))
"RTN","SAMICTR4",144,0)
 ;i zr="" s zr="["_var_"]"
"RTN","SAMICTR4",145,0)
 q zr
"RTN","SAMICTR4",146,0)
 ;
"RTN","SAMICTR4",147,0)
XSUB(var,vals,dict,valdx) ; extrinsic which returns the dictionary value defined by var
"RTN","SAMICTR4",148,0)
 ; vals and dict are passed by name
"RTN","SAMICTR4",149,0)
 ; valdx is used for nodules ala cect2co with the nodule number included
"RTN","SAMICTR4",150,0)
 ;n dict s dict=$$setroot^%wd("cteval-dict")
"RTN","SAMICTR4",151,0)
 n zr,zv,zdx
"RTN","SAMICTR4",152,0)
 s zdx=$g(valdx)
"RTN","SAMICTR4",153,0)
 i zdx="" s zdx=var
"RTN","SAMICTR4",154,0)
 s zv=$g(@vals@(zdx))
"RTN","SAMICTR4",155,0)
 ;i zv="" s zr="["_var_"]" q zr
"RTN","SAMICTR4",156,0)
 i zv="" s zr="" q zr
"RTN","SAMICTR4",157,0)
 s zr=$g(@dict@(var,zv))
"RTN","SAMICTR4",158,0)
 ;i zr="" s zr="["_var_","_zv_"]"
"RTN","SAMICTR4",159,0)
 q zr
"RTN","SAMICTR4",160,0)
 ;
"RTN","SAMICTR4",161,0)
 ;
"RTN","SAMINOT1")
0^1^B305486339
"RTN","SAMINOT1",1,0)
SAMINOT1 ;ven/gpl - ielcap: forms ; 5/7/19 4:48pm
"RTN","SAMINOT1",2,0)
 ;;18.0;SAMI;;;Build 1
"RTN","SAMINOT1",3,0)
 ;
"RTN","SAMINOT1",4,0)
 ;@license: see routine SAMIUL
"RTN","SAMINOT1",5,0)
 ;
"RTN","SAMINOT1",6,0)
 quit  ; no entry from top
"RTN","SAMINOT1",7,0)
 ;
"RTN","SAMINOT1",8,0)
EXISTCE(SID,FORM) ; extrinsic returns "true" or "false"
"RTN","SAMINOT1",9,0)
 ; if a Chart Eligibility Note exists
"RTN","SAMINOT1",10,0)
 n root s root=$$setroot^%wd("vapals-patients")
"RTN","SAMINOT1",11,0)
 n gvals s gvals=$na(@root@("graph",SID,FORM))
"RTN","SAMINOT1",12,0)
 ;i $g(@root@("graph",SID,FORM,"sicechrt"))="y" q "true"
"RTN","SAMINOT1",13,0)
 i $g(@gvals@("pre-note-complete"))="true" q "true"
"RTN","SAMINOT1",14,0)
 q "false"
"RTN","SAMINOT1",15,0)
 ;
"RTN","SAMINOT1",16,0)
EXISTPRE(SID,FORM) ; extrinsic returns "true" or "false"
"RTN","SAMINOT1",17,0)
 ; if a Pre-enrollment Note exists
"RTN","SAMINOT1",18,0)
 n root s root=$$setroot^%wd("vapals-patients")
"RTN","SAMINOT1",19,0)
 n gvals s gvals=$na(@root@("graph",SID,FORM))
"RTN","SAMINOT1",20,0)
 ;i $g(@root@("graph",SID,FORM,"sipedisc"))="y" q "true"
"RTN","SAMINOT1",21,0)
 i $g(@gvals@("pre-note-complete"))="true" i $g(@gvals@("siperslt"))="y" q "true"
"RTN","SAMINOT1",22,0)
 q "false"
"RTN","SAMINOT1",23,0)
 ;
"RTN","SAMINOT1",24,0)
EXISTINT(SID,FORM) ; extrinsic returns "true" or "false"
"RTN","SAMINOT1",25,0)
 ; if an Intake Note exists
"RTN","SAMINOT1",26,0)
 n root s root=$$setroot^%wd("vapals-patients")
"RTN","SAMINOT1",27,0)
 i $g(@root@("graph",SID,FORM,"sistatus"))="y" q "true"
"RTN","SAMINOT1",28,0)
 q "false"
"RTN","SAMINOT1",29,0)
 ;
"RTN","SAMINOT1",30,0)
WSNOTE(return,filter) ; web service which returns a text note
"RTN","SAMINOT1",31,0)
 ;
"RTN","SAMINOT1",32,0)
 n debug s debug=0
"RTN","SAMINOT1",33,0)
 i $g(filter("debug"))=1 s debug=1
"RTN","SAMINOT1",34,0)
 ;
"RTN","SAMINOT1",35,0)
 k return
"RTN","SAMINOT1",36,0)
 s HTTPRSP("mime")="text/html"
"RTN","SAMINOT1",37,0)
 ;
"RTN","SAMINOT1",38,0)
 n si
"RTN","SAMINOT1",39,0)
 s si=$g(filter("studyid"))
"RTN","SAMINOT1",40,0)
 i si="" d  ;
"RTN","SAMINOT1",41,0)
 . s si="XXX00333"
"RTN","SAMINOT1",42,0)
 q:si=""
"RTN","SAMINOT1",43,0)
 ;
"RTN","SAMINOT1",44,0)
 n samikey
"RTN","SAMINOT1",45,0)
 s samikey=$g(filter("form"))
"RTN","SAMINOT1",46,0)
 n root s root=$$setroot^%wd("vapals-patients")
"RTN","SAMINOT1",47,0)
 i samikey="" d  ;
"RTN","SAMINOT1",48,0)
 . s samikey=$o(@root@("graph",si,"siform"))
"RTN","SAMINOT1",49,0)
 . ;w !,samikey
"RTN","SAMINOT1",50,0)
 . ;b
"RTN","SAMINOT1",51,0)
 ;
"RTN","SAMINOT1",52,0)
 n vals
"RTN","SAMINOT1",53,0)
 m vals=@root@("graph",si,samikey)
"RTN","SAMINOT1",54,0)
 ;
"RTN","SAMINOT1",55,0)
 n note,nien,ntype
"RTN","SAMINOT1",56,0)
 s ntype=""
"RTN","SAMINOT1",57,0)
 s note=""
"RTN","SAMINOT1",58,0)
 s nien=$g(filter("nien"))
"RTN","SAMINOT1",59,0)
 i nien="" d
"RTN","SAMINOT1",60,0)
 . s:$g(vals("samistatus"))="complete" ntype="intake"
"RTN","SAMINOT1",61,0)
 . s:$g(vals("samistatus"))="chart-eligibility" ntype="eligibility"
"RTN","SAMINOT1",62,0)
 . s:$g(vals("samistatus"))="pre-enrollment-discussion" ntype="pre-note"
"RTN","SAMINOT1",63,0)
 . q:ntype=""
"RTN","SAMINOT1",64,0)
 . ;d nien=$$NTTYPE add code to pull the latest note by type
"RTN","SAMINOT1",65,0)
 q:nien=""
"RTN","SAMINOT1",66,0)
 n notebase
"RTN","SAMINOT1",67,0)
 s notebase=$$NTLOCN(si,samikey,nien) ; global location for the note
"RTN","SAMINOT1",68,0)
 s note=$na(@notebase@("text"))
"RTN","SAMINOT1",69,0)
 i '$d(@note) q
"RTN","SAMINOT1",70,0)
 ;
"RTN","SAMINOT1",71,0)
 new temp,tout
"RTN","SAMINOT1",72,0)
 do GETTMPL^SAMICASE("temp","vapals:note")
"RTN","SAMINOT1",73,0)
 quit:'$data(temp)
"RTN","SAMINOT1",74,0)
 ;
"RTN","SAMINOT1",75,0)
 n cnt s cnt=0
"RTN","SAMINOT1",76,0)
 n zi s zi=""
"RTN","SAMINOT1",77,0)
 ;
"RTN","SAMINOT1",78,0)
 f  s zi=$o(temp(zi)) q:zi=""  d  ;
"RTN","SAMINOT1",79,0)
 . ;
"RTN","SAMINOT1",80,0)
 . n line s line=temp(zi)
"RTN","SAMINOT1",81,0)
 . D LOAD^SAMIFORM(.line,samikey,si,.filter,.vals)
"RTN","SAMINOT1",82,0)
 . s temp(zi)=line
"RTN","SAMINOT1",83,0)
 . ;
"RTN","SAMINOT1",84,0)
 . s cnt=cnt+1
"RTN","SAMINOT1",85,0)
 . s tout(cnt)=temp(zi)
"RTN","SAMINOT1",86,0)
 . ;
"RTN","SAMINOT1",87,0)
 . i temp(zi)["report-text" d  ;
"RTN","SAMINOT1",88,0)
 . . i temp(zi)["#" q  ;
"RTN","SAMINOT1",89,0)
 . . n zj s zj=""
"RTN","SAMINOT1",90,0)
 . . f  s zj=$o(@note@(zj)) q:zj=""  d  ;
"RTN","SAMINOT1",91,0)
 . . . s cnt=cnt+1
"RTN","SAMINOT1",92,0)
 . . . ;s tout(cnt)=@note@(zj)_"<br>"
"RTN","SAMINOT1",93,0)
 . . . s tout(cnt)=@note@(zj)_$char(13,10)
"RTN","SAMINOT1",94,0)
 m return=tout
"RTN","SAMINOT1",95,0)
 q
"RTN","SAMINOT1",96,0)
 ;
"RTN","SAMINOT1",97,0)
NOTE(filter) ; extrnisic which creates a note
"RTN","SAMINOT1",98,0)
 ; returns 1 if successful, 0 if not
"RTN","SAMINOT1",99,0)
 ;
"RTN","SAMINOT1",100,0)
 ;
"RTN","SAMINOT1",101,0)
 ;
"RTN","SAMINOT1",102,0)
 ; set up patient values
"RTN","SAMINOT1",103,0)
 ;
"RTN","SAMINOT1",104,0)
 n vals
"RTN","SAMINOT1",105,0)
 ;
"RTN","SAMINOT1",106,0)
 n si
"RTN","SAMINOT1",107,0)
 s si=$g(filter("studyid"))
"RTN","SAMINOT1",108,0)
 i si="" d  ;
"RTN","SAMINOT1",109,0)
 . s si="XXX00333"
"RTN","SAMINOT1",110,0)
 q:si=""
"RTN","SAMINOT1",111,0)
 ;
"RTN","SAMINOT1",112,0)
 n samikey
"RTN","SAMINOT1",113,0)
 s samikey=$g(filter("form"))
"RTN","SAMINOT1",114,0)
 n root s root=$$setroot^%wd("vapals-patients")
"RTN","SAMINOT1",115,0)
 i samikey="" d  ;
"RTN","SAMINOT1",116,0)
 . s samikey=$o(@root@("graph",si,"siform"))
"RTN","SAMINOT1",117,0)
 . ;w !,samikey
"RTN","SAMINOT1",118,0)
 . ;b
"RTN","SAMINOT1",119,0)
 ;
"RTN","SAMINOT1",120,0)
 s vals=$na(@root@("graph",si,samikey))
"RTN","SAMINOT1",121,0)
 ;
"RTN","SAMINOT1",122,0)
 i '$d(@vals) d  q 0 ;
"RTN","SAMINOT1",123,0)
 . ;w !,"error, patient values not found"
"RTN","SAMINOT1",124,0)
 ;zwr @vals@(*)
"RTN","SAMINOT1",125,0)
 ;
"RTN","SAMINOT1",126,0)
 k ^SAMIUL("NOTE")
"RTN","SAMINOT1",127,0)
 m ^SAMIUL("NOTE","vals")=@vals
"RTN","SAMINOT1",128,0)
 m ^SAMIUL("NOTE","filter")=filter
"RTN","SAMINOT1",129,0)
 ;
"RTN","SAMINOT1",130,0)
 n didnote s didnote=0
"RTN","SAMINOT1",131,0)
 ;
"RTN","SAMINOT1",132,0)
 i $g(@vals@("samistatus"))="chart-eligibility" d  ;
"RTN","SAMINOT1",133,0)
 . d MKEL(si,samikey,vals,.filter) ;
"RTN","SAMINOT1",134,0)
 . s didnote=1
"RTN","SAMINOT1",135,0)
 ;
"RTN","SAMINOT1",136,0)
 i $g(@vals@("samistatus"))="pre-enrollment-discussion" d  ;
"RTN","SAMINOT1",137,0)
 . d MKPRE(si,samikey,vals,.filter) ;
"RTN","SAMINOT1",138,0)
 . s didnote=1
"RTN","SAMINOT1",139,0)
 ;
"RTN","SAMINOT1",140,0)
 i $g(@vals@("samistatus"))="complete" d  ;
"RTN","SAMINOT1",141,0)
 . q:$$HASINNT(vals)
"RTN","SAMINOT1",142,0)
 . d MKIN(si,samikey,vals,.filter) ;
"RTN","SAMINOT1",143,0)
 . s didnote=1
"RTN","SAMINOT1",144,0)
 ;
"RTN","SAMINOT1",145,0)
 q didnote
"RTN","SAMINOT1",146,0)
 ;
"RTN","SAMINOT1",147,0)
HASINNT(vals) ; extrinsic returns 1 if intake note is present
"RTN","SAMINOT1",148,0)
 ; else returns 0
"RTN","SAMINOT1",149,0)
 n zzi,zzrtn s (zzi,zzrtn)=0
"RTN","SAMINOT1",150,0)
 q:'$d(@vals)
"RTN","SAMINOT1",151,0)
 f  s zzi=$o(@vals@("notes",zzi)) q:+zzi=0  d  ;
"RTN","SAMINOT1",152,0)
 . i $g(@vals@("notes",zzi,"name"))["Intake" s zzrtn=1
"RTN","SAMINOT1",153,0)
 q zzrtn
"RTN","SAMINOT1",154,0)
 ;
"RTN","SAMINOT1",155,0)
MKEL(sid,form,vals,filter) ;
"RTN","SAMINOT1",156,0)
 n cnt s cnt=0
"RTN","SAMINOT1",157,0)
 ;n dest s dest=$na(@vals@("eligibility-note"))
"RTN","SAMINOT1",158,0)
 n dest s dest=$$MKNT(vals,"Eligibility Note","eligibility",.filter)
"RTN","SAMINOT1",159,0)
 k @dest
"RTN","SAMINOT1",160,0)
 d OUT("Lung Screening Program Chart Eligibility Note")
"RTN","SAMINOT1",161,0)
 d OUT("")
"RTN","SAMINOT1",162,0)
 d ELNOTE(vals,dest,cnt)
"RTN","SAMINOT1",163,0)
 q
"RTN","SAMINOT1",164,0)
 ;
"RTN","SAMINOT1",165,0)
MKPRE(sid,form,vals,filter) ;
"RTN","SAMINOT1",166,0)
 n cnt s cnt=0
"RTN","SAMINOT1",167,0)
 ;n dest s dest=$na(@vals@("pre-note"))
"RTN","SAMINOT1",168,0)
 n dest s dest=$$MKNT(vals,"Pre-enrollment Discussion Note","prenote",.filter)
"RTN","SAMINOT1",169,0)
 k @dest
"RTN","SAMINOT1",170,0)
 i $g(@vals@("chart-eligibility-complete"))'="true" d  ;
"RTN","SAMINOT1",171,0)
 . d OUT("Lung Screening Program Chart Eligibility and Pre-enrollment Discussion Note")
"RTN","SAMINOT1",172,0)
 . d OUT("")
"RTN","SAMINOT1",173,0)
 . d ELNOTE(vals,dest,cnt)
"RTN","SAMINOT1",174,0)
 i $g(@vals@("chart-eligibility-complete"))="true" d  ;
"RTN","SAMINOT1",175,0)
 . d OUT("Lung Screening Program Pre-enrollment Discussion Note")
"RTN","SAMINOT1",176,0)
 . d OUT("")
"RTN","SAMINOT1",177,0)
 d PRENOTE(vals,dest,cnt)
"RTN","SAMINOT1",178,0)
 q
"RTN","SAMINOT1",179,0)
 ;
"RTN","SAMINOT1",180,0)
MKIN(sid,form,vals,filter) ;
"RTN","SAMINOT1",181,0)
 n cnt s cnt=0
"RTN","SAMINOT1",182,0)
 ;n dest s dest=$na(@vals@("intake-note"))
"RTN","SAMINOT1",183,0)
 n dest s dest=$$MKNT(vals,"Intake Note","intake",.filter)
"RTN","SAMINOT1",184,0)
 k @dest
"RTN","SAMINOT1",185,0)
 d OUT("Lung Screening Program Intake Note")
"RTN","SAMINOT1",186,0)
 d OUT("")
"RTN","SAMINOT1",187,0)
 i $g(@vals@("chart-eligibility-complete"))'="true" d  ;
"RTN","SAMINOT1",188,0)
 . d ELNOTE(vals,dest,cnt)
"RTN","SAMINOT1",189,0)
 i $g(@vals@("pre-note-complete"))'="true" d  ;
"RTN","SAMINOT1",190,0)
 . d PRENOTE(vals,dest,cnt)
"RTN","SAMINOT1",191,0)
 d INNOTE(vals,dest,cnt)
"RTN","SAMINOT1",192,0)
 q
"RTN","SAMINOT1",193,0)
 ;
"RTN","SAMINOT1",194,0)
MKNT(vals,title,ntype,filter) ; extrinsic makes a note date=now returns 
"RTN","SAMINOT1",195,0)
 ; global addr. filter must be passed by reference
"RTN","SAMINOT1",196,0)
 n ntdt s ntdt=$$NTDTTM($$NOW^XLFDT)
"RTN","SAMINOT1",197,0)
 n ntptr
"RTN","SAMINOT1",198,0)
 s ntptr=$$MKNTLOC(vals,title,ntdt,$g(ntype),.filter)
"RTN","SAMINOT1",199,0)
 q ntptr
"RTN","SAMINOT1",200,0)
 ;
"RTN","SAMINOT1",201,0)
MKNTLOC(vals,title,ndate,ntype,filter) ; extrinsic returns the 
"RTN","SAMINOT1",202,0)
 ;location for the note
"RTN","SAMINOT1",203,0)
 n nien
"RTN","SAMINOT1",204,0)
 s nien=$o(@vals@("notes",""),-1)+1
"RTN","SAMINOT1",205,0)
 s filter("nien")=nien
"RTN","SAMINOT1",206,0)
 n nloc s nloc=$na(@vals@("notes",nien))
"RTN","SAMINOT1",207,0)
 s @nloc@("name")=title_" "_$g(ndate)
"RTN","SAMINOT1",208,0)
 s @nloc@("date")=$g(ndate)
"RTN","SAMINOT1",209,0)
 s @nloc@("type")=$g(ntype)
"RTN","SAMINOT1",210,0)
 q $na(@nloc@("text"))
"RTN","SAMINOT1",211,0)
 ;
"RTN","SAMINOT1",212,0)
NTDTTM(ZFMDT) ; extrinsic returns the date and time in Note format
"RTN","SAMINOT1",213,0)
 ; ZFMDT is the fileman date/time to translate
"RTN","SAMINOT1",214,0)
 q $$FMTE^XLFDT(ZFMDT,"5")
"RTN","SAMINOT1",215,0)
 ;
"RTN","SAMINOT1",216,0)
NTLOCN(sid,form,nien) ; extrinsic returns the location of the Nth note
"RTN","SAMINOT1",217,0)
 n root s root=$$setroot^%wd("vapals-patients")
"RTN","SAMINOT1",218,0)
 q $na(@root@("graph",sid,form,"notes",nien))
"RTN","SAMINOT1",219,0)
 ;
"RTN","SAMINOT1",220,0)
NTLAST(sid,form,ntype) ; extrinsic returns the location of the latest note
"RTN","SAMINOT1",221,0)
 ; of the type ntype
"RTN","SAMINOT1",222,0)
 q
"RTN","SAMINOT1",223,0)
 ;
"RTN","SAMINOT1",224,0)
NTLIST(nlist,sid,form) ; returns the note list in nlist, passed by ref
"RTN","SAMINOT1",225,0)
 ;
"RTN","SAMINOT1",226,0)
 n zn,root,gn
"RTN","SAMINOT1",227,0)
 s root=$$setroot^%wd("vapals-patients")
"RTN","SAMINOT1",228,0)
 s zn=0
"RTN","SAMINOT1",229,0)
 s gn=$na(@root@("graph",sid,form,"notes"))
"RTN","SAMINOT1",230,0)
 q:'$d(@gn)
"RTN","SAMINOT1",231,0)
 f  s zn=$o(@gn@(zn)) q:+zn=0  d  ;
"RTN","SAMINOT1",232,0)
 . s @nlist@(zn,"name")=@gn@(zn,"name")
"RTN","SAMINOT1",233,0)
 . s @nlist@(zn,"nien")=zn
"RTN","SAMINOT1",234,0)
 ;
"RTN","SAMINOT1",235,0)
 q
"RTN","SAMINOT1",236,0)
 ;
"RTN","SAMINOT1",237,0)
TLST ;
"RTN","SAMINOT1",238,0)
 S SID="XXX00677"
"RTN","SAMINOT1",239,0)
 S FORM="siform-2019-04-23"
"RTN","SAMINOT1",240,0)
 D NTLIST("G",SID,FORM)
"RTN","SAMINOT1",241,0)
 ;ZWR G
"RTN","SAMINOT1",242,0)
 Q
"RTN","SAMINOT1",243,0)
 ;
"RTN","SAMINOT1",244,0)
ELNOTE(vals,dest,cnt) ; eligibility NOTE TEXT
"RTN","SAMINOT1",245,0)
 D OUT("")
"RTN","SAMINOT1",246,0)
 D OUT("Date of chart review: "_$$XVAL("sidc",vals))
"RTN","SAMINOT1",247,0)
 D OUT("The participant was identified as a potential lung screening candidate by: "_$$XVAL("siceiden",vals))
"RTN","SAMINOT1",248,0)
 if $$XVAL("siceiden",vals)="referral" d  ;
"RTN","SAMINOT1",249,0)
 . D OUT("Date of Referral: "_$$XVAL("sicerfdt",vals))
"RTN","SAMINOT1",250,0)
 . n spec s spec=""
"RTN","SAMINOT1",251,0)
 . s:$$XVAL("sicerfpc",vals)="y" spec=spec_" Primary Care"
"RTN","SAMINOT1",252,0)
 . s:$$XVAL("sicerfwh",vals)="y" spec=spec_" Women's Health"
"RTN","SAMINOT1",253,0)
 . s:$$XVAL("sicerfge",vals)="y" spec=spec_" Geriatrics"
"RTN","SAMINOT1",254,0)
 . s:$$XVAL("sicerfpu",vals)="y" spec=spec_" Pulmonology"
"RTN","SAMINOT1",255,0)
 . s:$$XVAL("sicerfon",vals)="y" spec=spec_" Oncology"
"RTN","SAMINOT1",256,0)
 . s:$$XVAL("sicerfsc",vals)="y" spec=spec_" Smoking Cessation"
"RTN","SAMINOT1",257,0)
 . s:$$XVAL("sicerfot",vals)="y" spec=spec_" "_$$XVAL("sicerfoo",vals)
"RTN","SAMINOT1",258,0)
 . D OUT("Specialty of referring provider: "_spec)
"RTN","SAMINOT1",259,0)
 n elig
"RTN","SAMINOT1",260,0)
 s elig=$$XVAL("sicechrt",vals)
"RTN","SAMINOT1",261,0)
 D OUT("The participant is eligible based on chart review: "_$s(elig="y":"Yes",1:"no"))
"RTN","SAMINOT1",262,0)
 D OUT("")
"RTN","SAMINOT1",263,0)
 s @vals@("chart-eligibility-complete")="true"
"RTN","SAMINOT1",264,0)
 q
"RTN","SAMINOT1",265,0)
 ;
"RTN","SAMINOT1",266,0)
PRENOTE(vals,dest,cnt) ;
"RTN","SAMINOT1",267,0)
 ;
"RTN","SAMINOT1",268,0)
 i $g(@vals@("sipedisc"))'="y" q  ; no prelim discussion
"RTN","SAMINOT1",269,0)
 D OUT("")
"RTN","SAMINOT1",270,0)
 ;d OUT("A pre-enrollment discussion was held.")
"RTN","SAMINOT1",271,0)
 ;[If Yes is selected then add the following 5 lines]
"RTN","SAMINOT1",272,0)
 D OUT("The program attempted to reach the Veteran to discuss lung screening.")
"RTN","SAMINOT1",273,0)
 D OUT("Date of pre-enrollment discussion: "_$$XVAL("sipedc",vals))
"RTN","SAMINOT1",274,0)
 n via s via=""
"RTN","SAMINOT1",275,0)
 s:$$XVAL("sipecnip",vals)="1" via=via_" In person"
"RTN","SAMINOT1",276,0)
 s:$$XVAL("sipecnte",vals)="1" via=via_" Telephone"
"RTN","SAMINOT1",277,0)
 s:$$XVAL("sipecnth",vals)="1" via=via_" TeleHealth"
"RTN","SAMINOT1",278,0)
 s:$$XVAL("sipecnml",vals)="1" via=via_" Mailed Letter"
"RTN","SAMINOT1",279,0)
 s:$$XVAL("sipecnpp",vals)="1" via=via_" Message in patient portal"
"RTN","SAMINOT1",280,0)
 s:$$XVAL("sipecnvd",vals)="1" via=via_" Video-on-Demand (VOD)"
"RTN","SAMINOT1",281,0)
 s:$$XVAL("sipecnot",vals)="1" via=via_" "_$$XVAL("sipecnoo",vals)
"RTN","SAMINOT1",282,0)
 D OUT("The lung screening program reached the potential candidate or was contacted via:"_via)
"RTN","SAMINOT1",283,0)
 D OUT("The pre-enrollment discussion with the participant resulted in: "_$$SUBRSLT($$XVAL("siperslt",vals)))
"RTN","SAMINOT1",284,0)
 D OUT("Comments: "_$$XVAL("sipecmnt",vals))
"RTN","SAMINOT1",285,0)
 ;
"RTN","SAMINOT1",286,0)
 s @vals@("pre-note-complete")="true"
"RTN","SAMINOT1",287,0)
 q
"RTN","SAMINOT1",288,0)
 ;
"RTN","SAMINOT1",289,0)
SUBRSLT(XVAL) ; translation of discussion result
"RTN","SAMINOT1",290,0)
 q:XVAL="y" "Participant is interested in discussing lung screening. The program will proceed with enrollment process."
"RTN","SAMINOT1",291,0)
 q:XVAL="u" "Participant is unsure of lung screening. Ok to contact in the future."
"RTN","SAMINOT1",292,0)
 q:XVAL="nn" "Participant is not interested in discussing lung screening at this time. Ok to contact in the future."
"RTN","SAMINOT1",293,0)
 q:XVAL="nf" "Participant is not interested in discussing lung screening in the future."
"RTN","SAMINOT1",294,0)
 q:XVAL="na" "Unable to reach participant at this time"
"RTN","SAMINOT1",295,0)
 q ""
"RTN","SAMINOT1",296,0)
 ;
"RTN","SAMINOT1",297,0)
INNOTE(vals,dest,cnt) ;
"RTN","SAMINOT1",298,0)
 ;
"RTN","SAMINOT1",299,0)
 ;Lung Screening Program Intake Note
"RTN","SAMINOT1",300,0)
 ;
"RTN","SAMINOT1",301,0)
 ;Date of intake discussion contact:       [Date]
"RTN","SAMINOT1",302,0)
 ;How did you learn about the Lung Screening Program?:  [Selection]
"RTN","SAMINOT1",303,0)
 ;Primary address verified:                 [Yes/No]
"RTN","SAMINOT1",304,0)
 ;Rural status:                                        [Urban/Rural/Unknown]
"RTN","SAMINOT1",305,0)
 ;Preferred address and contact number:
"RTN","SAMINOT1",306,0)
 ;     [Address 1]
"RTN","SAMINOT1",307,0)
 ;           [Address 2]
"RTN","SAMINOT1",308,0)
 ;              [Address]
"RTN","SAMINOT1",309,0)
 ;
"RTN","SAMINOT1",310,0)
 ;Ever smoked?:            [Ever Smoked Text]
"RTN","SAMINOT1",311,0)
 ;Smoking Status:          [Never Smoked/Past/Current/Willing to Quit]
"RTN","SAMINOT1",312,0)
 ;CIGs per day:               [Input Number]
"RTN","SAMINOT1",313,0)
 ;PPD:                              [Computed Number]
"RTN","SAMINOT1",314,0)
 ;# of years:                    [Input Number]
"RTN","SAMINOT1",315,0)
 ;Pack Years:                   [Computed Number]
"RTN","SAMINOT1",316,0)
 ;
"RTN","SAMINOT1",317,0)
 ;[If a Quit Date is entered add the following line]
"RTN","SAMINOT1",318,0)
 ;Quit smoking on:         [Date]
"RTN","SAMINOT1",319,0)
 ;
"RTN","SAMINOT1",320,0)
 ;[If Smoking Cessation education text is entered add the following line]
"RTN","SAMINOT1",321,0)
 ;Smoking cessation education provided: [Show Input Text]
"RTN","SAMINOT1",322,0)
 ;
"RTN","SAMINOT1",323,0)
 ;[If a Lung Cancer Dx date is entered show the following 1 to 2 lines]
"RTN","SAMINOT1",324,0)
 ;Prior lung cancer diagnosis date: [Date]
"RTN","SAMINOT1",325,0)
 ;[If a location not in the VA is specified show the next line]
"RTN","SAMINOT1",326,0)
 ;Location where prior lung cancer diagnosis was made: [Location Text]
"RTN","SAMINOT1",327,0)
 ;
"RTN","SAMINOT1",328,0)
 ;[If Any Prior CT Date is entered show the following 1 to 2 lines]
"RTN","SAMINOT1",329,0)
 ;Prior CT:                   [Date]
"RTN","SAMINOT1",330,0)
 ;[If a location not in the VA is specified show the next line]
"RTN","SAMINOT1",331,0)
 ;Location where prior lung cancer diagnosis was made: [Location Text]
"RTN","SAMINOT1",332,0)
 ;
"RTN","SAMINOT1",333,0)
 ;Shared Decision Making:
"RTN","SAMINOT1",334,0)
 ;
"RTN","SAMINOT1",335,0)
 d OUT(" ")
"RTN","SAMINOT1",336,0)
 d OUT("   "_"Date of intake discussion contact: "_$$XVAL("sidc",vals))
"RTN","SAMINOT1",337,0)
 n learn s learn=""
"RTN","SAMINOT1",338,0)
 s:$$XVAL("silnip",vals) learn=learn_" In person"
"RTN","SAMINOT1",339,0)
 s:$$XVAL("silnph",vals) learn=learn_" Telephone"
"RTN","SAMINOT1",340,0)
 s:$$XVAL("silnth",vals) learn=learn_" TeleHealth"
"RTN","SAMINOT1",341,0)
 s:$$XVAL("silnml",vals) learn=learn_" Mailed letter"
"RTN","SAMINOT1",342,0)
 s:$$XVAL("silnpp",vals) learn=learn_" Message in patient portal"
"RTN","SAMINOT1",343,0)
 s:$$XVAL("silnvd",vals) learn=learn_" Video-on-Demand (VOD)"
"RTN","SAMINOT1",344,0)
 s:$$XVAL("silnot",vals) learn=learn_" "_$$XVAL("silnoo",vals)
"RTN","SAMINOT1",345,0)
 d OUT("   "_"How did you learn about the Lung Screening Program?: "_learn)
"RTN","SAMINOT1",346,0)
 n verified s verified=""
"RTN","SAMINOT1",347,0)
 s:$$XVAL("sipav",vals)="y" verified="Yes"
"RTN","SAMINOT1",348,0)
 s:$$XVAL("sipav",vals)="n" verified="No"
"RTN","SAMINOT1",349,0)
 d OUT("   "_"Primary address verified: "_verified)
"RTN","SAMINOT1",350,0)
 n rural s rural=""
"RTN","SAMINOT1",351,0)
 s:$$XVAL("sirs",vals)="r" rural="rural"
"RTN","SAMINOT1",352,0)
 s:$$XVAL("sirs",vals)="u" rural="urban"
"RTN","SAMINOT1",353,0)
 d OUT("   "_""_"Rural status: "_rural)
"RTN","SAMINOT1",354,0)
 d OUT("   "_"Preferred address and contact number: ")
"RTN","SAMINOT1",355,0)
 n pa s pa=""
"RTN","SAMINOT1",356,0)
 i $$XVAL("sipsa",vals)'="" d  ;
"RTN","SAMINOT1",357,0)
 . d OUT("      "_$$XVAL("sipsa",vals))
"RTN","SAMINOT1",358,0)
 . n csz s csz=""
"RTN","SAMINOT1",359,0)
 . s:$$XVAL("sipc",vals)'="" csz=$$XVAL("sipc",vals)
"RTN","SAMINOT1",360,0)
 . s:$$XVAL("sips",vals)'="" csz=csz_", "_$$XVAL("sips",vals)
"RTN","SAMINOT1",361,0)
 . s:$$XVAL("sipz",vals)'="" csz=csz_" "_$$XVAL("sipz",vals)
"RTN","SAMINOT1",362,0)
 . d OUT("      "_csz)
"RTN","SAMINOT1",363,0)
 d:$$XVAL("sippn",vals)'="" OUT("      "_$$XVAL("sippn",vals))
"RTN","SAMINOT1",364,0)
 d OUT("   "_"Ever smoked?: ")
"RTN","SAMINOT1",365,0)
 d OUT("      "_$$XVAL("sies",vals))
"RTN","SAMINOT1",366,0)
 n sstatus s sstatus=""
"RTN","SAMINOT1",367,0)
 s:$$XVAL("siesm",vals)="n" sstatus=sstatus_" Never smoked"
"RTN","SAMINOT1",368,0)
 s:$$XVAL("siesm",vals)="p" sstatus=sstatus_" Past"
"RTN","SAMINOT1",369,0)
 s:$$XVAL("siesm",vals)="c" sstatus=sstatus_" Current"
"RTN","SAMINOT1",370,0)
 s:$$XVAL("siesq",vals)=1 sstatus=sstatus_" Willing to quit"
"RTN","SAMINOT1",371,0)
 d OUT("   Smoking Status: "_sstatus)
"RTN","SAMINOT1",372,0)
 d OUT("   "_"CIGs per day: ")
"RTN","SAMINOT1",373,0)
 d OUT("      "_$$XVAL("sicpd",vals))
"RTN","SAMINOT1",374,0)
 d OUT("   "_"PPD: ")
"RTN","SAMINOT1",375,0)
 d OUT("      "_$$XVAL("sippd",vals))
"RTN","SAMINOT1",376,0)
 d OUT("   "_"# of years: ")
"RTN","SAMINOT1",377,0)
 d OUT("      "_$$XVAL("sisny",vals))
"RTN","SAMINOT1",378,0)
 d OUT("   "_"PPY: ")
"RTN","SAMINOT1",379,0)
 d OUT("      "_$$XVAL("sippy",vals))
"RTN","SAMINOT1",380,0)
 d OUT("")
"RTN","SAMINOT1",381,0)
 i $$XVAL("siq",vals)'="" d  ;
"RTN","SAMINOT1",382,0)
 . d OUT("Quit smoking on: "_$$XVAL("siq",vals))
"RTN","SAMINOT1",383,0)
 . d OUT("")
"RTN","SAMINOT1",384,0)
 i $$XVAL("sicep",vals)'="" d  ;
"RTN","SAMINOT1",385,0)
 . d OUT("Smoking cessation education provided:")
"RTN","SAMINOT1",386,0)
 . d OUT("    "_$$XVAL("sicep",vals))
"RTN","SAMINOT1",387,0)
 i $$XVAL("sicadx",vals)'="" d
"RTN","SAMINOT1",388,0)
 . d OUT("Prior lung cancer diagnosis date: "_$$XVAL("sicadx",vals))
"RTN","SAMINOT1",389,0)
 . i $$XVAL("sicadxl",vals)'="" d  ;
"RTN","SAMINOT1",390,0)
 . . d OUT("Location where prior lung cancer diagnosis was made:")
"RTN","SAMINOT1",391,0)
 . . d OUT("    "_$$XVAL("sicadxl",vals))
"RTN","SAMINOT1",392,0)
 i $$XVAL("siptct",vals)'="" d
"RTN","SAMINOT1",393,0)
 . d OUT("Prior CT: "_$$XVAL("siptct",vals))
"RTN","SAMINOT1",394,0)
 . i $$XVAL("siptctl",vals)'="" d  ;
"RTN","SAMINOT1",395,0)
 . . d OUT("Location where prior CT was made:")
"RTN","SAMINOT1",396,0)
 . . d OUT("    "_$$XVAL("siptctl",vals))
"RTN","SAMINOT1",397,0)
 d OUT(" ")
"RTN","SAMINOT1",398,0)
 d OUT("Shared Decision Making: ")
"RTN","SAMINOT1",399,0)
 d OUT(" ")
"RTN","SAMINOT1",400,0)
 n sdm s sdm=""
"RTN","SAMINOT1",401,0)
 s sdm=sdm_"Veteran of age and exposure to cigarette smoke as described above, and without a "
"RTN","SAMINOT1",402,0)
 s sdm=sdm_"current diagnosis or obvious symptoms suggestive of lung cancer, has been educated "
"RTN","SAMINOT1",403,0)
 s sdm=sdm_"today about the estimated risk for lung cancer, the possibility of a cure or life "
"RTN","SAMINOT1",404,0)
 s sdm=sdm_"prolonging if an early lung cancer were to be found during screening, the possibility of "
"RTN","SAMINOT1",405,0)
 s sdm=sdm_"imaging abnormalities not being lung cancer, the possibility of complications from "
"RTN","SAMINOT1",406,0)
 s sdm=sdm_"additional diagnostic procedures, and the approximate amount of radiation exposure "
"RTN","SAMINOT1",407,0)
 s sdm=sdm_"associated with each screening procedure. In addition, the veteran has been educated "
"RTN","SAMINOT1",408,0)
 s sdm=sdm_"today about the importance of avoiding exposure to cigarette smoke, available tobacco "
"RTN","SAMINOT1",409,0)
 s sdm=sdm_"cessation programs and available lung screening services at this VA facility. Education "
"RTN","SAMINOT1",410,0)
 s sdm=sdm_"material was provided to the veteran."
"RTN","SAMINOT1",411,0)
 s sdm=sdm_"Veteran of age and exposure to cigarette smoke as described above, and without a "
"RTN","SAMINOT1",412,0)
 s sdm=sdm_"current diagnosis or obvious symptoms suggestive of lung cancer, has been educated "
"RTN","SAMINOT1",413,0)
 s sdm=sdm_"today about the estimated risk for lung cancer, the possibility of a cure or life "
"RTN","SAMINOT1",414,0)
 s sdm=sdm_"prolonging if an early lung cancer were to be found during screening, the possibility of "
"RTN","SAMINOT1",415,0)
 s sdm=sdm_"imaging abnormalities not being lung cancer, the possibility of complications from "
"RTN","SAMINOT1",416,0)
 s sdm=sdm_"additional diagnostic procedures, and the approximate amount of radiation exposure "
"RTN","SAMINOT1",417,0)
 s sdm=sdm_"associated with each screening procedure. In addition, the veteran has been educated "
"RTN","SAMINOT1",418,0)
 s sdm=sdm_"today about the importance of avoiding exposure to cigarette smoke, available tobacco "
"RTN","SAMINOT1",419,0)
 s sdm=sdm_"cessation programs and available lung screening services at this VA facility. Education "
"RTN","SAMINOT1",420,0)
 s sdm=sdm_"material was provided to the veteran."
"RTN","SAMINOT1",421,0)
 d OUT(sdm)
"RTN","SAMINOT1",422,0)
 ;d OUT(" ")
"RTN","SAMINOT1",423,0)
 ;d OUT("Veteran of age and exposure to cigarette smoke as described above, and without")
"RTN","SAMINOT1",424,0)
 ;d OUT("a current diagnosis or obvious symptoms suggestive of lung cancer, has been")
"RTN","SAMINOT1",425,0)
 ;d OUT("educated today about the estimated risk for lung cancer, the possibility of")
"RTN","SAMINOT1",426,0)
 ;d OUT("cure or life prolonging if an early lung cancer were to be found during")
"RTN","SAMINOT1",427,0)
 ;d OUT("screening, the possibility of imaging abnormalities not being lung cancer, the")
"RTN","SAMINOT1",428,0)
 ;d OUT("possibility of complications from additional diagnostic procedures, and the")
"RTN","SAMINOT1",429,0)
 ;d OUT("approximate amount of radiation exposure associated with each screening")
"RTN","SAMINOT1",430,0)
 ;d OUT("procedure.  In addition, the veteran has been educated today about the")
"RTN","SAMINOT1",431,0)
 ;d OUT("importance of adhering to annual lung screening, the possible impact of other")
"RTN","SAMINOT1",432,0)
 ;d OUT("medical conditions on the overall health status, the importance of avoiding")
"RTN","SAMINOT1",433,0)
 ;d OUT("exposure to cigarette smoke, available tobacco cessation programs and")
"RTN","SAMINOT1",434,0)
 ;d OUT("available lung screening services at the Phoenix VA.  Education material was")
"RTN","SAMINOT1",435,0)
 ;d OUT("provided to the veteran.  Based on this information, the veteran has opted")
"RTN","SAMINOT1",436,0)
 ;d OUT("for: ")
"RTN","SAMINOT1",437,0)
 d OUT(" ")
"RTN","SAMINOT1",438,0)
 n ldct s ldct=""
"RTN","SAMINOT1",439,0)
 s:$$XVAL("sildct",vals)="n" ldct="No"
"RTN","SAMINOT1",440,0)
 s:$$XVAL("sildct",vals)="l" ldct="No"
"RTN","SAMINOT1",441,0)
 s:$$XVAL("sildct",vals)="y" ldct="Yes"
"RTN","SAMINOT1",442,0)
 d OUT("The veteran has decided to enroll in the Lung Screening Program: "_ldct)
"RTN","SAMINOT1",443,0)
 i $$XVAL("sildct",vals)="l" d  ;
"RTN","SAMINOT1",444,0)
 . d OUT("The veteran has indicated it is okay to contact in the future to discuss enrolling in the Lung Screening Program.")
"RTN","SAMINOT1",445,0)
 i ldct="Yes" d  ;
"RTN","SAMINOT1",446,0)
 . d OUT("LDCT ordered: "_ldct)
"RTN","SAMINOT1",447,0)
 . d OUT("    "_"Veteran enrolled in the LSS program. Results and coordination of care ")
"RTN","SAMINOT1",448,0)
 . d OUT("    "_"will be made by the LSS team.  ")
"RTN","SAMINOT1",449,0)
 . i $$XVAL("siclin",vals)'="" d  ;
"RTN","SAMINOT1",450,0)
 . d OUT("Clinical Indications for Initial Screening CT:")
"RTN","SAMINOT1",451,0)
 . d OUT("    "_$$XVAL("siclin",vals))
"RTN","SAMINOT1",452,0)
 ;
"RTN","SAMINOT1",453,0)
 ;The veteran has decided to enroll in the Lung Screening Program: [Yes/No]
"RTN","SAMINOT1",454,0)
 ;
"RTN","SAMINOT1",455,0)
 ;[If Not enroll at this time but okay to contact in the future, add the following line]
"RTN","SAMINOT1",456,0)
 ;The veteran has indicated it is okay to contact in the future to discuss enrolling in the Lung Screening Program.
"RTN","SAMINOT1",457,0)
 ;
"RTN","SAMINOT1",458,0)
 ;[If Yes is answered for enrollment add the following two lines]
"RTN","SAMINOT1",459,0)
 ;LDCT ordered:                Yes
"RTN","SAMINOT1",460,0)
 ;Veteran enrolled in the Lung Screening Program. Results and coordination of care will be made by the Lung Screening Program team.
"RTN","SAMINOT1",461,0)
 ;
"RTN","SAMINOT1",462,0)
 ;[If Clinical Indication text is provided add them to the note]
"RTN","SAMINOT1",463,0)
 ;Clinical Indications:          [Show Input Text]
"RTN","SAMINOT1",464,0)
 ;
"RTN","SAMINOT1",465,0)
 ;
"RTN","SAMINOT1",466,0)
 q
"RTN","SAMINOT1",467,0)
 ;
"RTN","SAMINOT1",468,0)
OUT(ln) ;
"RTN","SAMINOT1",469,0)
 s cnt=cnt+1
"RTN","SAMINOT1",470,0)
 n lnn
"RTN","SAMINOT1",471,0)
 ;s debug=1
"RTN","SAMINOT1",472,0)
 s lnn=$o(@dest@(" "),-1)+1
"RTN","SAMINOT1",473,0)
 s @dest@(lnn)=ln
"RTN","SAMINOT1",474,0)
 ;i $g(debug)=1 d  ;
"RTN","SAMINOT1",475,0)
 ;. i ln["<" q  ; no markup
"RTN","SAMINOT1",476,0)
 ;. n zs s zs=$STACK
"RTN","SAMINOT1",477,0)
 ;. n zp s zp=$STACK(zs-2,"PLACE")
"RTN","SAMINOT1",478,0)
 ;. s @dest@(lnn)=zp_":"_ln
"RTN","SAMINOT1",479,0)
 q
"RTN","SAMINOT1",480,0)
 ;
"RTN","SAMINOT1",481,0)
XVAL(var,vals) ; extrinsic returns the patient value for var
"RTN","SAMINOT1",482,0)
 ; vals is passed by name
"RTN","SAMINOT1",483,0)
 n zr
"RTN","SAMINOT1",484,0)
 s zr=$g(@vals@(var))
"RTN","SAMINOT1",485,0)
 ;i zr="" s zr="["_var_"]"
"RTN","SAMINOT1",486,0)
 q zr
"RTN","SAMINOT1",487,0)
 ;
"RTN","SAMINOT1",488,0)
 ;
"VER")
8.0^22.2
**END**
**END**
