Ejemplo n.º 1
0
	public function addBingli($request, $response)
	{
		$data = $request->getUnSafeData('attachment');
        $data['title'] = Request::filter($data['title']);
        $data['title02'] = Request::filter($data['title02']);
        if(isset($data['title01']))
        {
            $data['title01'] = Request::filter($data['title01']);
        }
		$type = isset($data['type']) ? Request::filter($data['type']) : PatientAttachment::TYPE_OTHER;
		$fileType = isset($data['fileType']) ? Request::filter($data['fileType']) : 0;
		$content = isset($data['content']) ? $data['content'] : '';
		$timeYear = $request->getRequest('time_year', '');
		$timeMonth = $request->getRequest('time_month', '');
		$timeDay = $request->getRequest('time_day', '');
		if($timeYear && $timeMonth && $timeDay)
			$checkTime = XDateTime::createXDateTime($timeYear, $timeMonth, $timeDay);
		else
			$checkTime = XDateTime::today();
		
		$title1 = '';
		if(isset($data['title01']) && $data['title01'])
		{
			$tmp = '';
			if($type == PatientAttachment::TYPE_YINGXIANG)
				$tmp = '检查部位:';
			else if($type == PatientAttachment::TYPE_BINGLI)
				$tmp = '病理标本:';
			$title1 = $tmp.$data['title01']."\n";
		}
		$title2 = '';
		if(isset($data['title02']) && $data['title02'])
		{
			$title2 = '检查医院:'.$data['title02']."\n";
		}
		$title = $title1.$title2.$data['title'];
		// 传入默认的patientid
		$pa = BingLiClient::getInstance()->addBingLi($this->_newUser->id, PatientAttachment::DEFAULT_PATIENTID, $title, $type, $fileType, $content, $checkTime);
		$typeName = PatientAttachment::$typeList[$type];
		echo "<script>parent.myAttach('el_my_attachment', true);</script>";
		exit();
	}
Ejemplo n.º 2
0
    public function medicineList($request, $response)
    {/*{{{*/
        $now = XDateTime::now();
        $year = (int)$request->y;
        $year = ($year > 0) ? $year : $now->getYear();
        $month = (int)$request->m;
        $month = ($month > 0) ? $month : $now->getMonth();
        $user = $this->user;
        $curDateTime = XDateTime::createXDateTime($year, $month, 1);
        $response->curDateTime = $curDateTime;
        $dayNumber = XCalender::getNumberOfDays($year, $month);
        $startTime = $curDateTime;
        $endTime = $curDateTime->addDay($dayNumber)->addSecond(-1);
        $calTable = XCalender::getCalTable($year, $month);
        $response->calTable = $calTable;

        $hasAnswerMedicineList = MedicineClient::getInstance()->getHasAnswerMedicineList($user->id, $startTime->toShortString(), $endTime->toShortString());
        $response->medicineList = $hasAnswerMedicineList;

        $medicineId = ($request->medicineid == null)?key($hasAnswerMedicineList):$request->medicineid;
        $response->curMedicineId = $medicineId;

        $answerInfos = array();
        if(empty($medicineId) == false)
        {
            $answers = MedicineClient::getInstance()->getAnswerList($user->id, $startTime->toShortString(), $endTime->toShortString(), array($medicineId));
            foreach($answers as $answer)
            {
                $doTimeIndex = (int)$answer->doTime->getDay();  
                $answerInfos[$doTimeIndex] = $answer; 
            }
        }
        $response->answerInfos = $answerInfos;

        $useMedicineQuestionCategory = DAL::get()->find_by_name('QuestionCategory','用药');
        $childs = $useMedicineQuestionCategory->getChildCategories();
        $childIds = (is_array($childs)) ? array_keys($childs) : array();
        $childIds[] = $useMedicineQuestionCategory->id;
        $caseHistories = PatientCaseHistoryClient::getInstance()->getCaseHistoryListByCate($childIds,$user->id,$startTime,$endTime);
        $response->caseHistories = $caseHistories;
    }/*}}}*/
Ejemplo n.º 3
0
	public static function getCalTable($year, $month)
	{
        $firstDate = XDateTime::createXDateTime($year, $month, 1);
    	$firstDateIndex = (int)date('N', $firstDate->getTime());
        $firstDateIndex = $firstDateIndex - 1;
        $calTableCellNum = ($firstDateIndex > 2) ? self::CAL_TABLE_CELLS_BIG : self::CAL_TABLE_CELLS_SMALL;
        $tableCells = array();
        $dayNumber = self::getNumberOfDays($year, $month);
        //var_dump($firstDateIndex, $calTableCellNum, $dayNumber);
        $dayIndex = 0; 
        for($i=0; $i<$calTableCellNum; $i++)
        {
            if(($i >= $firstDateIndex && $i < $dayNumber) || ($i >= $dayNumber && $dayIndex < $dayNumber))
            {
                $dayIndex += 1;
                $tableCells[] = $dayIndex;
            }
            else
            {
                $tableCells[] = '';
            }
        }
        return $tableCells;
	}
Ejemplo n.º 4
0
	public function addBingli($request, $response)
	{/*{{{*/
        $data = $request->getUnSafeData('attachment');

        $data['title'] = Request::filter($data['title']);
        $data['title02'] = Request::filter($data['title02']);
        if(isset($data['title01']))
        {
            $data['title01'] = Request::filter($data['title01']);
        }
		$type = isset($data['type']) ? Request::filter($data['type']) : PatientAttachment::TYPE_OTHER;
		$fileType = isset($data['fileType']) ? Request::filter($data['fileType']) : 0;
		$content = isset($data['content']) ? $data['content'] : '';
		$timeYear = $request->getRequest('time_year', '');
		$timeMonth = $request->getRequest('time_month', '');
		$timeDay = $request->getRequest('time_day', '');
		if($timeYear && $timeMonth && $timeDay)
			$checkTime = XDateTime::createXDateTime($timeYear, $timeMonth, $timeDay);
		else
			$checkTime = XDateTime::today();
		
		$title1 = '';
		if(isset($data['title01']) && $data['title01'])
		{
			$tmp = '';
			if($type == PatientAttachment::TYPE_YINGXIANG)
				$tmp = '检查部位:';
			else if($type == PatientAttachment::TYPE_BINGLI)
				$tmp = '病理标本:';
			$title1 = $tmp.$data['title01']."\n";
		}
		$title2 = '';
		if(isset($data['title02']) && $data['title02'])
		{
			$title2 = '检查医院:'.$data['title02']."\n";
		}
		$title = $title1.$title2.$data['title'];
		// 传入默认的patientid
        if($this->_newUser->isNull())
        {
            $this->_newUser = DAL::get()->find('user', PatientAttachment::DEFAULT_USERID);
        }
        $user = $this->_newUser;
        $patientId = $request->patientId;
        if(empty($patientId) || $patientId == "all")
        {
            $patientId = PatientAttachment::DEFAULT_PATIENTID;
        }
        else
        {
            //传过来patient以后,要用patient的user
            $patient = DAL::get()->find('Patient', $patientId);
            $patientId = $patient->id;
            $user = $patient->user;
        }
        $hospitalId = $request->hoskey;
        $date = $request->date;
        $hospitalName = $request->hospitalName;
        $facultyName = $request->facultyName;
        $itemName = trim($request->itemName);
        $hospitalId   = isset($hospitalId)?$hospitalId:0;
        $checkTime    = isset($date)?$date:$checkTime;
        $hospitalName = isset($hospitalName)?$hospitalName:'';
        $facultyName  = isset($facultyName)?$facultyName:'';
        $itemName     = isset($itemName)?$itemName:'';
		$pa = BingLiClient::getInstance()->addBingLi($user->id, $patientId, $title, $type, $fileType, $content, $checkTime, '', $hospitalName, $facultyName, $itemName, $hospitalId);
        $patientAttachmentDto = BingLiDto::createPatientAttachmentDto($pa->id, $hospitalId, $patientId);
        AskSessionInfo::addPatientInfo(NodeObj::NODE_DEFINE_ATTACHMENT, $patientAttachmentDto);
		$typeName = PatientAttachment::$typeList[$type];
        //复查项目id
		$questionCategoryId = $request->questionCategoryId;
		if(empty($questionCategoryId))
		{
			echo "<script>parent.myAttach('el_my_attachment', true, '".$patientId."');</script>";;
		}
		else
		{
			echo "<script>parent.myAttach('el_my_attachment$questionCategoryId', true, '".$patientId."');parent.addCheckupReport('$questionCategoryId', '$pa->id')</script>";;
		}		
        return parent::DIRECT_OUTPUT;
	}/*}}}*/
 private function doSavePatientInfo($request, $response)
 {
     /*{{{*/
     $signinId = $request->signinId;
     $patientSignin = DAL::get()->find('FollowupOwner', $signinId);
     $params = $request->vars;
     $params['birthday'] = XDateTime::createXDateTime($request->dateyear, $request->datemonth, $request->dateday)->toString();
     $patient = $patientSignin->patient;
     if ($patient->isNull() == false) {
         PatientClient::getInstance()->modifyInfo($patient->id, $params);
     }
 }