您的位置:首页 > 编程语言 > ASP

哪位大神 能将asp的一段代码逻辑 用java语言实现!!!我QQ“:596963475 求大神!!!

2017-01-08 17:24 351 查看
        "where Cell_Quantity >= 5 and Blood_Type <> '溶血' and Rh <> '溶血' and ((left(hlaa1,2) in ('" & HLAA1 & "','" & HLAA2 & "','" & HLAA3 & "','" & HLAA4 & "')) and hlaa1<>'') " & _

        "or ((left(hlaa2,2) in ('" & HLAA1 & "','" & HLAA2 & "','" & HLAA3 & "','" & HLAA4 & "')) and hlaa2<>'') " & _

        "or ((left(hlaa3,2) in ('" & HLAA1 & "','" & HLAA2 & "','" & HLAA3 & "','" & HLAA4 & "')) and hlaa3<>'') " & _

        "or ((left(hlaa4,2) in ('" & HLAA1 & "','" & HLAA2 & "','" & HLAA3 & "','" & HLAA4 & "')) and hlaa4<>'') " & _

        "or ((left(hlab1,2) in ('" & HLAB1 & "','" & HLAB2 & "','" & HLAB3 & "','" & HLAB4 & "')) and hlab1<>'') " & _

        "or ((left(hlab2,2) in ('" & HLAB1 & "','" & HLAB2 & "','" & HLAB3 & "','" & HLAB4 & "')) and hlab2<>'') " & _

        "or ((left(hlab3,2) in ('" & HLAB1 & "','" & HLAB2 & "','" & HLAB3 & "','" & HLAB4 & "')) and hlab3<>'') " & _

        "or ((left(hlab4,2) in ('" & HLAB1 & "','" & HLAB2 & "','" & HLAB3 & "','" & HLAB4 & "')) and hlab4<>'') " & _

        "or ((left(hladr1,2) in ('" & HLADR1 & "','" & HLADR2 & "','" & HLADR3 & "','" & HLADR4 & "')) and hladr1<>'') " & _

        "or ((left(hladr2,2) in ('" & HLADR1 & "','" & HLADR2 & "','" & HLADR3 & "','" & HLADR4 & "')) and hladr2<>'') " & _

        "or ((left(hladr3,2) in ('" & HLADR1 & "','" & HLADR2 & "','" & HLADR3 & "','" & HLADR4 & "')) and hladr3<>'') " & _

        "or ((left(hladr4,2) in ('" & HLADR1 & "','" & HLADR2 & "','" & HLADR3 & "','" & HLADR4 & "')) and hladr4<>'') "

    

    set rs = server.CreateObject("adodb.recordset")

    Set rs = MatchConn.Execute(sql)

    Do While Not (rs.EOF Or rs.BOF)

        VPoints(0) = rs(1)

        VPoints(1) = rs(2)

        VPoints(2) = rs(3)

        VPoints(3) = rs(4)

        VPoints(4) = rs(5)

        VPoints(5) = rs(6)

        VPoints(6) = rs(7)

        VPoints(7) = rs(8)

        VPoints(8) = rs(9)

        VPoints(9) = rs(10)

        VPoints(10) = rs(11)

        VPoints(11) = rs(12)

  

        tPoints = MatchBloodTypePoint(PPoints, VPoints)

        If tPoints >= 4 Then

            'get match id

            'add dealing code by ywm

            MatchIDs.Add trim(rs(0)),tPoints

            

            select case tPoints

            	case 4

            		S4 = S4 + 1

            	case 5

            		S5 = S5 + 1

            	case 6

            		S6 = S6 + 1

            end select

        End If

        rs.MoveNext

        'DoEvents

    Loop

    rs.Close

   

    

    '更新

    LogConn.Execute("update SearchLog set M4 = '"& S4 &"',M5 = '"& S5 &"',M6 = '"& S6 &"' where ID = "& clng(ID) &"")

    

    '排序

    SortDictionary MatchIDs,dictItem

    

    Set DoMatchCompare = MatchIDs

    Set rs = Nothing

End Function

Public Function MatchBloodTypePoint(ByRef PatientPoint(), ByRef VolunteerPoint())

    Dim MatchCounter

    Dim Counter

    Dim i

    

    If UBound(PatientPoint) = 11 And UBound(VolunteerPoint) = 11 Then

        For i = 0 To UBound(PatientPoint) Step 4

            Counter = MatchHLPoint(PatientPoint(i), PatientPoint(i + 1), PatientPoint(i + 2), PatientPoint(i + 3), VolunteerPoint(i), VolunteerPoint(i + 1), VolunteerPoint(i + 2), VolunteerPoint(i + 3))

           MatchCounter = MatchCounter + Counter

'            If MatchCounter >= 4 Then

'                Exit For

'            End If

        Next

    End If

   

'    MsgBox MatchCounter

'    If MatchCounter >= 4 Then

'        MatchBloodTypePoint = True

'    Else

'        MatchBloodTypePoint = False

'    End If

    MatchBloodTypePoint = MatchCounter

End Function

Public Function MatchHLPoint(ByVal PFirst, ByVal PSecond, ByVal PThird, ByVal PFourth, ByVal VFirst, ByVal VSecond, ByVal VThird, ByVal VFourth)

    Dim Counter

    Dim IsCrossMatch

    

    ConvertNumber VFirst, VThird

    TruncateNumber VFirst, VSecond, VThird, VFourth

    

'    ConvertNumber PFirst, PThird

'    TruncateNumber PFirst, PSecond, PThird, PFourth

        

    'compare

    If Len(PFirst) > 0 Then

        If PFirst = VFirst Or PFirst = VSecond Then

            Counter = Counter + 1

        ElseIf PFirst = VThird Or PFirst = VFourth Then

            Counter = Counter + 1

            IsCrossMatch = True

        ElseIf Len(PSecond) > 0 Then

            If PSecond = VFirst Or PSecond = VSecond Then

                Counter = Counter + 1

            ElseIf PSecond = VThird Or PSecond = VFourth Then

                Counter = Counter + 1

                IsCrossMatch = True

            End If

        End If

    End If

    

    If Len(PThird) > 0 Then

        If Counter = 1 Then

            If IsCrossMatch Then

                If PThird = VFirst Or PThird = VSecond Then

                    Counter = Counter + 1

                ElseIf Len(PFourth) > 0 Then

                    If PFourth = VFirst Or PFourth = VSecond T
a5fa
hen

                        Counter = Counter + 1

                    End If

                End If

            Else

                If PThird = VThird Or PThird = VFourth Then

                    Counter = Counter + 1

                ElseIf Len(PFourth) > 0 Then

                    If PFourth = VThird Or PFourth = VFourth Then

                        Counter = Counter + 1

                    End If

                End If

            End If

        Else

            If PThird = VFirst Or PThird = VSecond Or PThird = VThird Or PThird = VFourth Then

                Counter = Counter + 1

            ElseIf Len(PFourth) > 0 Then

                If PFourth = VFirst Or PFourth = VSecond Or PFourth = VThird Or PFourth = VFourth Then

                    Counter = Counter + 1

                End If

            End If

        End If

    End If

    

    MatchHLPoint = Counter

End Function

Public Sub ConvertNumber(ByRef First, ByRef Second)

    If Not IsNumeric(First) Then

        First = Second

    ElseIf Not IsNumeric(Second) Then

        Second = First

    End If

End Sub

Public Sub TruncateNumber(ByRef First, ByRef Second, ByRef Third, ByRef Fourth)

    If Len(First) = 4 Then

        First = Left(First, 2)

    ElseIf Len(First) = 1 Then

        First = "0" & First

    End If

    If Len(Second) = 4 Then

        Second = Left(Second, 2)

    ElseIf Len(Second) = 1 Then

        Second = "0" & Second

    End If

    If Len(Third) = 4 Then

        Third = Left(Third, 2)

    ElseIf Len(Third) = 1 Then

        Third = "0" & Third

    End If

    If Len(Fourth) = 4 Then

        Fourth = Left(Fourth, 2)

    ElseIf Len(Fourth) = 1 Then

        Fourth = "0" & Fourth

    End If

End Sub

%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: