Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ LANGUAGE = "VBSCRIPT" %>
- <!--#INCLUDE FILE = includes/hasrights.asp -->
- <!--#INCLUDE FILE = includes/audit.asp -->
- <%
- Function TableExists(sWhichTable)
- q = "select RDB$FIELD_NAME from RDB$RELATION_FIELDS where "&_
- "RDB$RELATION_NAME = '"&sWhichTable&"' "
- myRS.Open q, MyConn
- TableExists = not myRS.eof
- myRS.Close
- End Function
- Function cleanValue (measValue)
- If (measValue <> "") then
- measValue = Replace(measValue, " mm3", "")
- measValue = Replace(measValue, " mm", "")
- End If
- cleanValue = measValue
- End Function
- Function GetLine
- If InStr(sDatalinkData, chr(13)&chr(10)) <> 0 then
- GetLine = mid(sDatalinkData, 1, InStr(sDatalinkData, chr(13)&chr(10))-1)
- sDatalinkData = mid(sDatalinkData, InStr(sDatalinkData, chr(13)&chr(10))+2, len(sDatalinkData) )
- else
- GetLine = sDatalinkData
- sDatalinkData = ""
- End If
- End Function
- Function recordValue(x)
- measVal = Abs(cleanValue(Split(x," ",-1,1)(1)))
- If(CINT(measVal) > -50000) then
- recordValue = measVal
- else
- recordValue = "null"
- End If
- End Function
- Function insertOrganMeasurements(examNo, location, x1,x2,x3,x4)
- q = "UPDATE T_ORGAN_MEASUREMENTS SET TR="&x1&",AP="&x2&",CC="&x3&",VOLUME ="&x4&" WHERE PAT_ID ='"&Request.QueryString("PatID")&"' AND EPISODE = "&Request.QueryString("EP")&" AND EXAM_NO ="&examNo&" AND LOCATION ='"&location&"';"
- myConn.Execute(q)
- End Function
- Function insertNodules(examNo, noduleNO, location, TR, AP, CC, VOLUME2)
- q = "SELECT DISTINCT NODULE_NO from T_SURVEILLANCE_NODULES WHERE PAT_ID = '"&Request.QueryString("PatID")&"' AND EPISODE = "&Request.QueryString("EP")&_
- " AND EXAM_NO = "&examNo&" AND LOCATION ='"&location&"'"
- myRS.Open q, myConn
- isNew = 1
- If location = "Right Lymph Node" Then
- nodLocation = "RLN"
- ElseIf location = "Right Lobe" Then
- nodLocation = "R"
- ElseIf location = "Right Isthmus" Then
- nodLocation = "RI"
- ElseIf location = "Left Isthmus" Then
- nodLocation = "LI"
- ElseIf location = "Left Lobe" Then
- nodLocation = "L"
- ElseIf location = "Left Lymph Node" Then
- nodLocation = "LLN"
- End If
- nodCount = 1
- nodID = 0
- If not myRS.EOF Then
- do while not myRS.EOF
- If StrComp(nodLocation&nodCount, noduleNO) = 0 Then
- isNew = 0
- nodID = CINT(myRS("NODULE_NO"))
- exit do
- End If
- myRS.MoveNext
- nodCount = nodCount + 1
- Loop
- End If
- myRS.Close
- If nodID = 0 Then
- q = "SELECT MAX(NODULE_NO) from T_SURVEILLANCE_NODULES "&_
- "WHERE PAT_ID = '"&Request.QueryString("PatID")&"' AND EPISODE = "&Request.QueryString("EP") &" AND TRACKING_DATE ='"&sDate&"' AND "&_
- " PREV_EXAM_REF = '"&examNo&"';"
- myRS.Open q, myConn
- If not myRS.EOF and myRS("MAX") <>"NULL" Then
- nodID = CINT(myRS("MAX")) + 1
- Else
- nodID = 1
- End If
- myRS.Close
- End If
- if isNew = 1 Then
- q = "INSERT INTO T_SURVEILLANCE_NODULES (PAT_ID, EPISODE, EXAM_NO, NODULE_NO, TRACKING_DATE, CURRENTLY_TRACKING, LOCATION, TR,AP,CC,VOLUME1,VOLUME2, PREV_EXAM_REF ) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&examNo&", "&nodID&", '"&sDate&"', 'Y', '"&location&"',"&TR&","&AP&","&CC&","&FormatNumber(CDBL(TR*AP*CC*0.523),2)&","&VOLUME2&","&examNo&") "
- else
- q = "UPDATE T_SURVEILLANCE_NODULES SET TR="&TR&",AP="&AP&",CC="&CC&",VOLUME1 ="&FormatNumber(CDBL(TR*AP*CC*0.523),2)&",VOLUME2 ="&VOLUME2&_
- " WHERE PAT_ID ='"&Request.QueryString("PatID")&"' AND EPISODE = "&Request.QueryString("EP")&" AND EXAM_NO ="&examNo&" AND NODULE_NO ='"&nodID&"' AND TRACKING_DATE ='"&sDate&"' AND "&_
- " PREV_EXAM_REF = '"&examNo&"';"
- end If
- response.Write q&"<br/>"
- ' myConn.Execute(q)
- End Function
- Function ConvertTowd (n)
- If isNull(n) then n = "" end If
- If n = "" then
- ConvertTowd = ""
- elseif n = 0 then
- ConvertTowd = ""
- else
- NumWeeks = Fix(n)
- NumDays = Round((n-Fix(n))*7)
- If NumDays = 7 then
- NumWeeks = NumWeeks + 1
- NumDays = 0
- end if
- ConvertTowd = NumWeeks&"w"& NumDays&"d"
- end if
- end function
- Set myConn = Server.CreateObject("ADODB.Connection")
- set fso = Server.CreateObject("Scripting.FileSystemObject")
- If not fso.FileExists(Server.MapPath("wpbi.txt")) then
- sPassword = "masterkey"
- else
- set ts = fso.OpenTextFile(Server.MapPath("wpbi.txt"))
- If not ts.AtEndOfStream then
- sPassword = ts.ReadLine
- end if
- ts.close
- set ts = nothing
- end if
- set fso = nothing
- If sPassword = "" then
- sPassword = "masterkey"
- end if
- myConn.open "DSN=ultrasound_odbc;Username=SYSDBA;Password="&sPassword
- Set myRS = Server.CreateObject("ADODB.Recordset")
- Set myRS2 = Server.CreateObject("ADODB.Recordset")
- Set myRS3 = Server.CreateObject("ADODB.Recordset")
- ' Check for dup Accession Number
- q = "select ACCESSION_UNIQUE FROM OPTIONS where OPTION_INDEX = '1'"
- myRS.Open q, myConn
- If not myRS.eof then
- sAccessionUnique = myRS("ACCESSION_UNIQUE")
- end if
- myRS.Close
- If (Request.QueryString("AccessionNo") <> "") and (sAccessionUnique = "Y") then
- q = "select PAT_ID, EPISODE, EXAM_NO from LONG_SHORT_EXAM where ACCESSION_NO = '"&Request.QueryString("AccessionNo")&"'"
- myRS.Open q,myConn
- AccessionExists = not myRS.eof
- If not myRS.eof then
- sPatID = myRS("PAT_ID")
- sEpisode = myRS("EPISODE")
- sExamNo = myRS("EXAM_NO")
- end if
- myRS.Close
- If AccessionExists then
- ' Go to Warning Page
- set myRS = nothing
- set myRS2 = nothing
- set myRS3 = nothing
- myConn.Close
- set myConn = nothing
- Response.Redirect "AccessionDuplicate.asp?AccessionNo="&Request.QueryString("AccessionNo")&"&PatID="&sPatID&"&EP="&sEpisode&"&ExamNo="&sExamNo
- end if
- end if
- q = "select ACCESSION, STUDY_UID, MULTIPLE_LOCATIONS, WORKLIST_ENABLED, FTPPATH, DATALINKBYDATABASE FROM OPTIONS where OPTION_INDEX = '1'"
- myRS.Open q, MyConn
- If not myRS.eof then
- sMultipleLocations = myRS("MULTIPLE_LOCATIONS")
- sAccession = myRS("ACCESSION")
- sStudyUIDEnabled = myRS("STUDY_UID")
- sWorklistEnabled = myRS("WORKLIST_ENABLED")
- sFTPPath = myRS("FTPPATH")
- sDatalinkByDatabase = myRS("DATALINKBYDATABASE")
- end if
- myRS.Close
- sDatalinkData = ""
- If sDatalinkByDatabase = "Y" then
- Set myConn2 = Server.CreateObject("ADODB.Connection")
- set fso = Server.CreateObject("Scripting.FileSystemObject")
- If not fso.FileExists(Server.MapPath("wpbi.txt")) then
- sPassword = "masterkey"
- Else
- set ts = fso.OpenTextFile(Server.MapPath("wpbi.txt"))
- If not ts.AtEndOfStream then
- sPassword = ts.ReadLine
- End if
- ts.close
- set ts = nothing
- End if
- set fso = nothing
- If sPassword = "" then
- sPassword = "masterkey"
- end if
- myConn2.Open "DSN=Clickview_DatalinkServer;Username=SYSDBA;Password="&sPassword
- q = "select DATALINK_DATA from DATALINK where PAT_ID = '"&Request.QueryString("PatID")&"' "
- myRS.Open q, MyConn2
- If not myRS.eof then
- sDatalinkData = myRS("DATALINK_DATA")
- If isNull(sDatalinkData) then
- sDatalinkData = ""
- end if
- end if
- If InStr(sDatalinkData, chr(13)&chr(10)) = 0 then
- sUpperLimit = 0
- else
- arDatalinkData = Split(sDatalinkData, chr(13)&chr(10))
- sUpperLimit = UBound(arDatalinkData)
- End If
- myRS.Close
- myConn2.Close
- set myConn2 = nothing
- End if
- If not HasRights("Add/Edit Exams") then
- set myRS = nothing
- myConn.Close
- set myConn = nothing
- Response.Redirect "accessdeniedsignout.asp"
- end if
- q = "Select Max(EXAM_NO) as MAX_EXAM_NO from LONG_SHORT_EXAM "&_
- "where PAT_ID = '"&Request.QueryString("PatID")&"'"&_
- "and EPISODE = "&Request.QueryString("EP")
- myRS.Open q, MyConn
- If isNull(myRS("MAX_EXAM_NO")) then
- NewExamNo = 1
- else
- NewExamNo = myRS("MAX_EXAM_NO") + 1
- end if
- myRS.Close
- q = "Select REFBY, PATIENT_DOB from DEMOGRAPHICS "&_
- "where PAT_ID = '"&Request.QueryString("PatID")&"'"
- myRS.Open q, MyConn
- sPatDOB = myRS("PATIENT_DOB")
- sRefBy = myRS("REFBY")
- myRS.Close
- If sRefBy = "**iSite**" then
- sReferringPhysician = Request.QueryString("RefName")
- else
- q = "select LAST_NAME, FIRST_NAME, MI, TITLE, SITE from REFER where REFKEY = '"&sRefBy&"'"
- myRS.Open q, MyConn
- If not myRS.eof then
- If myRS("LAST_NAME") <> "" or myRS("FIRST_NAME") <> "" then
- sReferringPhysician = myRS("LAST_NAME") & ", " & myRS("FIRST_NAME")
- If myRS("MI") <> "" then
- sReferringPhysician = sReferringPhysician & " " & myRS("MI") & "."
- end if
- If myRS("TITLE") <> "" then
- sReferringPhysician = sReferringPhysician & " "& myRS("TITLE")
- end if
- else
- sReferringPhysician = myRS("SITE")
- end if
- else
- sReferringPhysician = ""
- end if
- myRS.Close
- end if
- If sReferringPhysician <> "" then
- sReferringPhysician = Replace(sReferringPhysician, "'", "''")
- end if
- If Request.QueryString("ExamDate") <> "" then
- sDate = Request.QueryString("ExamDate")
- else
- sDate = Date
- end if
- q = "Insert into long_short_exam (PAT_ID, EPISODE, EXAM_NO, VISIT_DATETIME, PLURALITY, FORMAT, REFER_PHYS"
- If Request.QueryString("Procedure") <> "" then
- q = q & ", REASON"
- end if
- If sPatDOB <> "" then
- q = q & ", MATERNAL_AGE"
- sPatAge = Fix(DateDiff("D", sPatDOB, Date)/365.25)
- end if
- If (Session("Usersite") <> "") and (Request.QueryString("ExamSite") = "") then
- q = q & ",EXAM_SITE"
- end if
- If Request.QueryString("Examsite") <> "" then
- q = q & ",EXAM_SITE"
- end if
- If (sAccession = "Y") and (Request.QueryString("AccessionNo") <> "") then
- q = q & ", ACCESSION_NO"
- end if
- If (sStudyUIDEnabled = "Y") and (Request.QueryString("StudyUID") <> "") then
- q = q & ", STUDY_UID"
- end if
- If (Request.QueryString("Sonographer") <> "") then
- q = q & ", VALIDATED_PASSWORD"
- end if
- If Request.QueryString("ProcedureDesc") <> "" then
- q = q & ", REASON"
- end if
- If Request.QueryString("ProcedureCode") <> "" then
- q = q & ", PROCEDURE_CODE"
- end if
- If Request.QueryString("ExamDateTime") <> "" then
- q = q & ", EXAM_DATE_TIME"
- end if
- If Request.QueryString("ReferringPhysicianCode") <> "" then
- q = q & ", REFER_PHYS_CODE"
- end if
- q = q & ", WHO_CHANGED, WHEN_CHANGED"
- q = q & ") values ('"&Request.QueryString("PatID")& "', "&Request.QueryString("EP")&", "&NewExamNo&", '"&sDate&"', null, 'X', "&_
- " '"&sReferringPhysician&"'"
- If Request.QueryString("Procedure") <> "" then
- q = q & ", '"&Request.QueryString("Procedure")&"'"
- end if
- If sPatDOB <> "" then
- q = q & ", '"&sPatAge&"'"
- end if
- If (Session("Usersite") <> "") and (Request.QueryString("ExamSite") = "") then
- q = q & ",'"&Replace(Session("Usersite"), "'", "''")&"'"
- end if
- If (Request.QueryString("ExamSite") <> "") then
- q = q & ", '"&Replace(Request.QueryString("ExamSite"), "'", "''")&"'"
- end if
- If (sAccession = "Y") and (Request.QueryString("AccessionNo") <> "") then
- q = q & ", '"&Request.QueryString("AccessionNo")&"'"
- end if
- If (sStudyUIDEnabled = "Y") and (Request.QueryString("StudyUID") <> "") then
- q = q & ", '"&Request.QueryString("StudyUID")&"'"
- end if
- If (Request.QueryString("Sonographer") <> "") then
- q = q & ", '"&Replace(Request.QueryString("Sonographer"), "'", "''")&"'"
- end if
- If Request.QueryString("ProcedureDesc") <> "" then
- q = q & ", '"&Request.QueryString("ProcedureDesc")&"'"
- end if
- If Request.QueryString("ProcedureCode") <> "" then
- q = q & ", '"&Request.QueryString("ProcedureCode")&"'"
- end if
- If Request.QueryString("ExamDateTime") <> "" then
- q = q & ", '"&Request.QueryString("ExamDateTime")&"'"
- end if
- If Request.QueryString("ReferringPhysicianCode") <> "" then
- q = q & ", '"&Replace(Request.QueryString("ReferringPhysicianCode"), "'", "''")&"'"
- end if
- q = q & ", '"&Session("Username")&"', '"&date&" "&Hour(time)&":"&Minute(time)&":"&Second(time)&"' "
- q = q & ")"
- myConn.Execute(q)
- sAssignedTo = Replace("["&Session("Username")&"]", "'", "''")
- q = "update long_short_exam set SURVEILLANCE_NEW_EXAM ='Y', ASSIGNED_TO = '"&sAssignedTo&"', "&_
- "EXAM_STARTED = '"&date&" "&Hour(time)&":"&Minute(time)&":"&Second(time)&"' "&_
- "where PAT_ID = '"&Request.QueryString("PatID")&"' "&_
- "and EPISODE = "& Request.QueryString("EP") & " "&_
- "and EXAM_NO = "&newExamNo
- myConn.Execute(q)
- q = "Insert into CT_EXAM (PAT_ID, EPISODE, EXAM_NO, DISCIPLINE, EXAM_TYPE, HISTORY) "&_
- "values ('"&Request.QueryString("PatID")& "', "&Request.QueryString("EP")&", "&NewExamNo&", "&_
- "'"&Replace(Request.QueryString("Disc"), "'", "''")&"', '"&Replace(Request.QueryString("ExamType"), "'", "''")&"', "&_
- "'"&Replace(Request.QueryString("ReasonForStudy"), "'", "''")&"')"
- myConn.Execute(q)
- ' Set to Normal Template
- sDiscipline = Request.QueryString("Disc")
- sExamType = Request.QueryString("ExamType")
- ' Insert into Exam Type
- ' insert into CT_EXAM
- sExamTypeComments = ""
- q = "select COMMENT from X_EXAM_TYPE_COMMENT "&_
- "where DISCIPLINE_NAME = '"&Replace(sDiscipline, "'", "''") &"' and EXAM_TYPE = '"&Replace(sExamType, "'", "''")&"' "&_
- "and COMMENT_TYPE = 'Normal' "&_
- "order by SEQ_NO"
- myRS2.Open q, myConn
- do while not myRS2.eof
- sExamTypeComments = sExamTypeComments & myRS2("COMMENT") & "<br>"
- myRS2.MoveNext
- loop
- myRS2.Close
- ' Add Normal Impressions If available
- sImpressionsComments = ""
- q = "select IMPRESSION from X_EXAM_TYPE_IMPRESSION "&_
- "where DISCIPLINE_NAME = '"&Replace(sDiscipline, "'", "''") &"' and EXAM_TYPE = '"&Replace(sExamType, "'", "''")&"' "&_
- "and IMPRESSION_TYPE = 'Normal' "&_
- "order by SEQ_NO"
- myRS2.Open q, myConn
- do while not myRS2.eof
- sImpressionsComments = sImpressionsComments & myRS2("IMPRESSION") & " "
- myRS2.MoveNext
- loop
- myRS2.Close
- If sImpressionsComments <> "" then
- sImpressionsComments = "<ul><li>"&sImpressionsComments&"</ul>"
- end if
- Set rsFetusData = Server.CreateObject("ADODB.Recordset")
- q = "select * from CT_EXAM where "&_
- "PAT_ID='"&Request.Querystring("PatID")&"' and EPISODE = "&Request.Querystring("EP")&" and "&_
- "EXAM_NO = "&NewExamNo &" "
- rsFetusData.Source = q
- rsFetusData.ActiveConnection = myConn
- rsFetusData.CursorType = adOpenKeySet
- rsFetusData.LockType = 2
- rsFetusData.open
- If sExamTypeComments <> "" then
- rsFetusData.Fields("COMMENT_TYPE") = "Normal"
- rsFetusData.Fields("COMMENT") = sExamTypeComments
- end if
- rsFetusData.Fields("IMPRESSIONS_TYPE") = "Normal"
- rsFetusData.Fields("IMPRESSIONS") = sImpressionsComments
- rsFetusData.Update
- rsFetusData.Close
- set rsFetusData = nothing
- ' Insert into Section
- ' If no Details Available then don't add Section Normals
- ' but add If Exam Type Comments are blank.
- q = "select EXAM_SECTION_DETAIL from X_EXAM_SECTION_DETAIL "&_
- "where DISCIPLINE_NAME = '"&sDiscipline&"' and EXAM_TYPE = '"&sExamType&"' "
- myRS.Open q, myConn
- sDetailsAvailable = not myRS.eof
- myRS.Close
- q = "select EXAM_TYPE from X_EXAM_TYPE_COMMENT "&_
- "where DISCIPLINE_NAME = '"&sDiscipline&"' and EXAM_TYPE = '"&sExamType&"' "
- myRS.Open q, myConn
- sExamTypeCommentsAvailable = not myRS.eof
- myRS.Close
- If not (not sDetailsAvailable and sExamTypeCommentsAvailable) then
- sSectionRadioNo = 1
- sDetailRadioNo = 1
- q = "select EXAM_SECTION, SEQ_NO from X_EXAM_SECTION "&_
- "where DISCIPLINE_NAME = '"&Replace(sDiscipline, "'", "''") &"' and EXAM_TYPE = '"&Replace(sExamType, "'", "''")&"' "&_
- "order by SEQ_NO"
- myRS.Open q, myConn
- do while not myRS.eof
- q = "insert into CT_EXAM_SECTION (PAT_ID, EPISODE, EXAM_NO, SECTION_SEQ, SECTION, COMMENT_TYPE) values ("&_
- "'"&Request.Querystring("PatID")&"', "&Request.Querystring("EP")&", "&NewExamNo&", "&_
- ""&myRS("SEQ_NO")&", "&_
- "'"&Replace(myRS("EXAM_SECTION"), "'", "''") &_
- "', 'Normal')"
- myConn.execute(q)
- ' insert into CT_EXAM_SECTION_COMMENTS
- sSectionComments = ""
- q = "select COMMENT from X_EXAM_SECTION_COMMENT "&_
- "where DISCIPLINE_NAME = '"&Replace(sDiscipline, "'", "''") &"' and EXAM_TYPE = '"&Replace(sExamType, "'", "''")&"' "&_
- "and EXAM_SECTION = '"&Replace(myRS("EXAM_SECTION"), "'", "''")&"' "&_
- "and COMMENT_TYPE = 'Normal' "&_
- "order by SEQ_NO"
- myRS2.Open q, myConn
- do while not myRS2.eof
- sSectionComments = sSectionComments & myRS2("COMMENT") & "<br>"
- myRS2.MoveNext
- loop
- myRS2.Close
- If sSectionComments <> "" then
- ' Check for Datalink Information
- sSectionComments = Replace(sSectionComments, "ยซ", "«")
- sSectionComments = Replace(sSectionComments, "ยป", "»")
- ' Get Datalink Data Here
- sWhichLabel = ""
- If sDatalinkData <> "" then
- do while (InStr(sSectionComments, "«") <> 0) and (InStr(sSectionComments, "»") <> 0)
- sThisMeas = ""
- sWhichLabel = sSectionComments
- sWhichLabel = Mid(sWhichLabel, InStr(sWhichLabel, "«") + len("«"), len(sWhichLabel))
- sWhichLabel = Mid(sWhichLabel, 1, InStr(sWhichLabel, "»")-1)
- If InStr(sDatalinkData, sWhichLabel & ": ") <> 0 then
- sThisMeas = sDatalinkData
- sThisMeas = Mid(sThisMeas, InStr(sThisMeas, sWhichLabel & ": ") + len(sWhichLabel & ": "), len(sThisMeas))
- If InStr(sThisMeas, chr(13)&chr(10)) <> 0 then
- sThisMeas = Mid(sThisMeas, 1, InStr(sThisMeas, chr(13)&chr(10))-1)
- end if
- end if
- If sThisMeas <> "" then
- sSectionComments = Replace(sSectionComments, "«"&sWhichLabel&"»", sThisMeas)
- else
- sSectionComments = Replace(sSectionComments, "«"&sWhichLabel&"»", "")
- end if
- loop
- 'sSectionComments = sSectionComments & "<br>" & sWhichLabel & ": " & sThisMeas & "<br>"
- End if
- ' Get rid of unused measurements
- i = 0
- do while (InStr(sSectionComments, "«") <> 0 and InStr(sSectionComments, "»") and InStr(sSectionComments, "«") < InStr(sSectionComments, "»")) and (i < 5000)
- i = i + 1
- sSectionComments = mid(sSectionComments, 1, InStr(sSectionComments, "«")-1) & mid(sSectionComments, InStr(sSectionComments, "»") + 7)
- loop
- Set rsFetusData = Server.CreateObject("ADODB.Recordset")
- q = "select PAT_ID, EPISODE, EXAM_NO, SECTION_SEQ, SECTION, COMMENT_TYPE, COMMENT from CT_EXAM_SECTION where "&_
- "PAT_ID='"&Request.Querystring("PatID")&"' and EPISODE = "&Request.Querystring("EP")&" and "&_
- "EXAM_NO = "&NewExamNo &" and "&_
- "SECTION = '"&Replace(myRS("EXAM_SECTION"), "'", "''")&"' "
- rsFetusData.Source = q
- rsFetusData.ActiveConnection = myConn
- rsFetusData.CursorType = adOpenKeySet
- rsFetusData.LockType = 2
- rsFetusData.open
- rsFetusData.Fields("COMMENT") = sSectionComments
- rsFetusData.Update
- rsFetusData.Close
- set rsFetusData = nothing
- end if
- ' insert into the Details
- 'q = "select EXAM_SECTION_DETAIL, SEQ_NO from X_EXAM_SECTION_DETAIL "&_
- ' "where DISCIPLINE_NAME = '"&sDiscipline&"' and EXAM_TYPE = '"&sExamType&"' "&_
- ' "and EXAM_SECTION = '"&Replace(myRS("EXAM_SECTION"), "'", "''")&"' "&_
- ' "order by SEQ_NO"
- 'myRS2.Open q, myConn
- 'do while not myRS2.eof
- '
- '
- 'q = "insert into CT_EXAM_DETAIL (PAT_ID, EPISODE, EXAM_NO, SECTION_SEQ, DETAIL_SEQ, SECTION, DETAIL, COMMENT_TYPE) values ("&_
- ' "'"&Request.Querystring("PatID")&"', "&Request.Querystring("EP")&", "&NewExamNo&", "&_
- ' ""&myRS("SEQ_NO")&", "&myRS2("SEQ_NO")&", "&_
- ' "'"&Replace(myRS("EXAM_SECTION"), "'", "''") & "', '" & Replace(myRS2("EXAM_SECTION_DETAIL"), "'", "''") & "', 'Normal')"
- 'myConn.execute(q)
- '
- 'sDetailComments = ""
- '
- 'q = "select COMMENT from X_EXAM_SECTION_DETAIL_COMMENT "&_
- ' "where DISCIPLINE_NAME = '"&Replace(sDiscipline, "'", "''") &"' and EXAM_TYPE = '"&Replace(sExamType, "'", "''")&"' "&_
- ' "and EXAM_SECTION = '"&Replace(myRS("EXAM_SECTION"), "'", "''")&"' "&_
- ' "and EXAM_SECTION_DETAIL = '"&Replace(myRS2("EXAM_SECTION_DETAIL"), "'", "''")&"' "&_
- ' "and COMMENT_TYPE = 'Normal' "&_
- ' "order by SEQ_NO"
- 'myRS3.Open q, myConn
- 'do while not myRS3.eof
- '
- '
- 'sDetailComments = sDetailComments & myRS3("COMMENT") & " "
- '
- 'myRS3.MoveNext
- 'loop
- 'myRS3.Close
- '
- '
- 'If sDetailComments <> "" then
- ' Set rsFetusData = Server.CreateObject("ADODB.Recordset")
- '
- 'q = "select PAT_ID, EPISODE, EXAM_NO, SECTION_SEQ, DETAIL_SEQ, SECTION, DETAIL, COMMENT_TYPE, COMMENT from CT_EXAM_DETAIL where "&_
- ' "PAT_ID='"&Request.Querystring("PatID")&"' and EPISODE = "&Request.Querystring("EP")&" and "&_
- ' "EXAM_NO = "&NewExamNo &" and "&_
- ' "SECTION = '"&Replace(myRS("EXAM_SECTION"), "'", "''")&"' and "&_
- ' "DETAIL = '"&Replace(myRS2("EXAM_SECTION_DETAIL"), "'", "''")&"' "
- '
- ' rsFetusData.Source = q
- ' rsFetusData.ActiveConnection = myConn
- ' rsFetusData.CursorType = adOpenKeySet
- ' rsFetusData.LockType = 2
- ' rsFetusData.open
- ' rsFetusData.Fields("COMMENT") = sDetailComments
- ' rsFetusData.Update
- ' rsFetusData.Close
- ' set rsFetusData = nothing
- '
- 'end if
- 'sDetailRadioNo = sDetailRadioNo + 1
- 'myRS2.MoveNext
- 'loop
- 'myRS2.Close
- sSectionRadioNo = sSectionRadioNo + 1
- myRS.MoveNext
- loop
- myRS.Close
- end If ' If Details Available
- q = "select VISIT_DATETIME, EXAM_NO from long_short_exam "&_
- "where PAT_ID = '"&Request.QueryString("PatID")&"' "&_
- "and EPISODE = "& Request.QueryString("EP") & " "&_
- "and EXAM_NO <> "&newExamNo &_
- " order by VISIT_DATETIME desc"
- myRS.Open q, MyConn
- If not myRS.eof then
- ' If there were Previous Exams, check to see If they had ICD-9 Codes.
- vLastExam = myRS("EXAM_NO")
- myRS.Close
- q = "select * from CODEDATA "&_
- "where PAT_ID = '"&Request.QueryString("PatID")&"' "&_
- "and EPISODE = "& Request.QueryString("EP") & " "&_
- "and EXAM_NO = "& vLastExam & " "&_
- "and CODE_TYPE like 'ICD-9%' "
- myRS.Open q, MyConn
- do while not myRS.eof
- ' If there ICD-9 Codes, lets copy them to this exam.
- q = "insert into CODEDATA "&_
- "(PAT_ID, EPISODE, EXAM_NO, FET_ID, CODE_TYPE, CODE_NO, CODE_TEXT) " &_
- "values ('"&myRS("PAT_ID")&"', "&myRS("EPISODE")&", "&NewExamNo&", '"&_
- myRS("FET_ID")&"', '"&Replace(myRS("CODE_TYPE"), "'", "''")&"', '"&Replace(myRS("CODE_NO"), "'", "''")&"', '"&Replace(myRS("CODE_TEXT"), "'", "''")&"')"
- myConn.execute(q)
- myRS.MoveNext
- loop
- end if
- myRS.Close
- ' If Discipline = Surveillance update tracking type in exam
- If Request.QueryString("Disc") = "Surveillance" then
- If (Request.QueryString("Disc") = "Surveillance") and (Request.QueryString("ExamType") = "Thyroid Surveillance") then
- sLastExamNo = -1
- ' Set TrackingType to allow multidimensional tracking
- q = "SELECT SUB_CATEGORY FROM CV_LOOKUP WHERE PROPERTY = 'SURV_LOOKUP' AND CATEGORY = 'TS_DIMENSIONS'"
- myRS.Open q, myConn
- If not myRS.EOF Then
- q = "UPDATE CT_EXAM SET TRACKING_TYPE = '"&myRS("SUB_CATEGORY")&"' WHERE PAT_ID='"&Request.QueryString("PatID")& "' and EPISODE = "&Request.QueryString("EP")&" AND EXAM_NO ="&NewExamNo
- myConn.Execute(q)
- End If
- myRS.Close
- ' Copy Nodules over from last exam
- q = "SELECT N.EXAM_NO,N.TRACKING_DATE, PREV_EXAM_REF FROM LONG_SHORT_EXAM L, T_SURVEILLANCE_NODULES N where N.PAT_ID = '"&Request.QueryString("PatID")&"' "&_
- "AND N.EPISODE = "&Request.QueryString("EP")&" and L.PAT_ID = N.PAT_ID and L.EPISODE = N.EPISODE and L.EXAM_NO = N.EXAM_NO "&_
- "ORDER by EXAM_NO desc,PREV_EXAM_REF desc, TRACKING_DATE desc"
- myRS.Open q, myConn
- If not myRS.eof then
- sLastExamNo = myRS("EXAM_NO")
- sLastTrackingDate = myRS("TRACKING_DATE")
- sPrevExamRef = myRS("PREV_EXAM_REF")
- End If
- myRS.Close
- sLocation = ""
- sMargins = ""
- sInternal = ""
- sDiameter = "NULL"
- sTR = ""
- sAP = ""
- sCC = ""
- sVolume1 = ""
- sVolume2 = ""
- If sLastExamNo > 0 Then
- ' Copy old image and carry it over/Create a new copy for new Exam
- q = "SELECT IMAGE_RIGHT FROM LONG_SHORT_EXAM WHERE PAT_ID = '"&Request.QueryString("PatID")&"' AND EPISODE = "& Request.QueryString("EP") &" AND EXAM_NO = "&sLastExamNo
- myRS.Open q, myConn
- If not myRS.EOF then
- oldImageLocation = myRS("IMAGE_RIGHT")
- Else
- oldImageLocation = ""
- End If
- myRs.Close
- If oldImageLocation <> "" Then
- q = "SELECT GEN_ID(GUIMAGEID,1) as GUIMAGEID FROM rdb$database"
- myRS.Open q, myConn
- newImageID = myRs("GUIMAGEID")
- myRs.Close
- q = "select VASCULAR_IMAGE_PATH FROM OPTIONS where OPTION_INDEX = '1'"
- myRS.Open q, myConn
- sImagePath = myRs("VASCULAR_IMAGE_PATH")
- myRs.Close
- set fso = Server.CreateObject("Scripting.FileSystemObject")
- iPath = Year(Date)&"\"&MonthName(Month(Date),True)&"\"
- If NOT (FSO.FolderExists(sImagePath&Year(Date))) Then
- fso.CreateFolder(sImagePath&Year(Date))
- end if
- If NOT (FSO.FolderExists(sImagePath&Year(Date)&"\"&MonthName(Month(Date),True))) Then
- fso.CreateFolder(sImagePath&Year(Date)&"\"&MonthName(Month(Date),True))
- end if
- ImageFileName = sImagePath&iPath&sExamType&"_"&newImageID&".png"
- FileName = iPath&sExamType&"_"&newImageID&".png"
- Set MyFile = fso.GetFile(sImagePath&"\"&oldImageLocation)
- MyFile.Copy (ImageFileName)
- set fso = nothing
- q = "UPDATE LONG_SHORT_EXAM SET IMAGE_RIGHT='"&FileName&"' WHERE PAT_ID = '"&Request.QueryString("PatID")&"' AND EPISODE = "& Request.QueryString("EP") &" AND EXAM_NO = "&NewExamNo
- myConn.Execute(q)
- End If
- ' Copy Nodules over from last exam
- q = "SELECT DISTINCT NODULE_NO from T_SURVEILLANCE_NODULES "&_
- "WHERE PAT_ID = '"&Request.QueryString("PatID")&"' AND EPISODE = "&Request.QueryString("EP")&_
- " AND EXAM_NO = "&sLastExamNo&" and CURRENTLY_TRACKING='Y' AND TRACKING_DATE ='"&sLastTrackingDate&"'"
- myRS.Open q, myConn
- do while (not myRS.eof)
- q = "SELECT NODULE_NO,TRACKING_DATE, LOCATION, MARGINS, INTERNAL, DIAMETER, TR, AP, CC, VOLUME1, VOLUME2,PREV_EXAM_REF,CURRENTLY_TRACKING from T_SURVEILLANCE_NODULES "&_
- "WHERE NODULE_NO ="&myRS("NODULE_NO")&" AND PAT_ID = '"&Request.QueryString("PatID")&"' and EPISODE = "&Request.QueryString("EP")&" and EXAM_NO = "&sLastExamNo &_
- " ORDER BY PREV_EXAM_REF ASC "
- myRS2.Open q, myConn
- do while not myRS2.EOF
- sLocation = myRS2("LOCATION")
- If isNull(sLocation) then
- sLocation = ""
- End If
- sMargins = myRS2("MARGINS")
- If isNull(sMargins) then
- sMargins = ""
- End If
- sInternal = myRS2("INTERNAL")
- If isNull(sInternal) then
- sInternal = ""
- End If
- sDiameter = myRS2("DIAMETER")
- If isNull(sDiameter) then
- sDiameter = "NULL"
- End If
- sTR = myRS2("TR")
- If isNull(sTR) then
- sTR = "NULL"
- End If
- sAP = myRS2("AP")
- If isNull(sAP) then
- sAP = "NULL"
- End If
- sCC = myRS2("CC")
- If isNull(sCC) then
- sCC = "NULL"
- End If
- sVolume1 = myRS2("VOLUME1")
- If isNull(sVolume1) then
- sVolume1 = "NULL"
- End If
- sVolume2 = myRS2("VOLUME2")
- If isNull(sVolume2) then
- sVolume2 = "NULL"
- End If
- sPERef = myRS2("PREV_EXAM_REF")
- If isNull(sPERef) then
- sPERef = "NULL"
- End If
- sCurrentlyTracking = myRS2("CURRENTLY_TRACKING")
- If isNull(sCurrentlyTracking) then
- sCurrentlyTracking = ""
- End If
- q = "INSERT INTO T_SURVEILLANCE_NODULES (PAT_ID, EPISODE, EXAM_NO, NODULE_NO, TRACKING_DATE, CURRENTLY_TRACKING, LOCATION, MARGINS, INTERNAL, DIAMETER, TR, AP, CC, VOLUME1, VOLUME2, PREV_EXAM_REF ) values ("&_
- "'"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", "&myRS2("NODULE_NO")&", '"&myRS2("TRACKING_DATE")&"', '"&sCurrentlyTracking&"', "&_
- "'"&Replace(sLocation, "'", "''")&"', '"&Replace(sMargins, "'", "''")&"', '"&Replace(sInternal, "'", "''")&"',"&sDiameter&","&sTR&","&sAP&","&sCC&","&sVolume1&","&sVolume2&","&sPERef&") "
- myConn.Execute(q)
- myRS2.MoveNext
- loop
- myRS2.Close
- If sCurrentlyTracking = "Y" Then
- If isNull(sDiameter) then
- sDiameter = "NULL"
- End If
- q = "INSERT INTO T_SURVEILLANCE_NODULES (PAT_ID, EPISODE, EXAM_NO, NODULE_NO, TRACKING_DATE, CURRENTLY_TRACKING, LOCATION, MARGINS, INTERNAL, DIAMETER, PREV_EXAM_REF ) values ("&_
- "'"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", "&myRS("NODULE_NO")&", '"&sDate&"', '"&sCurrentlyTracking&"', "&_
- "'"&Replace(sLocation, "'", "''")&"', '"&Replace(sMargins, "'", "''")&"', '"&Replace(sInternal, "'", "''")&"',"&sDiameter&","&(NewExamNo)&") "
- myConn.Execute(q)
- End If
- myRS.MoveNext
- loop
- myRS.Close
- End If
- ' Copy Events over from last exam
- q = "SELECT DISTINCT (L.VISIT_DATETIME), E.EXAM_NO FROM LONG_SHORT_EXAM L, T_SURVEILLANCE_EVENTS E where E.PAT_ID = '"&Request.QueryString("PatID")&"' "&_
- "AND E.EPISODE = "&Request.QueryString("EP")&" and L.PAT_ID = E.PAT_ID and L.EPISODE = E.EPISODE and L.EXAM_NO = E.EXAM_NO "&_
- "ORDER by VISIT_DATETIME desc"
- myRS.Open q, myConn
- If not myRS.eof then
- sLastExamNoE = myRS("EXAM_NO")
- Else
- sLastExamNoE = -1
- End If
- myRS.Close
- If sLastExamNo > 0 then
- q = "SELECT EVENT_NO,EVENT_TYPE,EVENT_BEGIN_DATE,EVENT_END_DATE FROM T_SURVEILLANCE_EVENTS WHERE PAT_ID = '"&Request.QueryString("PatID")&"' and EPISODE = "&Request.QueryString("EP")&" and EXAM_NO = "&sLastExamNo
- myRS.Open q, myConn
- do while not myRS.eof
- If isNull(myRS("EVENT_BEGIN_DATE")) then
- sEventBeginDate = "null"
- Else
- sEventBeginDate = "'"&myRS("EVENT_BEGIN_DATE")&"'"
- End If
- If isNull(myRS("EVENT_END_DATE")) then
- sEventEndDate = "null"
- Else
- sEventEndDate = "'"&myRS("EVENT_END_DATE")&"'"
- End If
- q = "INSERT INTO T_SURVEILLANCE_EVENTS (PAT_ID, EPISODE, EXAM_NO, EVENT_NO, EVENT_TYPE, EVENT_BEGIN_DATE, EVENT_END_DATE) values ("&_
- "'"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", "&_
- myRS("EVENT_NO")&", "&"'"&Replace(myRS("EVENT_TYPE"), "'", "''")&"', "&sEventBeginDate & ", "&sEventEndDate & ")"
- myConn.Execute(q)
- myRS.MoveNext
- loop
- myRS.Close
- End If
- 'Create Entries into T_ORGAN_MEASUREMNTS
- If Request.QueryString("ExamType") = "Thyroid Surveillance" Then
- q = "INSERT INTO T_ORGAN_MEASUREMENTS( PAT_ID, EPISODE, EXAM_NO, LOCATION) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", 'Left Lobe'"&");"
- myRS.Open q, myConn
- q = "INSERT INTO T_ORGAN_MEASUREMENTS( PAT_ID, EPISODE, EXAM_NO, LOCATION) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", 'Right Lobe'"&");"
- myRS.Open q, myConn
- q = "INSERT INTO T_ORGAN_MEASUREMENTS( PAT_ID, EPISODE, EXAM_NO, LOCATION) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", 'Pyramidal Lobe'"&");"
- myRS.Open q, myConn
- q = "INSERT INTO T_ORGAN_MEASUREMENTS( PAT_ID, EPISODE, EXAM_NO, LOCATION) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", 'Isthmus'"&");"
- myRS.Open q, myConn
- q = "INSERT INTO T_ORGAN_MEASUREMENTS( PAT_ID, EPISODE, EXAM_NO, LOCATION) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", 'Right Lymph Node'"&");"
- myRS.Open q, myConn
- q = "INSERT INTO T_ORGAN_MEASUREMENTS( PAT_ID, EPISODE, EXAM_NO, LOCATION) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", 'Left Lymph Node'"&");"
- myRS.Open q, myConn
- Elseif sDiscipline = "Aortic Aneurysm Surveillance" Then
- q = "INSERT INTO T_ORGAN_MEASUREMENTS( PAT_ID, EPISODE, EXAM_NO, LOCATION) values ('"&Request.QueryString("PatID")&"', "&Request.QueryString("EP")&", "&NewExamNo&", 'Aorta Measurement'"&");"
- myRS.Open q, myConn
- End If
- 'Insert data from DataLink into rows
- iAP = "null"
- RTW = "null"
- RTH = "null"
- RTL = "null"
- RTV = "null"
- LTW = "null"
- LTH = "null"
- LTL = "null"
- LTV = "null"
- ReDim RLN(4,0)
- Dim oldRLN(50)
- oldRLNCounter = -1
- RLNx = 0
- ReDim R(4,0)
- Dim oldR(50)
- oldRCounter = -1
- Rx = 0
- ReDim RI(4,0)
- Dim oldRI(50)
- oldRICounter = -1
- RIx = 0
- ReDim LLN(4,0)
- Dim oldLLN(50)
- oldLLNCounter = -1
- LLNx = 0
- ReDim L(4,0)
- Dim oldL(50)
- oldLCounter = -1
- Lx = 0
- ReDim LI(4,0)
- Dim oldLI(50)
- oldLICounter = -1
- LIx = 0
- For j = 0 to sUpperLimit
- If sUpperLimit > 0 then
- s = arDatalinkData(j)
- End If
- If Request.QueryString("ExamType") = "Thyroid Surveillance" Then
- ' Organ Measurements
- If mid(s,1,len("Isthmus AP")) = "Isthmus AP" then
- iAP = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Right Thyroid Width")) = "Right Thyroid Width" then
- RTW = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Right Thyroid Height")) = "Right Thyroid Height" then
- RTH = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Right Thyroid Length")) = "Right Thyroid Length" then
- RTL = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Right Thyroid Volume")) = "Right Thyroid Volume" then
- RTV = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Left Thyroid Width")) = "Left Thyroid Width" then
- LTW = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Left Thyroid Height")) = "Left Thyroid Height" then
- LTH = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Left Thyroid Length")) = "Left Thyroid Length" then
- LTL = CDBL(recordValue(s))
- End If
- If mid(s,1,len("Left Thyroid Volume")) = "Left Thyroid Volume" then
- LTV = CDBL(recordValue(s))
- End If
- ' Right Lymph Node Nodules
- oldCounterhit = -1
- If mid(s,1,len("Right Lymph Node Nodule")) = "Right Lymph Node Nodule" then
- For xx = 0 to ubound(oldRLN)
- if oldRLN(xx) <> "" Then
- If oldRLN(xx) = Split(s," ")(4) Then
- oldRLNCounter = xx
- oldCounterhit = 0
- exit for
- End If
- End If
- Next
- if oldRLNCounter = -1 Then
- oldRLNCounter = 0
- End If
- If oldCounterHit = -1 Then
- RLNx = oldRLNCounter+1
- ReDim Preserve RLN(4,RLNx)
- oldRLN(oldRLNCounter+1) = Split(s," ")(4)
- Else
- RLNx = oldRLNCounter
- End If
- If(INSTR(s,"Width")) Then
- RLN(0,CINT(oldRLN(RLNx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Height")) Then
- RLN(1,CINT(oldRLN(RLNx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Length")) Then
- RLN(2,CINT(oldRLN(RLNx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Volume")) Then
- RLN(3,CINT(oldRLN(RLNx))) = CDBL(recordValue(s))
- End If
- End If
- ' Right Lobe Nodules
- If mid(s,1,len("Right Thyroid Nodule")) = "Right Thyroid Nodule" then
- For xx = 0 to ubound(oldR)
- if oldR(xx) <> "" Then
- oldRCounter = xx
- If oldR(xx) = Split(s," ")(3) Then
- oldCounterhit = 0
- exit for
- End If
- End If
- Next
- if oldRCounter = -1 Then
- oldRCounter = 0
- End If
- If oldCounterHit = -1 Then
- Rx = oldRCounter+1
- if Rx > Ubound(R,2) Then
- ReDim Preserve R(4,ubound(R,2)+1)
- End If
- oldR(oldRCounter+1) = Split(s," ")(3)
- Else
- Rx = oldRCounter
- End If
- If(INSTR(s,"Width")) Then
- R(0,CINT(oldR(oldRCounter))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Height")) Then
- R(1,CINT(oldR(oldRCounter))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Length")) Then
- R(2,CINT(oldR(oldRCounter))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Volume")) Then
- R(3,CINT(oldR(oldRCounter))) = CDBL(recordValue(s))
- End If
- End If
- ' Right Isthmus Nodules
- If mid(s,1,len("Right Isthmus Nodule")) = "Right Isthmus Nodule" then
- For xx = 0 to ubound(oldRI)
- if oldRI(xx) <> "" Then
- If oldRI(xx) = Split(s," ")(3) Then
- oldRICounter = xx
- oldCounterhit = 0
- exit for
- End If
- End If
- Next
- if oldRICounter = -1 Then
- oldRICounter = 0
- End If
- If oldCounterHit = -1 Then
- RIx = oldRICounter+1
- ReDim Preserve RI(4,RIx)
- oldRI(oldRICounter+1) = Split(s," ")(3)
- Else
- RIx = oldRICounter
- End If
- If(INSTR(s,"Width")) Then
- RI(0,CINT(oldRI(RIx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Height")) Then
- RI(1,CINT(oldRI(RIx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Length")) Then
- RI(2,CINT(oldRI(RIx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Volume")) Then
- RI(3,CINT(oldRI(RIx))) = CDBL(recordValue(s))
- End If
- End If
- ' Left Lymph Node Nodules
- If mid(s,1,len("Left Lymph Node Nodule")) = "Left Lymph Node Nodule" then
- For xx = 0 to ubound(oldLLN)
- if oldLLN(xx) <> "" Then
- If oldLLN(xx) = Split(s," ")(4) Then
- oldLLNCounter = xx
- oldCounterhit = 0
- exit for
- End If
- End If
- Next
- if oldLLNCounter = -1 Then
- oldLLNCounter = 0
- End If
- If oldCounterHit = -1 Then
- LLNx = oldLLNCounter+1
- ReDim Preserve LLN(4,LLNx)
- oldLLN(oldLLNCounter+1) = Split(s," ")(4)
- Else
- LLNx = oldLLNCounter
- End If
- If(INSTR(s,"Width")) Then
- LLN(0,CINT(oldLLN(LLNx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Height")) Then
- LLN(1,CINT(oldLLN(LLNx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Length")) Then
- LLN(2,CINT(oldLLN(LLNx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Volume")) Then
- LLN(3,CINT(oldLLN(LLNx))) = CDBL(recordValue(s))
- End If
- End If
- ' Left Lobe Nodules
- If mid(Trim(s),1,len("Left Thyroid Nodule")) = "Left Thyroid Nodule" then
- For xx = 0 to ubound(oldL)
- if oldL(xx) <> "" Then
- oldLCounter = xx
- If oldL(xx) = Split(s," ")(3) Then
- oldCounterhit = 0
- exit for
- End If
- End If
- Next
- 'response.write oldLCounter&"<br/>"
- if oldLCounter = -1 Then
- oldLCounter = 0
- End If
- If oldCounterHit = -1 Then
- Lx = oldLCounter+1
- if Lx > Ubound(L,2) Then
- ReDim Preserve L(4,ubound(L,2)+1)
- End If
- oldL(oldLCounter+1) = Split(s," ")(3)
- Else
- Lx = oldLCounter
- End If
- If(INSTR(s,"Width")) Then
- ' L(0,CINT(oldL(oldLCounter))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Height")) Then
- ' L(1,CINT(oldL(oldLCounter))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Length")) Then
- ' L(2,CINT(oldL(oldLCounter))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Volume")) Then
- ' L(3,CINT(oldL(oldLCounter))) = CDBL(recordValue(s))
- End If
- 'response.write L(0,3)&"<br/>"
- End If
- ' Left Isthmus Nodules
- If mid(s,1,len("Left Isthmus Nodule")) = "Left Isthmus Nodule" then
- For xx = 0 to ubound(oldLI)
- if oldLI(xx) <> "" Then
- If oldLI(xx) = Split(s," ")(3) Then
- oldLICounter = xx
- oldCounterhit = 0
- exit for
- End If
- End If
- Next
- if oldLICounter = -1 Then
- oldLICounter = 0
- End If
- If oldCounterHit = -1 Then
- LIx = oldLICounter+1
- ReDim Preserve LI(4,LIx)
- oldLI(oldLICounter+1) = Split(s," ")(3)
- Else
- LIx = oldLICounter
- End If
- If(INSTR(s,"Width")) Then
- LI(0,CINT(oldLI(LIx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Height")) Then
- LI(1,CINT(oldLI(LIx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Length")) Then
- LI(2,CINT(oldLI(LIx))) = CDBL(recordValue(s))
- Elseif(INSTR(s,"Volume")) Then
- LI(3,CINT(oldLI(LIx))) = CDBL(recordValue(s))
- End If
- End If
- Elseif Request.QueryString("ExamType") = "Aortic Aneurysm Surveillance" Then
- Elseif Request.QueryString("ExamType") = "Solid Pulmonary Nodule Surveillance" Then
- End If ' end of If Surveillance Type
- Next 'End of FOR LOOP
- If Request.QueryString("ExamType") = "Aortic Aneurysm Surveillance" Then
- ' call insertOrganMeasurements(NewExamNo, "Aorta Measurement", 5, 5, 5, 65)
- Elseif Request.QueryString("ExamType") = "Thyroid Surveillance" Then
- call insertOrganMeasurements(NewExamNo, "Isthmus","NULL",iAP,"NULL","NULL")
- call insertOrganMeasurements(NewExamNo, "Right Lobe", RTW, RTH, RTL, RTV)
- call insertOrganMeasurements(NewExamNo, "Left Lobe", LTW, LTH, LTL, LTV)
- For i = 1 to UBound(RLN,2)
- call insertNodules(NewExamNo, "RLN"&i, "Right Lymph Node",RLN(0,i),RLN(1,i),RLN(2,i),RLN(3,i))
- Next
- For i = 1 to UBound(R,2)
- call insertNodules(NewExamNo, "R"&i,"Right Lobe", R(0,i), R(1,i), R(2,i), R(3,i))
- Next
- For i = 1 to UBound(RI,2)
- call insertNodules(NewExamNo, "RI"&i,"Right Isthmus", RI(0,i), RI(1,i), RI(2,i), RI(3,i))
- Next
- For i = 1 to UBound(LLN,2)
- call insertNodules(NewExamNo, "LLN"&i,"Left Lymph Node", LLN(0,i), LLN(1,i), LLN(2,i), LLN(3,i))
- Next
- For i = 1 to UBound(L,2)
- call insertNodules(NewExamNo, "L"&i,"Left Lobe", L(0,i), L(1,i), L(2,i), L(3,i))
- Next
- For i = 1 to UBound(LI,2)
- call insertNodules(NewExamNo, "LI"&i,"Left Isthmus", LI(0,i), LI(1,i), LI(2,i), LI(3,i))
- Next
- End If
- End If
- End If
- set myRS = nothing
- set myRS2 = nothing
- set myRS3 = nothing
- myConn.Close
- set myConn = nothing
- call AuditThis("Inserted", "CT Exam", "QueryString")
- sRedirect = "CTWorksheet.asp?PatID="&Request.QueryString("PatID")&"&EP="&Request.QueryString("EP")&"&ExamNo="&NewExamNo
- If Request.QueryString("Datalinkfilename") <> "" then
- sRedirect = sRedirect & "&Datalinkfilename="&Escape(Request.QueryString("Datalinkfilename"))
- end if
- 'Response.Redirect sRedirect
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement