在Drools语法上有点麻烦。不确定是什么问题。我是否应该在规则的“然后”部分中再次将“ $ values1”强制转换为HashMap?
以下是错误消息:未定义类型Object的get(String)方法
import drools.spring.example.beans.*;
import drools.spring.example.controller.*;
import java.util.Date;
import java.util.HashMap;
import java.util.ArrayList;
rule "Chr check"
when
$values1: HashMap() and
$allPatients: ArrayList() and
$d: Date()
then
for(Patient p : (ArrayList<Patient>) $allPatients) {
for(Appointment pr : (ArrayList<Appointment>) p.getAppointments()) {
if(pr.getDateOfAppointment().after(workWithDates($d, "-", 1, 2))) {
//Following line is where the error occurs
$values1.get(p.getIdPatient()).put((String) pr.getDiagnosedDisease().getName(), (int) $values1.get((String)p.getIdPatient()).get(pr.getDiagnosedDisease().getName())+1);
}
}
}
end