Hi,
I have OUL_R21 facts which have a array of OUL_R21_ORDER_OBSERVATION
objects.
OUL_R21_ORDER_OBSERVATION object has a array of OUL_R21_OBSERVATION.
OUL_R21_OBSERVATION object has a array of OUL_R21_OBSERVATION_RESULT.
And OUL_R21_OBSERVATION_RESULT has a OBX child.
I want to add the number one in my global list if one of all OBX has
abnormalFlags.value in ( 'HH', 'LL', 'AA', 'H',
'L', 'A' )
if
(OUL_21.ORDER_OBSERVATIONS[*].OBSERVATIONS[*].OBSERVATION_RESULTS[*].OBX.abnormalFlags.value
in ( 'HH', 'LL', 'AA', 'H', 'L', 'A' ))
list.add(1);
Here is the rule in tring to create...
package com.xwave.drools
import com.xwave.hapi.hl7v2.model.v24.message.OUL_R21
import com.xwave.hapi.hl7v2.model.v24.group.OUL_R21_ORDER_OBSERVATION
import com.xwave.hapi.hl7v2.model.v24.group.OUL_R21_OBSERVATION
import com.xwave.hapi.hl7v2.model.v24.group.OUL_R21_OBSERVATION_RESULT
import java.util.ArrayList
import ca.uhn.hl7v2.model.v24.segment.OBX
global java.util.List list
/* Pour le chainage de tableau, il est obligatoire de le faire étape après
étape */
rule "Get All OBX"
dialect "mvel"
when
$labMessage : OUL_R21()
$orderObservation : OUL_R21_ORDER_OBSERVATION() from
$labMessage.ORDER_OBSERVATIONS
$observation : OUL_R21_OBSERVATION() from
$orderObservation.OBSERVATIONS
$observationResult : OUL_R21_OBSERVATION_RESULT() from
$observation.OBSERVATION_RESULTS
$obx : OBX() from $observationResult.OBX
then
insert($obx);
end
rule "Abnormals"
dialect "mvel"
when
$result : ArrayList(size > 0) from collect(OBX(abnormalFlags.value in (
'HH', 'LL', 'AA', 'H', 'L', 'A' )))
then
System.out.println("Abnormal result : " + $result);
list.add(1);
end
Could you please tell me the solution.
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Rules-if-one-of-eleme...
Sent from the Drools - User mailing list archive at
Nabble.com.