当前位置: 首页>>代码示例>>PHP>>正文


PHP CPatient::extendsWith方法代码示例

本文整理汇总了PHP中CPatient::extendsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP CPatient::extendsWith方法的具体用法?PHP CPatient::extendsWith怎么用?PHP CPatient::extendsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPatient的用法示例。


在下文中一共展示了CPatient::extendsWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importFile

/**
 * import the patient file
 *
 * @param string   $file        path to the file
 * @param int      $start       start int
 * @param int      $count       number of iterations
 * @param resource $file_import file for report
 *
 * @return null
 */
function importFile($file, $start, $count, $file_import)
{
    $fp = fopen($file, 'r');
    $patient = new CPatient();
    $patient_specs = CModelObjectFieldDescription::getSpecList($patient);
    CModelObjectFieldDescription::addBefore($patient->_specs["_IPP"], $patient_specs);
    /** @var CMbFieldSpec[] $_patient_specs */
    $_patient_specs = CModelObjectFieldDescription::getArray($patient_specs);
    echo count($_patient_specs) . " traits d'import";
    //0 = first line
    if ($start == 0) {
        $start++;
    }
    $line_nb = 0;
    while ($line = fgetcsv($fp, null, ";")) {
        $patient = new CPatient();
        if ($line_nb >= $start && $line_nb < $start + $count) {
            $line_rapport = "ligne {$line_nb} - ";
            //foreach SPECS, first load
            foreach ($_patient_specs as $key => $_specs) {
                $field = $_specs->fieldName;
                $data = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $line[$key]);
                //specific cleanups
                if ($_specs instanceof CPhoneSpec) {
                    $data = preg_replace('/\\D/', '', $data);
                }
                if ($field == "sexe") {
                    $data = strtolower($data);
                }
                if ($field == "deces" && $data == "0000-00-00") {
                    $data = null;
                }
                $patient->{$field} = $data;
            }
            $line_rapport .= "Patient {$patient->nom} {$patient->prenom} ({$patient->naissance})";
            //clone and IPP
            $IPP = $patient->_IPP;
            $patient->_generate_IPP = false;
            $patient_full = new CPatient();
            $patient_full->extendsWith($patient);
            // load by ipp if basic didn't find.
            if (!$patient->_id) {
                $patient->loadFromIPP();
                if ($patient->_id) {
                    $line_rapport .= " (trouvé par IPP)";
                }
            }
            //load patient with basics
            if (!$patient->_id) {
                $patient->_IPP = null;
                $patient->loadMatchingPatient();
                if ($patient->_id) {
                    $line_rapport .= " (trouvé par matching)";
                }
            }
            //update fields if import have more data
            foreach ($patient->getPlainFields() as $field => $value) {
                if (!$patient->{$field}) {
                    $patient->{$field} = $patient_full->{$field};
                }
            }
            // fields created by store, let the store do the job for these
            $patient->civilite = "guess";
            //found
            if ($patient->_id) {
                //check IPP
                $patient->loadIPP();
                //update
                $patient->store();
                if (!$patient->_IPP) {
                    $idex = CIdSante400::getMatch($patient->_class, CPatient::getTagIPP(), $IPP, $patient->_id);
                    $idex->last_update = CMbDT::dateTime();
                    $idex->store();
                    if ($idex->_id) {
                        $line_rapport .= ", IPP créé : {$IPP}";
                    }
                    echo "<tr style=\"color:#c98000\"><td>{$line_nb}</td><td>patient [{$patient->nom} {$patient->prenom}] déjà existant (MAJ ipp : {$idex->id400})</td></tr>";
                } else {
                    $line_rapport .= " déjà existant";
                    if ($patient->_IPP != $IPP) {
                        mbLog($patient->_view . " [ipp: " . $patient->_IPP . " / ipp_import:" . $IPP);
                        $line_rapport .= " [IPP du fichier: {$IPP} / ipp en base: {$patient->_IPP} ]";
                    }
                    $line_rapport .= " [IPP en base et fichier identiques]";
                    echo "<tr style=\"color:#c98000\"><td>{$line_nb}</td><td>patient [{$patient->nom} {$patient->prenom}] déjà existant (ipp : {$patient->_IPP})</td></tr>";
                }
            } else {
                $result = $patient->store();
                if (!$result) {
                    $line_rapport .= " créé avec succes";
//.........这里部分代码省略.........
开发者ID:fbone,项目名称:mediboard4,代码行数:101,代码来源:do_import_patient.php


注:本文中的CPatient::extendsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。