private function _getCaseDetail4Proposal($userId, Proposal $case) {/*{{{*/ $ref = DAL::get()->find_by_spaceid_and_patientid('doctorPatientRef', $userId, $case->patient->id); if ($ref instanceof DoctorPatientRef) { if (false == $case->isFinish()) { ProposalClient::getInstance()->markFinish($case); $ref = FlowClient::getInstance()->generateFlowOrAddItemToFlow($ref->space, $case->patient, $case); } return $ref; } return $case; }/*}}}*/