* @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CCanDo::checkRead();
$dossier_medical_id = CValue::get("dossier_medical_id");
$object_guid = CValue::get("object_guid");
$type = CValue::get("type");
$exclude = CValue::get("exclude");
if ($object_guid) {
    $dossier_medical = CMbObject::loadFromGuid($object_guid);
} else {
    $dossier_medical = new CDossierMedical();
    $dossier_medical->load($dossier_medical_id);
}
if ($type) {
    $dossier_medical->loadRefsAntecedentsOfType($type);
} else {
    $dossier_medical->loadRefsAntecedents();
}
$tab_atc = array();
$ant_communs = array();
$patient = null;
if ($dossier_medical->object_class == "CSejour") {
    $dossier_medical->loadRefObject();
    /* @var CSejour $sejour*/
    $sejour = $dossier_medical->_ref_object;
    $doss_patient = $sejour->loadRefPatient()->loadRefDossierMedical();
    if ($type) {
        $doss_patient->loadRefsAntecedentsOfType($type);
    } else {
        $doss_patient->loadRefsAntecedents();