private function flowAndFollowUpMessage($request, $response)
 {
     /*{{{*/
     $doctorPatientRef = DAL::get()->find('doctorPatientRef', $request->refId);
     $ticketId = $request->ticketId;
     $response->repealServiceCards = DAL::get()->find_all_by_SpaceAndPatientOfRepealServiceCard('servicecard', $doctorPatientRef->space, $doctorPatientRef->patient, ServiceDef::TYPE_FLOW);
     $nowPage = $request->getRequest('p', 1);
     $allFlowInfos = FlowClient::getInstance()->getAllFlowInfos($doctorPatientRef->space->id, $doctorPatientRef->patient->id, array('includeDeleteData' => true));
     $doctorPatientRef->checkRefCnt();
     $isFlow = $request->isFlow ? 15 : 10;
     $pageSize = $request->page ? count($allFlowInfos) : $isFlow;
     $response->page = $request->page ? $request->page : 0;
     $showAll = true;
     if (false == $response->page && count($allFlowInfos) > $isFlow) {
         $showAll = false;
     }
     $response->showAll = $showAll;
     $options = array();
     $options['flowOrder'] = SpaceAttribute::FLOW_ORDER_DESC;
     $options['isAll'] = true;
     $options['noUpdate'] = true;
     $flowList = FlowClient::getInstance()->getFlowInfos($doctorPatientRef->id, $nowPage, $pageSize, $options);
     $response->flowList = $flowList['objects'];
     //通过流id取到收费postIds
     $response->chargePostIds = ServiceCardClient::getInstance()->querySameServiceTypeAndUnfreeServiceAppIds($doctorPatientRef->space, $doctorPatientRef->patient, ServiceDef::TYPE_FLOW);
     $response->doctorPatientRef = $doctorPatientRef;
     $scoreAmounts = ScoreClient::getInstance()->getScoreByUserIdGroupByCate($doctorPatientRef->user->id);
     $response->scoreAmount = $scoreAmounts[Account::CATE_INTEGRAL][Account::TYPE_PRESENT] + $scoreAmounts[Account::CATE_INTEGRAL][Account::TYPE_NORMAL];
     $ticket = DAL::get()->find('Ticket', $ticketId);
     $response->ticket = $ticket;
     //标注异常
     $response->abnormalStatus = $this->getAbnormalStatus($flowList['objects']);
     $page = $request->page;
     if (empty($page)) {
         $page = 1;
     }
     $params = array();
     $params['doctorpatientrefid'] = $doctorPatientRef->id;
     $params['nowPage'] = $page;
     $params['pageSize'] = $pageSize;
     $res = DoctorPatientPostClient::getInstance()->getPostList($params);
     $postList = $res['postList'];
     $postIds = array_keys($postList);
     $response->keyWords = array();
     $response->postList = $postList;
     $response->pageLink = '';
     if (false == empty($res['pageInfo']) && $ticketId) {
         $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplate('/nfsaudit/nexttask?ticketId=' . $ticketId . '&page='), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']);
     }
     $proposalIds = DAL::get()->querySpacePatientProposals('proposal', $doctorPatientRef->space, array($doctorPatientRef->user->id), $doctorPatientRef->patient->id);
     $threadParentCategoryName = '未知';
     $proposal = NullEntity::create();
     if (false == empty($proposalIds)) {
         $proposal = DAL::get()->mustFind('proposal', array_pop($proposalIds));
         $threadParentCategory = DAL::get()->find('ThreadCategory', $proposal->category->parentId);
         if (false == $threadParentCategory->isNull()) {
             $threadParentCategoryName = $threadParentCategory->name;
         }
     }
     $response->proposal = $proposal;
     $response->threadParentCategoryName = $threadParentCategoryName;
     //随访信息,目前一个医生有一个随访卡,但未来会有多个,暂时只查询一条显示(产品gjb确认)
     $patientCard = DAL::get()->find_by_spaceid('PatientCard', $doctorPatientRef->space->id);
     if (false == $patientCard->isNull()) {
         $response->followupAuditor = DAL::get()->find_by_auditorid('FollowupAuditor', $this->auditor->id);
         $owner = DAL::get()->find_by_spaceid_and_patientid('FollowupOwner', $patientCard->space->id, $doctorPatientRef->patient->id);
         $userScheme = new NullEntity();
         if ($owner->isNull() == false) {
             $userScheme = HealthRecordClient::getInstance()->getPatientSigninScheme($owner->id);
         }
         $response->userScheme = $userScheme;
         if ($doctorPatientRef->space->isOpenFollowup()) {
             $response->owner = $owner;
         }
     }
     $postTicketList = $response->postTicketList == null ? array() : $response->postTicketList;
     $this->attachmentList($request, $response, $postList, $postTicketList);
     $response->postTicketList = $postTicketList;
 }
    echo $category->name;
    ?>
</h3>
<?php 
    if ($category->name == HealthRecordProblemCategory::NAME_DISEASEINFO) {
        include '_old_diseaseinfo.php';
        include '_diseaseinfo.php';
        continue;
    }
    ?>
	<div style="width:90%; margin-left:2em;">
	<?php 
    $i = 0;
    $healthProblems = HealthRecordClient::getInstance()->getProblems4InitialInfo($category->id);
    $problemIds = array_keys($healthProblems);
    $answerList = HealthRecordClient::getInstance()->getHealthAnswerList4Initial($patientSignin->user->id, $problemIds);
    $myAnswerList = array();
    foreach ($answerList as $answer) {
        if ($answer->isNull() == false) {
            $myAnswerList[$answer->ref->problem->id] = $answer;
        }
    }
    $childProblems = array();
    $oldHealthData = array();
    foreach ($healthProblems as $key => $healthProblem) {
        if ($healthProblem->isNull()) {
            continue;
        }
        $value = '';
        $healthAnswer = isset($myAnswerList[$healthProblem->id]) ? $myAnswerList[$healthProblem->id] : new NullEntity();
        if ($healthAnswer->isNull() == false) {
<?php
$weightProblem = HealthRecordClient::getInstance()->getProblem('体重', HealthRecordProblem::TYPE_HEALTH);
$heightProblem = HealthRecordClient::getInstance()->getProblem('身高', HealthRecordProblem::TYPE_SIGNIN);
$weightIndexProblem = $healthProblem;
$lastHeightAnswerList = HealthRecordClient::getInstance()->getLastHealthAnswerList($user->id, array($heightProblem->id));
$lastHeightAnswer = new NullEntity();
foreach ($lastHeightAnswerList as $ans) {
  $lastHeightAnswer = $ans;
}
$vw = null; //体重的值
if (isset($relationAnswer4EditArr) && is_array($relationAnswer4EditArr)) {
	foreach ($relationAnswer4EditArr as $a) {
		if ($a->problem->id == $weightProblem->id) {
			$vw = $a->value;
		}
	}
}
?>
	    <!--start scenter-form-list-->
	    <div class="clearfix scenter-form-list">
	      <label class="fl"><?=$weightProblem->displayTitle?>:</label>
	      <span class="fl">
		<input name="vars[hp][<?=$weightProblem->id?>]" id="weightindex_weight" type="text" class="num-verify scenter-form-input musthaveone" value="<?=isset($vw)?$vw:''?>" style="ime-mode:inactive;" /> <?=$weightProblem->unit?>
	      </span>
	      <label class="fl"><?=$heightProblem->displayTitle?>:</label><span class="fl"><span id="html_weightindex_height"><?php if ($lastHeightAnswer->isNull() == false) echo $lastHeightAnswer->value; ?></span> <?=$heightProblem->unit?></span>
              <label class="fl"><?=$weightIndexProblem->displayTitle?>:</label><span class="fl weightIndex"><span id="html_weightindex_weightindex"><?=isset($v)?$v:''?></span><?=$weightIndexProblem->unit?></span>
	      <input id="weightindex_weightindex" type="hidden" name="vars[hp][<?=$weightIndexProblem->id?>]" value="<?=isset($v)?$v:''?>" />
	      </div>
	    <!--end scenter-form-list-->
 private function displayScheme($userId,$request,$response)
 {/*{{{*/
     $schemes= HealthRecordClient::getInstance()->getUserSchemes($userId);
     $response->schemes= $schemes;
     $response->userId = $userId;
     $user = DAL::get()->find('user', $userId);
     $signin = $user->getFollowupPatientSignin(); 
     if($signin->isNull())
     {
         $response->space = new NullEntity();
     }
     else
     {
         $response->space = $signin->space;
     }
 }/*}}}*/
 private function getQuestionByTypeAndId($questionType = 'nfsQuestion', $questionId, $questionTitle = "")
 {
     /*{{{*/
     $question = DAL::get()->find($questionType, $questionId);
     if ($question->isNull() && $questionType == "HealthRecordProblem" && false == empty($questionTitle)) {
         $medicineQuestion = HealthRecordClient::getInstance()->getMedicineProblem($questionTitle);
         if ($medicineQuestion->isNull()) {
             $medicineQuestion = HealthRecordClient::getInstance()->addMedicineProblem($questionTitle);
         }
         return $medicineQuestion;
     }
     return $question;
 }
 public function modifyDiary($request, $response)
 {
     /*{{{*/
     $vars = $request->vars;
     $diary = DAL::get()->find('HealthDiary', $request->diaryId);
     if ($diary->isNull()) {
         throw new BizException('该日记不存在');
     }
     $doTime = $diary->doTime;
     $user = $diary->user;
     $lastHealthAnswerList = array();
     foreach ($vars['hp'] as $updateProblemId => $value) {
         if (empty($value) == false) {
             $problem = DAL::get()->find('HealthRecordProblem', $updateProblemId);
             $ans = HealthRecordClient::getInstance()->addHealthAnswer($user->id, $problem->id, $value, $problem->unit, $doTime, HealthRecordAnswer::STATUS_INIT, array($value), array());
             $lastHealthAnswerList[$ans->id] = $ans;
         }
     }
     $relationAnswerIds = array_keys($lastHealthAnswerList);
     $relationProblemIds = explode(',', $request->relationproblemids);
     $diaryContent = $vars['diary'];
     if ($diaryContent == '' || $diaryContent == '您的健康日记只有您本人可以看到!') {
         $diaryContent = '';
     }
     foreach ($diary->relationAnswerIds as $answerId) {
         HealthRecordClient::getInstance()->deleteHealthRecordAnswer($answerId);
     }
     HealthDiaryClient::getInstance()->updateDiary($diary->id, $diaryContent, array('relationAnswerIds' => $relationAnswerIds));
     $logType = NfsAuditLog::TypeDiaryUpdate;
     $logContent = "修改了{$diary->doTime->toString()}提交的日记";
     NfsAuditClient::getInstance()->addAuditLog($diary->user, $diary, $this->auditor, $logType, $logContent);
     $response->setRedirect($response->router->urlfor('healthrecord/diarydetail', array('diaryId' => $diary->id)));
 }
	    <!--start scenter-form-list-->
	    <div class="clearfix scenter-form-list">
	      <label class="fl"><?=$healthProblem->displayTitle?>:</label>
	      <span class="fl">
		<textarea id="health-unwell-area" name="vars[hp][<?=$healthProblem->id?>]" class="scenter-form-textForbody p5 musthaveone" value="<?=isset($v)?$v:''?>"><?=isset($v)?$v:''?></textarea>
		<p class="pt5 pb5"><span class="exp-unwell cp exp"><img src="http://i1.hdfimg.com/userspace/images/face-smile.gif" /><span class="vm">表情</span></span><span class="gray2 f12 pl20">如出现<span class="black"><?=HealthRecordClient::getInstance()->getUserHealthProblemRelationDesc($user->id)?></span>等</span></p>
		
		 </span>
	      </div>
	    <!--end scenter-form-list-->
 public function ajaxgetshittotalhashdata($request, $response)
 {/*{{{*/
     $lastTime = XDateTime::valueOf($request->lasttime);
     $startTime = $lastTime->addDay(-30);
     $response->shitJsonHashData = HealthRecordClient::getInstance()->getShitJsonHashData($request->userid, $startTime->toShortString(), $lastTime->toShortString());
 }/*}}}*/
<table border="1" width="95%">
<?php 
foreach ($healthProblems as $healthProblem) {
    if ($healthProblem->isNull()) {
        continue;
    }
    $value = '';
    $answerList = HealthRecordClient::getInstance()->getLastHealthAnswerList($owner->user->id, array($healthProblem->id));
    //	$answerList = HealthRecordClient::getInstance()->getAnswers4Signin($owner->user->id, $healthProblem->id, HealthRecordAnswer::MAX_SIGNIN_ANSWERS_COUNT);
    echo "<tr height='30px'>";
    switch ($healthProblem->mode) {
        case HealthRecordProblem::MODE_NUMBERIC:
            foreach ($answerList as $answer) {
                if ($answer->isNull()) {
                    continue;
                }
                $value = $answer->value;
                break;
            }
            echo "<td width='120px'><span class='ptitle'>{$healthProblem->title}:</span></td>";
            echo "<td><input class='pinput' type='text' id='{$healthProblem->id}' name='pbs[{$healthProblem->id}]' value='{$value}'/>";
            echo "{$healthProblem->unit}";
            echo "<div style='color:gray;'>{$healthProblem->description}</div>";
            echo "</td>";
            break;
        case HealthRecordProblem::MODE_TEXT:
            foreach ($answerList as $answer) {
                if ($answer->isNull()) {
                    continue;
                }
                $value = $answer->value;
 public function modifyHealthItemStepPost($request, $response)
 {
     $healthItemStep = DAL::get()->find('HealthItemStep', $request->healthItemStepId);
     DBC::requireTrue($healthItemStep instanceof HealthItemStep, "不存在该步骤");
     $params = $request->vars;
     if (false == empty($params['checkContent'])) {
         if (is_array($params['checkContent'])) {
             $params['checkContent'] = implode(',', $params['checkContent']);
         }
     }
     $healthItemStepId = HealthItemProjectClient::getInstance()->modifyHealthItemStep($healthItemStep->id, $params);
     $arr['value'] = $params['result'];
     $arr['unit'] = $params['resultFix'];
     $ansId = $healthItemStep->healthdiary->relationAnswerIds;
     HealthRecordClient::getInstance()->updateHealthRecordAnswer($ansId[0], $arr);
     if (isset($params['healthDiary']) && $params['healthDiary']) {
         HealthDiaryClient::getInstance()->updateDiary($healthItemStep->healthdiary->id, $params['content'] . "," . $params['checkContent']);
     }
     $preMsg = "体重管理跟进 " . $healthItemStepId . " 修改成功";
     $response->setRedirect($response->router->urlfor('healthitemproject/modifyhealthitemstep', array('healthItemStepId' => $healthItemStep->id, 'preMsg' => $preMsg)));
 }
                $childProblems = $healthProblem->getChildProblemList();
                foreach($childProblems as $childProblem)
                {
                    $lastAnswer = HealthRecordClient::getInstance()->getLastHealthAnswer($followupOwner->user->id, $childProblem->id);
                    //iskong
                    $lastAnswerValue = trim($lastAnswer->value);
                    if($lastAnswer->isNull() || $lastAnswerValue == '')
                    {
                        continue;
                    }
                    echo "{$childProblem->displayTitle}  ".$lastAnswer->getDisplayTitle().'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                }
            }
            else
            {
                $lastAnswer = HealthRecordClient::getInstance()->getLastHealthAnswer($followupOwner->user->id, $healthProblem->id);
                //iskong
                $lastAnswerValue = trim($lastAnswer->value);
                if($lastAnswer->isNull() || $lastAnswerValue == '')
                {
                    continue;
                }
                echo $lastAnswer->getDisplayTitle();

            }
            echo '</li>';
        }/*}}}*/
        if($categoryIsEmpty)
        {
            echo '<li>无内容</li>';
        }
 public function followupInfo($request, $response)
 {
     /*{{{*/
     $hospitalCaseNo = $request->hospitalcaseno;
     $response->hospitalCaseNo = $hospitalCaseNo;
     $realName = $request->realname;
     $response->realName = $realName;
     $userName = $request->username;
     $response->userName = $userName;
     $spaceId = $this->space->id;
     $currentDiseaseSpaceRef = DAL::get()->find_by_spaceid('NfsDiseaseSpaceRef', $spaceId);
     $ownerIds = array();
     //如果什么都没填直接点击搜索
     if (empty($hospitalCaseNo) && empty($realName) && empty($userName)) {
         $page = $request->getRequest('page', 1);
         $count = 15;
         $res = FollowupClient::getInstance()->getOwnerOfOneDiseaseBySpaceId($page, $count, $spaceId);
         $ownerIds = $res['ids'];
         if (false == empty($res['pageInfo'])) {
             $response->pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate('/adminpatient/followupinfo?page='), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']);
         }
     } else {
         $ownerList = array();
         //如果是点击列表中的链接
         if (false == empty($userName)) {
             $user = UserClient::getInstance()->getByUserName($userName);
             $owner = FollowupClient::getInstance()->getOpenedFollowupOwnerByUser($user->id);
             $diseaseSpaceRef = DAL::get()->find_by_spaceid('NfsDiseaseSpaceRef', $owner->space->id);
             if ($diseaseSpaceRef->nfsDisease->id == $currentDiseaseSpaceRef->nfsDisease->id) {
                 $ownerIds[] = $owner->id;
             }
         } else {
             $ownerIdArr = FollowupClient::getInstance()->getOwnerByHospitalCaseNOAndRealName($hospitalCaseNo, $realName);
             $ownerList = DAL::get()->find('FollowupOwner', $ownerIdArr);
             foreach ($ownerList as $owner) {
                 $diseaseSpaceRef = DAL::get()->find_by_spaceid('NfsDiseaseSpaceRef', $owner->space->id);
                 if ($diseaseSpaceRef->nfsDisease->id == $currentDiseaseSpaceRef->nfsDisease->id) {
                     $ownerIds[] = $owner->id;
                 }
             }
         }
     }
     $response->ownerIds = $ownerIds;
     if (1 == count($ownerIds)) {
         $owner = DAL::get()->find('FollowupOwner', $ownerIds[0]);
         $response->owner = $owner;
         $user = $owner->user;
         $res = FollowupClient::getInstance()->getOwnerOfOneDiseaseBySpaceId(0, 2000, $spaceId);
         $allOwnerIds = $res['ids'];
         $key = array_search($ownerIds[0], $allOwnerIds);
         $preKey = $key - 1;
         if ($preKey >= 0) {
             $preOwner = DAL::get()->find('FollowupOwner', $allOwnerIds[$preKey]);
             $preOwnerUserName = $preOwner->user->name;
             $response->preOwnerUserName = $preOwnerUserName;
         }
         $nextKey = $key + 1;
         if ($nextKey <= count($allOwnerIds) - 1) {
             $nextOwner = DAL::get()->find('FollowupOwner', $allOwnerIds[$nextKey]);
             $nextOwnerUserName = $nextOwner->user->name;
             $response->nextOwnerUserName = $nextOwnerUserName;
         }
         //PCI手术信息
         $category = DAL::get()->find_by_name('HealthRecordProblemCategory', '二、PCI手术信息');
         $healthProblems = $category->problems;
         $problemIds = array_keys($healthProblems);
         $answerList = HealthRecordClient::getInstance()->getHealthAnswerList4Initial($owner->user->id, $problemIds);
         $myAnswerList = array();
         foreach ($answerList as $answer) {
             if ($answer->isNull() == false) {
                 $myAnswerList[$answer->ref->problem->id] = $answer;
             }
         }
         $response->healthProblems = $healthProblems;
         $response->myAnswerList = $myAnswerList;
         //当前用药信息
         $medicineUserSchemes = MedicineClient::getInstance()->getUserCurrentMedicineScheme($user->id);
         $response->medicineUserSchemes = $medicineUserSchemes;
         $ref = DAL::get()->find_by_spaceid_and_patientid('DoctorPatientRef', $owner->space->id, $owner->patient->id);
         $response->refId = $ref->getEncodeId();
         //复查信息
         if ($user->isNull()) {
             echo '操作的用户不存在';
             return parent::DIRECT_OUTPUT;
         }
         $patientSignin = $user->getFollowupPatientSignin($spaceId);
         //随访已经关闭
         if ($patientSignin->isNull() == false && $patientSignin->isCloseFollowup()) {
             echo '所操作的用户不是随访用户或随访已经关闭';
             return parent::DIRECT_OUTPUT;
         }
         $response->ownerUser = $user;
         $response->patient = $patientSignin->patient;
         $ticketId = $request->ticketId;
         $checkupTaskArray = array();
         $checkupQueues = array();
         $customizeQueues = CheckupClient::getInstance()->getUserCustomizeQueue($user->id);
         if (empty($customizeQueues) == false) {
             $checkupQueues = $customizeQueues;
         } else {
             $checkupQueues = CheckupClient::getInstance()->getUserFollowupQueues($user->id);
         }
         foreach ($checkupQueues as $checkupQueue) {
             $filter = 'checkuptaskqueueid=' . $checkupQueue->id;
             $checkupTasks = array();
             // 对任务排序
             $taskArray = DAL::get()->find_all_by_condition('checkuptask', $filter);
             $queue = $checkupQueue;
             $nowTask = $queue->firstTask;
             $nextTaskId = $nowTask->nextTaskId;
             while ($nextTaskId != 0) {
                 $nowTask = $taskArray[$nextTaskId];
                 $nextTaskId = $nowTask->nextTaskId;
                 if ($nowTask->isUsed()) {
                     $checkupTasks[] = $nowTask;
                 }
             }
             $checkupTaskArray[$checkupQueue->id]['checkupTasks'] = $checkupTasks;
         }
         if (empty($ticketId)) {
             $tL = CheckupClient::getInstance()->getUserLastTickets($user->id);
             foreach ($tL as $t) {
                 if ($t->task->isUsed() && ($t->task->isCustomizeTask() || $t->task->isFollowupTask() || $t->task->isTemporaryTask())) {
                     $ticketId = $t->id;
                     break;
                 }
             }
         }
         // 读取临时任务
         $tempTaskList = CheckupClient::getInstance()->getUserEffectedTemporaryTasks($user->id);
         $this->getTaskList($tempTaskList);
         $response->cycleTaskTimeMap = $cycleTaskTimeMap;
         if (empty($checkupTaskArray)) {
             echo '此患者没有复查任务';
             return parent::DIRECT_OUTPUT;
         }
         $response->checkupTaskArray = $checkupTaskArray;
         $checkupTicket = DAL::get()->find('checkupticket', $ticketId);
         $response->ref = DAL::get()->find_by_spaceid_and_patientid('DoctorPatientRef', $patientSignin->space->id, $patientSignin->patient->id);
         $leaveHosDayArr = array();
         if (false == $checkupTicket->isNull()) {
             $leaveHosDayArr = $patientSignin->getDiffLeaveHospitalDay($checkupTicket->startTime->addDay($checkupTicket->task->queue->noticeDay));
         }
         //读取定制复查过去的任务
         $pastTicketTasks = array();
         $checkupPastTaskQueues = CheckupClient::getInstance()->getUserPastCustomizeQueue($user->id);
         foreach ($checkupPastTaskQueues as $queue) {
             $tasks = CheckupClient::getInstance()->getUserPastTicketTask($queue->id);
             foreach ($tasks as $task) {
                 $pastTicketTasks[$queue->id][] = $task;
             }
         }
         $response->pastTicketTasks = $pastTicketTasks;
         $response->ticketId = $ticketId;
         $response->leaveHosDayArr = $leaveHosDayArr;
         $response->checkupTicket = $checkupTicket;
     }
 }
    $categoryIsEmpty = false;
    $i++;
    echo "<li>{$i}." . $healthProblem->displayTitle . ':';
    if ($healthProblem->isModeCombination()) {
        $childProblems = $healthProblem->getChildProblemList();
        foreach ($childProblems as $childProblem) {
            $lastAnswer = HealthRecordClient::getInstance()->getLastHealthAnswer($patientSignin->user->id, $childProblem->id);
            //iskong
            $lastAnswerValue = trim($lastAnswer->value);
            if ($lastAnswer->isNull() || $lastAnswerValue == '') {
                continue;
            }
            echo "{$childProblem->displayTitle}  " . $lastAnswer->getDisplayTitle() . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        }
    } else {
        $lastAnswer = HealthRecordClient::getInstance()->getLastHealthAnswer($patientSignin->user->id, $healthProblem->id);
        //iskong
        $lastAnswerValue = trim($lastAnswer->value);
        if ($lastAnswer->isNull() || $lastAnswerValue == '') {
            continue;
        }
        echo $lastAnswer->getDisplayTitle();
    }
    echo '</li>';
}
/*}}}*/
if ($categoryIsEmpty) {
    echo '<li>无内容</li>';
}
?>
</ul>
 /**
  *  获取一天中多填写一次心率血压测输入框
  */
 public function ajaxAddBloodPressureHeartRateOne($request, $response)
 {
     /*{{{*/
     $prevOrderNum = $request->ordernum;
     // 请求的填写第几次
     $response->ordernum = $prevOrderNum + 1;
     $response->dateStr = $request->datestr;
     $xueyaxinlvhealthRecordProblemCategory = HealthRecordClient::getInstance()->getProblemCategoryByName('血压心率组合');
     $response->problems = $xueyaxinlvhealthRecordProblemCategory->problems;
 }
}
$ticketId = '';
$ticketId = NfsAuditClient::getInstance()->getMaxTaskTicketId($owner->user->id, 'User', 'HealthDiary');
if (empty($ticketId) == false) {
    $diaryUrl = $router->urlfor('healthrecord/nextdiary', array('ticketId' => $ticketId));
    $diaryUrl = "<a href='{$diaryUrl}' target='_blank'>健康日记</a>";
}
$ticketId = '';
$ticketId = NfsAuditClient::getInstance()->getMaxTaskTicketId($owner->user->id, 'User', 'CheckupAnswerSheet');
if (empty($ticketId) == false) {
    $checkupUrl = $router->urlfor('checkup/nextcheckupanswersheet', array('ticketId' => $ticketId));
    $checkupUrl = "<a href='{$checkupUrl}' target='_blank'>复查报告</a>";
}
//		$temporaryCheckupUrl = $router->urlfor('checkup/managetemporarytask',array('refid'=>$dpRef->id));
//		$temporaryCheckupUrl = "<a href='{$temporaryCheckupUrl}' target='_blank'>临时复查报告</a>";
$userScheme = HealthRecordClient::getInstance()->getPatientSigninScheme($owner->id);
if ($userScheme->isNull() == false) {
    $healthrecordSchemeUrl = "管理项目方案:<a href=" . $router->urlfor('followup/showuserscheme', array('schemeid' => $userScheme->id, 'patientsigninid' => $owner->id)) . " target='_blank'>查看</a>/<a href=" . $router->urlfor('followup/generateuserscheme', array('patientsigninid' => $owner->id)) . " target='_blank'>编辑</a>";
}
if ($owner->isPayed() || $owner->hasPaid()) {
    $workSheetUrl = $router->urlfor("followup/worksheetlist", array('customername' => $followupCustomer->customerName, 'customerid' => $followupCustomer->id, 'auditorid' => 'all'));
    $workSheetUrl = "<a href='{$workSheetUrl}' target='_blank'>电话历史</a>";
    $workNoteUrl = $router->urlfor("worknote/listofcustomer", array('customerid' => $followupCustomer->id));
    $workNoteUrl = "<a href='{$workNoteUrl}' target='_blank'>新工作单列表</a>";
    $reportUrl = $router->urlfor('followup/followupreportlist', array('signinId' => $owner->id));
    $reportUrl = "<a href='{$reportUrl}' target='_blank'>月总结列表</a>";
    $trackSetUpUrl = $router->urlfor("track/showaddtrack4customer", array('customerId' => $followupCustomer->id));
    $trackSetUpUrl = "<a href='{$trackSetUpUrl}' target='_blank'>环节设置</a>";
    $trackExecuteUrl = $router->urlfor("track/customertracklist", array('customerId' => $followupCustomer->id));
    $trackExecuteUrl = "<a href='{$trackExecuteUrl}' target='_blank'>环节执行</a>";
}
	    <!--start scenter-form-list-->
	    <div class="clearfix scenter-form-list">
	      <label class="fl"><?php 
echo $healthProblem->title;
?>
:</label>
	      <span class="fl">
		<textarea id="health-unwell-area" name="vars[hp][<?php 
echo $healthProblem->id;
?>
]" class="scenter-form-textForbody p5 musthaveone" value="<?php 
echo isset($v) ? $v : '';
?>
"><?php 
echo isset($v) ? $v : '';
?>
</textarea>
		<p class="pt5 pb5"><span class="exp-unwell cp exp"><img src="http://i1.hdfimg.com/userspace/images/face-smile.gif" /><span class="vm">表情</span></span><span class="gray2 f12 pl20">如出现<span class="black"><?php 
echo HealthRecordClient::getInstance()->getUserHealthProblemRelationDesc($user->id);
?>
</span>等</span></p>
		
		 </span>
	      </div>
	    <!--end scenter-form-list-->
<?php

if (false == empty($signinProblems)) {
    foreach ($signinProblems as $signinProblem) {
        $value = '';
        $answerList = HealthRecordClient::getInstance()->getLastHealthAnswerList($patientSignin->user->id, array($signinProblem->id));
        //	$answerList = HealthRecordClient::getInstance()->getAnswers4Signin($patientSignin->user->id, $signinProblem->id, HealthRecordAnswer::MAX_SIGNIN_ANSWERS_COUNT);
        foreach ($answerList as $answer) {
            if ($answer->isNull()) {
                continue;
            }
            $value = $answer->value;
            break;
        }
        if (empty($answerList)) {
            continue;
        }
        //答案为空不展示
        switch ($signinProblem->mode) {
            case HealthRecordProblem::MODE_NUMBERIC:
                echo "<li><span class='fyhei'>{$signinProblem->title}:</span>";
                echo "{$value}{$signinProblem->unit}</li>";
                break;
            case HealthRecordProblem::MODE_TEXT:
                echo "<li><span class='fyhei'>{$signinProblem->title}:</span>";
                echo "{$value}{$signinProblem->unit}</li>";
                break;
            case HealthRecordProblem::MODE_RADIO:
                echo "<li><span class='fyhei'>{$signinProblem->title}:</span>";
                foreach ($signinProblem->healthRecordProblemOptions as $healthRecordProblemOption) {
                    if ($healthRecordProblemOption->id == $value) {
 public function followupStateSummary($request, $response)
 {
     /*{{{*/
     $ownerId = $request->ownerid;
     $owner = DAL::get()->find('FollowupOwner', $ownerId);
     $response->owner = $owner;
     $startTime = $request->starttime;
     $response->startTime = $startTime;
     $endTime = $request->endtime;
     $response->endTime = $endTime;
     $search = $request->search;
     if (isset($search)) {
         $response->search = $search;
         $res = FollowupSchemeClient::getInstance()->getSchemeTask4StateSummary($owner->id, $startTime, $endTime);
         $response->schemeTaskList = $res['schemetasklist'];
         $response->schemeList = $res['schemelist'];
         $response->childCategoryList = $res['childcategorylist'];
         $response->parentCategoryList = $res['parentcategorylist'];
         $bloodFatHistoryList = PatientCaseHistoryClient::getInstance()->getCaseHistory4StateSummary('血脂', $owner->user->id, $startTime, $endTime);
         $response->bloodFatArr = $this->processBloodFatData($bloodFatHistoryList);
         $response->bloodJsonArr = HealthRecordClient::getInstance()->getBloodJsonData4StateSummaryChart($owner->user->id, $startTime, $endTime);
         $response->bloodGlucoseJsonArr = HealthRecordClient::getInstance()->getBloodGlucoseJsonData4StateSummaryChart($owner->user->id, $startTime, $endTime);
         $response->heartRateJson = HealthRecordClient::getInstance()->getAnswerJsonData4StateSummaryChart($owner->user->id, '心率', $startTime, $endTime);
         $response->userMedicineRefList = HealthRecordClient::getInstance()->getValidMedicineProblemUserRefByUserId($owner->user->id);
     }
 }
 public function simpleBingshiOfCustomerPost($request, $response)
 {
     /*{{{*/
     DBC::requireNotEmptyString($request->followupcustomerid, "FollowupCustomerID 不能为空!");
     // wenda
     $sheets = $request->sheets;
     $customer = DAL::get()->find("FollowupCustomer", $request->followupcustomerid);
     WenDaClient::getInstance()->processAnswerSheets($sheets, $customer->getBindUser(), $this->auditor->user->id);
     // healthrecordproblem 吸烟, 身高体重,
     $values = $request->pbs;
     HealthRecordClient::getInstance()->batchAddAnswer4Initial($customer->userId, $values);
     echo "修改成功";
     return parent::DIRECT_OUTPUT;
 }