예제 #1
0
 public function saveOrder($request, $response)
 {
     /*{{{*/
     $bookingOrder = DAL::get()->mustFind('BookingOrder', $request->id);
     if ($bookingOrder->notification->isClose() || $bookingOrder->notification->isPending()) {
         die("执行单已经是取消状态,不能修改!");
     }
     $schedule = $request->schedule;
     $time = explode("_", $schedule);
     $date = XDateTime::valueOf($time[0]);
     $mae = array('str' => $time[1], 'hour' => $request->hour, 'minute' => $request->minute);
     if ($request->patientMobile) {
         PatientClient::getInstance()->modifyPatientMobile($bookingOrder->patient->id, $request->patientMobile);
     }
     $params = array('scheduleStr' => $time[1], 'adminRemark' => $request->adminRemark, 'address' => $request->address, 'smsModel' => $request->smsModel);
     BookingClient::getInstance()->saveOrder($request->id, $this->curInspector->user, $params, $date, $mae);
     $response->setRedirect($response->router->urlfor('booking/showorderdetail', array('orderId' => $request->id)));
 }
예제 #2
0
    private function modifyPatientInfo($request, $response)
    {/*{{{*/
        $patientNew = $patientInfo = DAL::get()->find('patient', $request->patientid);
        $patient = $request->patient;
        $feildNames = array('name', 'sex', 'province', 'city', 'idcard', 'paperstype', 'birthday', 'mobile', 'relation');
        /** 患者不存在,写入一条患者信息 */
        if ($patientNew->isNull()) {
            $patient['birthday'] = $request->dateyear."-".$request->datemonth."-".$request->dateday;
            $params = array();

            foreach($feildNames as $feildName)
            {
                $params[$feildName] = trim($patient[$feildName]);
            }
            $theSame = PatientClient::getInstance()->theSame($this->_newUser, $params, 'jiahao');
            if(false == $theSame)
            {
                $patientInfo = DAL::get()->find_by_fld_userid_and_name_and_sex_and_birthday_and_province_and_city_and_relation('patient', $this->_newUser->id, $params['name'], $params['sex'], $params['birthday'], $params['province'], $params['city'], $params['relation']);
                if(false == $patientInfo->isNull())
                {
                    return "该患者已经存在,请不要重复添加!";
                }
                $patientInfo = PatientClient::getInstance()->add($this->_newUser, $params);
            }
            else
            {
                $patientInfo = DAL::get()->find('patient', $theSame);
            }
        } 
        else if(false == empty($patient)) 
        {
            $info = array();
            foreach($feildNames as $feildName)
            {
                if($feildName == 'birthday' && $request->dateyear && $request->datemonth && $request->dateday)
                {
                    $patient['birthday'] = $patient['dateyear']."-".$patient['datemonth']."-".$patient['dateday'];
                    $info['birthday'] = trim($patient['birthday']);
                    continue;
                }
                if(array_key_exists($feildName, $patient)){
                    $info[$feildName] = $patient[$feildName];
                }
            }
            if (false == empty($info))
            {
                PatientClient::getInstance()->modifyInfo($patientNew->id , $info);
                //重新find拿最新实体
                $patientInfo =  DAL::get()->find('patient', $patientNew->id, true);
            }
        }

        return $patientInfo;
    }/*}}}*/
예제 #3
0
    public function index($request, $response)
    {
        $month = XDateTime::valueOf(date('Y-m-d',(strtotime(XDateTime::now()) - 86400*30)));
        $day = XDateTime::valueOf(date('Y-m-d',(strtotime(XDateTime::now()))));
        $threeDay = XDateTime::valueOf(date('Y-m-d',(strtotime(XDateTime::now()) - 86400*3)));

        $beijingHospital = array(
           '协和医院'=>1,
           '同仁医院'=>3,
           '301医院'=>335,
           '北医三院'=>142,
           '人民医院'=>21,
           '妇产医院'=>75,
           '儿童医院'=>24,
           '积水潭医院'=>34,
           '阜外医院'=>25,
           '宣武医院'=>55,
           '天坛医院'=>44,
           '北大肿瘤'=>148);

        $shanghaiHospital = array(
           '瑞金医院'=>424,
           '中山医院'=>420,
           '仁济医院'=>471,
           '华山医院'=>418,
           '新华医院'=>426,
           '长海医院'=>427,
           '上海第一'=>431,
           '红房子医院'=>416,
           '儿童医学中心'=>425,
           '上海九院'=>422,
           '五官科医院'=>419,
           '精神卫生中心'=>827);

        $guangdongHospital = array(
            '省人民医院'=>443,
            '省中医院'=>454,
            '中山一院'=>460,
            '中山二院'=>458,
            '中山三院'=>459,
            '广州市第一'=>446,
            '广医一院'=>453,
            '脑科医院'=>449,
            '广州儿童医院'=>447,
            '深圳北大医院'=>608);

        $otherAreaHospital = array(
            '天津总医院'=>487,
            '天津肿瘤'=>599,
            '天津血液病'=>1904,
            '华西医院'=>488,
            '四川省人民'=>507,
            '华西口腔'=>532,
            '江苏省人民'=>478,
            '南京鼓楼'=>497,
            '南京脑科'=>646,
            '武汉协和'=>494,
            '武汉同济'=>496,
            '湖北省人民'=>530);
        $otherAreaHospitalAddress = array(
            '天津总医院'=>'tianjin',
            '天津肿瘤'=>'tianjin',
            '天津血液病'=>'tianjin',
            '华西医院'=>'sichuan',
            '四川省人民'=>'sichuan',
            '华西口腔'=>'sichuan',
            '江苏省人民'=>'jiangsu',
            '南京鼓楼'=>'jiangsu',
            '南京脑科'=>'jiangsu',
            '武汉协和'=>'hubei',
            '武汉同济'=>'hubei',
            '湖北省人民'=>'hubei');

        $hospitalArray = array_merge($beijingHospital, $shanghaiHospital);
        $hospitalArray = array_merge($hospitalArray, $guangdongHospital);
        $hospitalArray = array_merge($hospitalArray, $otherAreaHospital);

        //todo 移到服务层
        $hospitalDoctorCount = PlussignChannelClient::getInstance()->getDoctorCountByHospital($hospitalArray);

        $beijingCount = PlussignChannelClient::getInstance()->getDoctorCountByArea('北京');//北京地区开通加号医生总数目
        $shanghaiCount = PlussignChannelClient::getInstance()->getDoctorCountByArea('上海');
        $guangdongCount = PlussignChannelClient::getInstance()->getDoctorCountByArea('广东');

        $bjHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','北京','');//北京地区各个科室开通加号医生数目
        $shHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','上海','');
        $gdHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','广东','');
        $otherHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','其它地区','');
        if(isset($bjHospitalFactory['传染病科']))
        {
            unset($bjHospitalFactory['传染病科']);
        }
        if(isset($gdHospitalFactory['传染病科']))
        {
            unset($gdHospitalFactory['传染病科']);
        }
        if(isset($shHospitalFactory['传染病科']))
        {
            unset($shHospitalFactory['传染病科']);
        }

        $doctorNumber = PlussignChannelClient::getInstance()->getPlusSignDoctorCount();//全国开通加号医生总数目
        $patientNumber = SpaceClient::getInstance()->getPlusSignPatientCount();
        $otherCount = $doctorNumber-$beijingCount-$shanghaiCount-$guangdongCount;//其它地区开通加号医生总数目
        //预约成功患者
        $patientOrderList = PatientClient::getInstance()->getPatientOrderList(6);
        $doctorOrderList = BookingClient::getInstance()->getNewBookingContractList();

        $response->bjHospital = $beijingHospital;
        $response->shHospital = $shanghaiHospital;
        $response->gdHospital = $guangdongHospital;
        $response->otHospital = $otherAreaHospital;
        $response->otAreaHospital = $otherAreaHospitalAddress;
        $response->hospitalDoctorCount = $hospitalDoctorCount;

        $response->beijingCount = $beijingCount;
        $response->shanghaiCount = $shanghaiCount;
        $response->guangdongCount = $guangdongCount;

        $response->bjHospitalFactory = $bjHospitalFactory;
        $response->shHospitalFactory = $shHospitalFactory;
        $response->gdHospitalFactory = $gdHospitalFactory;
        $response->otherHospitalFactory = $otherHospitalFactory;

        $response->doctorNumber = $doctorNumber;
        $response->patientNumber = $patientNumber;
        $response->otherCount = $otherCount;
        $response->patientOrderList = $patientOrderList;
        $response->doctorOrderList = $doctorOrderList;
		$response->type = 'index'; //返回页面类型,暂时用于控制二级导航
    }
 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);
     }
 }
예제 #5
0
 private function addPatient($userId, $name, $birthday, $sex, $province, $city, $relation, $mobile)
 {/*{{{*/
     $user = DAL::get()->find('user', $userId);
     if ($user->isNull())
     {    
         $this->setErrorCode(107);
         return false;
     }    
     $errorcode = $this->checkPatientInfo($name, $sex, $relation, $province, $city, $birthday, $mobile);
     if($errorcode != 0 && $errorcode != 110)
     {
         $this->setErrorCode($errorcode);
         return false;
     }
     $birthday = date('Y-m-d',$birthday);
     $params = array(
         'name' => $name,
         'sex' => $sex,
         'relation' => $relation,
         'province' => $province,
         'birthday' => $birthday,
         'city' => $city,
         'mobile' =>$mobile,
     );
     $patient = PatientClient::getInstance()->add($user, $params);
     return $patient;
 }/*}}}*/
예제 #6
0
    public function index($request, $response)
    {/*{{{*/
        if (false == $this->isFromNotice())
        {
            $next = 'http://www.haodf.com';
            if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI']))
            {
                $next = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
            }
            $refer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'http://www.haodf.com';
            $response->setRedirect('http://'.URL_PREFIX.'jiahao.haodf.com/notice.htm?refer='.urlencode($refer).'&next='.urlencode($next));
            return parent::DIRECT_OUTPUT;
        }
        $month = XDateTime::valueOf(date('Y-m-d',(strtotime(XDateTime::now()) - 86400*30)));
        $day = XDateTime::valueOf(date('Y-m-d',(strtotime(XDateTime::now()))));
        $threeDay = XDateTime::valueOf(date('Y-m-d',(strtotime(XDateTime::now()) - 86400*3)));
        $oneYear = XDateTime::valueOf(date('Y-m-d',(strtotime(XDateTime::now()) - 86400*30*12)));

        $beijingHospital = array(
           '协和医院'=>1,
           '同仁医院'=>3,
           '301医院'=>335,
           '北医三院'=>142,
           '人民医院'=>21,
           '妇产医院'=>75,
           '儿童医院'=>24,
           '积水潭医院'=>34,
           '阜外医院'=>25,
           '宣武医院'=>55,
           '天坛医院'=>44,
           '北大肿瘤'=>148);

        $shanghaiHospital = array(
           '瑞金医院'=>424,
           '中山医院'=>420,
           '仁济医院'=>471,
           '华山医院'=>418,
           '新华医院'=>426,
           '长海医院'=>427,
           '上海第一'=>431,
           '红房子医院'=>416,
           '儿童医学中心'=>425,
           '上海九院'=>422,
           '五官科医院'=>419,
           '精神卫生中心'=>827);

        $guangdongHospital = array(
            '省人民医院'=>443,
            '省中医院'=>454,
            '中山一院'=>460,
            '中山二院'=>458,
            '中山三院'=>459,
            '广州市第一'=>446,
            '广医一院'=>453,
            '脑科医院'=>449,
            '广州儿童医院'=>447,
            '深圳北大医院'=>608);

        $otherAreaHospital = array(
            '天津总医院'=>487,
            '天津肿瘤'=>599,
            '天津血液病'=>1904,
            '华西医院'=>488,
            '四川省人民'=>507,
            '华西口腔'=>532,
            '江苏省人民'=>478,
            '南京鼓楼'=>497,
            '南京脑科'=>646,
            '武汉协和'=>494,
            '武汉同济'=>496,
            '湖北省人民'=>530);
        $otherAreaHospitalAddress = array(
            '天津总医院'=>'tianjin',
            '天津肿瘤'=>'tianjin',
            '天津血液病'=>'tianjin',
            '华西医院'=>'sichuan',
            '四川省人民'=>'sichuan',
            '华西口腔'=>'sichuan',
            '江苏省人民'=>'jiangsu',
            '南京鼓楼'=>'jiangsu',
            '南京脑科'=>'jiangsu',
            '武汉协和'=>'hubei',
            '武汉同济'=>'hubei',
            '湖北省人民'=>'hubei');

        $hospitalArray = array_merge($beijingHospital, $shanghaiHospital);
        $hospitalArray = array_merge($hospitalArray, $guangdongHospital);
        $hospitalArray = array_merge($hospitalArray, $otherAreaHospital);

        $hospitalDoctorCount = PlussignChannelClient::getInstance()->getDoctorCountByHospital($hospitalArray);

        $beijingCount = PlussignChannelClient::getInstance()->getDoctorCountByArea('北京');//北京地区开通加号医生总数目
        $shanghaiCount = PlussignChannelClient::getInstance()->getDoctorCountByArea('上海');
        $guangdongCount = PlussignChannelClient::getInstance()->getDoctorCountByArea('广东');

        $bjHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','北京','');//北京地区各个科室开通加号医生数目
        $shHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','上海','');
        $gdHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','广东','');
        $otherHospitalFactory = PlussignChannelClient::getInstance()->getFacultyListByCondition('','其它地区','');
        if(isset($bjHospitalFactory['传染病科']))
        {
            unset($bjHospitalFactory['传染病科']);
        }
        if(isset($gdHospitalFactory['传染病科']))
        {
            unset($gdHospitalFactory['传染病科']);
        }
        if(isset($shHospitalFactory['传染病科']))
        {
            unset($shHospitalFactory['传染病科']);
        }

        $doctorNumber = PlussignChannelClient::getInstance()->getPlusSignDoctorCount();//全国开通加号医生总数目
        $patientNumber = SpaceClient::getInstance()->getPlusSignPatientCount();
        $otherCount = $doctorNumber-$beijingCount-$shanghaiCount-$guangdongCount;//其它地区开通加号医生总数目
        //预约成功患者
        $patientOrderList = PatientClient::getInstance()->getPatientOrderList(6);

        list($response->spacesOfNewContract, $response->newContracts) = BookingClient::getInstance()->getSpaceAndContract4newOpenBooking(20);

        $response->bjHospital = $beijingHospital;
        $response->shHospital = $shanghaiHospital;
        $response->gdHospital = $guangdongHospital;
        $response->otHospital = $otherAreaHospital;
        $response->otAreaHospital = $otherAreaHospitalAddress;
        $response->hospitalDoctorCount = $hospitalDoctorCount;

        $response->beijingCount = $beijingCount;
        $response->shanghaiCount = $shanghaiCount;
        $response->guangdongCount = $guangdongCount;

        $response->bjHospitalFactory = $bjHospitalFactory;
        $response->shHospitalFactory = $shHospitalFactory;
        $response->gdHospitalFactory = $gdHospitalFactory;
        $response->otherHospitalFactory = $otherHospitalFactory;

        $response->doctorNumber = $doctorNumber;
        $response->patientNumber = $patientNumber;
        $response->otherCount = $otherCount;
        $response->patientOrderList = $patientOrderList;
		$response->type = 'index'; //返回页面类型,暂时用于控制二级导航
    }/*}}}*/
 private function doSavePatientInfo($request, $response)
 {
     /*{{{*/
     $signinId = $request->signinId;
     $patientSignin = DAL::get()->find('FollowupOwner', $signinId);
     $params = $request->vars;
     $birthDate = $request->birthday;
     if (XDateTime::isDate($birthDate)) {
         $params['birthday'] = XDateTime::valueOf($birthDate)->toString();
     }
     $patient = $patientSignin->patient;
     if ($patient->isNull() == false) {
         PatientClient::getInstance()->modifyInfo($patient->id, $params);
     }
 }
예제 #8
0
    public function index($request,$response)
    {/*{{{*/
        /* bigpipe用来做切换,true表示关闭,以普通模式浏览 */
        $response->nobp = ($request->nobp == null) ? false : true;
        //搜索
        $response->searchWords = $this->getHotSearchWords();
        List($blueImage, $redImage) = $this->getHomeBigImage();
        $response->blueImage = $blueImage;
        $response->redImage = $redImage;
        //在线专家
        $response->onLineDoctorList = DoctorClient::getInstance()->getOnLineDoctor4HomePage();

        //按医院找大夫
        $provList = $this->getProvList();
        $provKeyList = $this->getProvKey();
        $hospitalIds = array();
        foreach ($provList as $p => $prov)
        {
            foreach ($prov as $h => $hospital)
            {
                $hospitalIds[] = $h;
            }
        }
        $response->hospitalList = DAL::get()->find('hospital', $hospitalIds);
        $response->provList = $provList;
        $response->provKeyList = $provKeyList;

                
        //咨询专家 咨询列表
        $response->doctorPatientSets = $this->getFlowList4HomePage(self::THREADCATEGORY_COUNT, self::THREAD_COUNT);
        $response->statistics = SpaceClient::getInstance()->getStatistics();

        //咨询专家 电话咨询列表
		$recommendDoctorList = PaymentClient::getInstance()->getRecDoctorList4HomePage(10, 3);
        $response->recommendDoctorList = $recommendDoctorList; 
        $spaceUserIds = $doctorIds = array();
        foreach ($recommendDoctorList as $facultyInfo)
        {
            $facultyDoctorInfo = isset($facultyInfo['doctor']) ? $facultyInfo['doctor'] : array();
            foreach ($facultyDoctorInfo as $doctor)
            {
                $spaceUserIds[] = $doctor->getSpace()->user->id;
                $doctorIds[] = $doctor->id;
            }
        }

		$productList = $lastOrders = array();
		if(!empty($spaceUserIds) && !empty($doctorIds))
		{
			//电话咨询产品
			$productList = ProductClient::getInstance()->getProductsBySpaceIds($spaceUserIds, array(ServiceDef::TYPE_TELORDER));
			//取最新订单
			$lastOrders = PaymentClient::getInstance()->getLatestServiceList($doctorIds);
		}
		$response->productList = $productList;
        $lastOrderGroupBySpace = array();
        foreach ($lastOrders as $lastOrder)
        {
            if ($lastOrder->getSpace() instanceof Space)
            {
                $lastOrderGroupBySpace[$lastOrder->getSpace()->id] = $lastOrder;
            } 
        }
        $response->lastOrderGroupBySpace = $lastOrderGroupBySpace;

        //预约加号
        $doctorNumber = PlussignChannelClient::getInstance()->getPlusSignDoctorCount();//全国开通加号医生总数目
        $patientNumber = SpaceClient::getInstance()->getPlusSignPatientCount();
        $patientOrderList = PatientClient::getInstance()->getPatientOrderList();
        $response->doctorNumber = $doctorNumber;
        $response->patientNumber = $patientNumber;	
        $response->patientOrderList = $patientOrderList;

        //分享经验
        $commentCount = DoctorCommentClient::getInstance()->getCommentCount();
        $response->thankListCount = isset($commentCount['letter']) ? $commentCount['letter'] : 0;
        $response->doctorCommentListCount = isset($commentCount['comment']) ? $commentCount['comment'] : 0;

        $expList = DAL::get()->find_all_for_top('cureexp', 4);
        $response->expList = $expList;

        $thankList = DAL::get()->find_all_for_top('curethankletter', 4);
        $response->thankList = $thankList;        

        //出诊 停诊信息
        $response->hospitalAnnounceList = HospitalClient::getInstance()->getHospitalAnnounceList4HomePage(3);
        $response->cmslinkList = CmsClient::getInstance()->getCmsLinkList(self::CMS_COUNT);

        //好大夫动态
        $response->latestList = SpaceLogClient::getInstance()->getLatestList(self::LAST_COUNT);
        $response->images = $this->_images;

        //礼物动态
        $spaceId = 0;
        $result = PresentClient::getInstance()->showPresentBanner($spaceId, 12, $request->from, array(), false);
        $response->presentOrders = $result['presentOrders'];

        //最新专家文章
        $limit = self::ARTICLE_COUNT - substr_count(Place::getPlaceContent('haodf_index','wenzhang_url','onlyone'), '<li>');
        $articleList = ArticleClient::getInstance()->getArticleList4Index($limit);
        $response->articleList = $articleList;
    }/*}}}*/
 public function ajaxSearchUser($request, $response)
 {
     /*{{{*/
     $userName = XString::convertToGbk($request->userName);
     $patientName = XString::convertToGbk($request->patientName);
     $patientMobile = $request->patientMobile;
     $pageId = (int) $request->pageId;
     $pageSize = (int) $request->pageSize;
     $startNumber = ($pageId - 1) * $pageSize;
     $response->pageId = $pageId;
     $response->pageSize = $pageSize;
     $userList = array();
     if ($userName) {
         $userList[] = DAL::get()->find_all_by_fld_UserName('User', $userName);
     }
     if ($patientName) {
         $userList[] = UserClient::getInstance()->getUsersByPatientRealName($patientName);
     }
     if ($patientMobile) {
         $patientMobileUserIds = PatientClient::getInstance()->getUserIdsByphoneNumber('Patient', $patientMobile);
         if (false == empty($patientMobileUserIds)) {
             $userList[] = DAL::get()->find('User', $patientMobileUserIds);
         }
     }
     $serviceOrderList = array();
     $newUserList = array();
     foreach ($userList as $key => $userValueList) {
         foreach ($userValueList as $userId => $user) {
             $newUserList[$userId] = $user;
         }
     }
     $response->totalPage = (int) ceil(count($newUserList) / $pageSize);
     $newUserList = array_slice($newUserList, $startNumber, $pageSize, true);
     if (false == empty($newUserList)) {
         $serviceOrderList = DAL::get()->find_all_by_userids_and_status('ServiceOrder', array_keys($newUserList), array(ServiceOrder::STATUS_NOPAY));
     }
     $response->newUserList = $newUserList;
     $response->serviceOrderList = $serviceOrderList;
 }
    /**
        * @brief 提交二维码诊后报到申请
        * @author zjj 
        * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/patientsignin_patientSignin4QRCode?name=TestDay&sex=0&relation=0&birthday=2014-01-18&city=北京&province=北京&xdebug=1
        *
        * @param $name
        * @param $sex
        * @param $birthday
        * @param $province
        * @param $city
        * @param $diseaseName
        * @param $hospitalCaseNO
        * @param $idcard
        * @param $spaceId
        * @param $diseaseId
        *
        * @return array('msg')
     */
    public function patientSignin4QRCode($name, $sex, $birthday, $province, $city, $diseaseName, $hospitalCaseNO, $idcard, $spaceId, $diseaseId, $patientId) 
    {/*{{{*/
        if ($diseaseName == '')
        {
            $this->setErrorCode(802);
            return 0;
        }

        if ($hospitalCaseNO == '')
        {
            $this->setErrorCode(803);
            return 0;
        }

        $disease = DAL::get()->find('Disease', $diseaseId);
        if ($disease->isNull())
        {
            $this->setErrorCode(804);
            return 0;
        }

        $user = DAL::get()->find('user', $this->currentUserId);
        if ($user->isNull())
        {
            $this->setErrorCode(178);
            return 0;
        }

        if($idcard != '')
        {
            if(15 == strlen($idcard))
            {
                $idcard = IdCard::idcard_15to18($idcard);
            }

            if(false == IdCard::idcard_checksum18($idcard))
            {
                $this->setErrorCode(312);
                return 0;
            }
        }


        if ($patientId != '')
        {
            $patient = DAL::get()->find('Patient', $patientId);
            if ($patient->isNull())
            {
                $this->setErrorCode(309);
                return 0;
            }
        }else{
            $params = array();
            $params['name'] = $name;
            $params['sex'] = $sex;
            $params['relation'] = Patient::RELATION_SELF;
            $params['province'] = $province;
            $params['city'] = $city;
            $params['birthday'] = $birthday;
            $params['mobile'] = $user->mobile;
            $params['idcard'] = $idcard;
            $patient = PatientClient::getInstance()->add($user, $params);
        }


        $spaceId = $this->filterHttpUrlString($spaceId);
        $space = DAL::get()->find('Space', $spaceId);
        if ($space->isNull())
        {
            $this->setErrorCode(144);
            return 0;
        }

        $QRcodePatientSignin = DAL::get()->find_by_QRpatientSign('patientsignin', $space->id, $patient->id);
        $res = array();
        if(false == $QRcodePatientSignin->isNull())
        {
            if($QRcodePatientSignin->isUnaudited())
            {
                $res['msg'] = self::PATIENT_SIGNIN_RES_AUDIT;
            }
        }

        if (empty($res))
        {
            $signinId = PatientSigninClient::getInstance()->addQRCODEPatientSignin($space, $patient, $hospitalCaseNO, $diseaseName, $diseaseId);
            $newQRCodePatientSignin = DAL::get()->find('patientsignin', $signinId);
            if ($newQRCodePatientSignin->isNull())
            {
                $this->setErrorCode(801);
                return 0;
            }
            $disease = DAL::get()->find('disease', $diseaseId);
            PatientFileClient::getInstance()->createPatientHealthApply4QRCode($patient->id, $diseaseId, $disease->name);
            $res['msg'] = self::PATIENT_SIGNIN_RES_SUC;
        }
        $this->content = $res;
    }/*}}}*/
예제 #11
0
    public function newSetPatient($userId, $patientId, $name, $sex, $province, $city, $idcard, $paperstype, $birthday, $mobile, $relation)
    {/*{{{*/
        $user = DAL::get()->find('user', $userId);
        error_log('birthday:'.$birthday."\n",3,'/tmp/wap123.log');

		$request = new Request();
		if($request->os == 'ios' && $request->v == '2.1.0' && $paperstype == '0')
        {
            $birthday = substr($birthday, 0, 4)."-".substr($birthday, 4, 2)."-".substr($birthday, 6, 2);
        }
        else
        {
            $birthday = date('Y-m-d',$birthday);
        }
        if ($user->isNull())
        {
            $this->setErrorCode(107);
            return 0;
        }
        if(0 == $paperstype)
        {
            if(15 == strlen($idcard))
            {
                $idcard = IdCard::idcard_15to18($idcard);
            }

            if(false == IdCard::idcard_checksum18($idcard))
            {
                $this->setErrorCode(312);
                return 0;
            }
        }
        $patientNew = DAL::get()->find('patient', $patientId);
        if("" == trim($name))
        {
            $this->setErrorCode(176);
            return 0;
        }
        if("" == trim($birthday))
        {
            $this->setErrorCode(171);
            return 0;
        }
        if("" == trim($sex))
        {
            $this->setErrorCode(172);
            return 0;
        }
        if("" == trim($province))
        {
            $this->setErrorCode(173);
            return 0;
        }
        if("" == trim($city))
        {
            $this->setErrorCode(174);
            return 0;
        }
        if("" == trim($relation))
        {
            $this->setErrorCode(175);
            return 0;
        }
        if(false == XString::isMobile($mobile))
        {
            $this->setErrorCode(110);
            return 0;
        }
        /** 患者不存在,写入一条患者信息 */
        if ($patientNew->isNull()) {
            $birthday = $birthday;
            $params = array(
                'name' => trim($name),
                'sex' => trim($sex),
                'province' => trim($province),
                'city' => trim($city),
                'idcard' => trim($idcard),
                'paperstype'=> trim($paperstype),
                'birthday' => trim($birthday),
                'mobile' => trim($mobile),
                'relation' => trim($relation),
            );
            $theSame = PatientClient::getInstance()->theSame($user, $params, 'jiahao');
            if(false == $theSame)
            {
                $patientInfo = PatientClient::getInstance()->add($user, $params, 0, '', '', 'jiahao');
            }
            else
            {
                $patientInfo = DAL::get()->find('patient', $theSame);
            }
        } 
        else 
        {
            $info = array();
            $info['paperstype'] = trim($paperstype);
            $info['idcard'] = trim($idcard);
            $info['name'] = trim($name);
            $info['mobile'] = trim($mobile);
            //svc方法中会对info中有的字段会被重新赋值。我们不会更改省和市的字段(客户端获取信息时省市拼接一个字段返回,所以无法区别省市回传)
          //  $info['province'] = trim($province);
          //  $info['city'] = trim($city);
            $info['birthday'] = trim($birthday);
            if (false == empty($info))
            {
                PatientClient::getInstance()->modifyInfo($patientNew->id , $info);
            }
            $patientInfo = $patientNew;
        }
        $patient = array();
        $patient['patientId'] = $patientInfo->id;
        $this->content = $patient;
    }/*}}}*/
예제 #12
0
 public function bindPatient($request, $response)
 {/*{{{*/
     $order = DAL::get()->find('telorder', $request->orderId);
     DBC::requireTrue($order->owner->relatedObject->id == $this->_newUser->id, '无权访问此页');
     $patientInfos = $request->patient;
     if (isset($patientInfos['id']) && $request->patient['id'] > 0)
     {
         $patient = DAL::get()->find('patient', $request->patient['id']);
     }
     else
     {
         $birthday = "{$request->dateyear}-{$request->datemonth}-{$request->dateday}";
         $patientInfo['name'] = $request->patient['name'];
         $patientInfo['sex'] = $request->patient['sex'];
         $patientInfo['province'] = $request->patient['province'];
         $patientInfo['city'] = $request->patient['city'];
         $patientInfo['birthday'] = $birthday;
         $patientInfo['relation'] = $request->patient['relation'];
         $patientInfo['mobile'] = $request->patient['mobileOrEmail'];
         $patient = PatientClient::getInstance()->add($order->owner->relatedObject, $patientInfo);
     }
     TelOrderClient::getInstance()->bindPatient($order, $this->_newUser, $patient);
     $response->setRedirect($response->router->urlfor('payment/paymessage', array('orderId'=>$order->id)));
     return parent::DIRECT_OUTPUT;
 }/*}}}*/
예제 #13
0
    public function choosePatient($request, $response)
    {/*{{{*/
        $patientId = isset($request->patient['id'])?$request->patient['id']:'';
        $patient = DAL::get()->find('patient', $patientId);
        if($patient->isNull())
        {
            $patientParams = $request->patient;
            $patientParams['birthday'] = $request->dateyear."-".$request->datemonth."-".$request->dateday;
            $patientParams['mobile'] = $request->patient['mobileOrEmail'];
            $patient = PatientClient::getInstance()->add(UserClient::getInstance()->getCurrentUser(), $patientParams);
        }

        $doctorPatientRef = FlowClient::getInstance()->getValidFlowRef($request->spaceId, $patient->id);
        $this->getPatientSigninBySession($request);

        $space = DAL::get()->find('space', $request->spaceId);
        if(false == $this->isPatientSignin($space, $patient->id))
        {
            if('signinbeforelogin' == $request->from)
            {
                $request->patientId = $patient->id;
                $this->doPatientSignin($request, $response);
            }
            elseif($doctorPatientRef->isTreated())
            {
                $response->setRedirect($response->router->urlfor('user/patientsigninaftervisit', array('spaceId' => $request->spaceId, 'patientId' => $patient->id)));
            }
            else
            {
                $response->setRedirect($response->router->urlfor('user/patientsigninbeforevisit', array('spaceId' => $request->spaceId, 'patientId' => $patient->id)));
            }
        }
    }/*}}}*/
예제 #14
0
 private function getPatient($request, User $user)
 {/*{{{*/
     $patients = $user->patients;
     $patient = array_shift($patients);
     if (empty($patient))
     {
         $patient = $request->patient;
         $params = array(
             'name' => $patient['name'],
             'relation' => 0,
             'sex' => $patient['sex'],
             'age' => $patient['age'],
             'province' => $patient['province'],
             'city' => $patient['city'],
             'phone' => $user->phone,
             'mobile' => isset($user->mobile) ? $user->mobile : $patient['mobile']
         );
         return PatientClient::getInstance()->add($user, $params);
     }
     else
     {
         return $patient;
     }
 }/*}}}*/
 /** 显示患者上传的所有病例*/
 public function showPatientUploadAttachment($request, $response)
 {
     /*{{{*/
     $patientId = $request->patientId;
     $patientCaseId = $request->patientCaseId;
     $response->patientId = $patientId;
     $response->patientCaseId = $patientCaseId;
     $list = $this->getPatientCaseandBreadCrumbNavigation($patientCaseId, $patientId);
     $breadcrumbNavigation = $list['breadcrumbNavigation'];
     $patient = DAL::get()->find('patient', $patientId);
     if (false == $patient->isNull()) {
         list($patientAttachmentList, $pageInfo) = PatientClient::getInstance()->getPatientAttachmentList($patient, $request->pageId, 10);
         $response->patientAttachmentss = $patientAttachmentList;
         $url = "/adminpatient/showpatientuploadattachment?patientId={$patientId}&pageId=";
         $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace("{$url}"), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
     } else {
         $response->patientAttachmentss = array();
         $response->pageLink = '';
     }
     $response->breadcrumbNavigation = $breadcrumbNavigation;
 }
예제 #16
0
    public function newPhoneCallOrderWithMultiPatients($userId, $doctorId, $contractId, $phoneNumber, $content, $deviceType, $patientId, $name, $birthday, $sex, $province, $city, $relation, $payType)
    {/*{{{*/
        if (in_array($patientId, self::$patientIds))
        {
            $this->setErrorCode(1000);
            return 0;
        }
        if(false == XString::isMobile(trim($phoneNumber)))
        {
            $this->setErrorCode(110);
            return 0;
        }
        $product = DAL::get()->find('product', $contractId);
        if($product->isNull())
        {
            $this->setErrorCode(300);
            return 0;
        }
        //没有电话分成合同
        if($product->contract->isNull() || $product->contract->isInvalid())
        {
            $this->setErrorCode(333);
            return 0;
        }
        if("" == trim($content))
        {
            $this->setErrorCode(302);
            return 0;
        }
        $user = DAL::get()->find('user', $userId);
		if ($user->isNull() || $user->id == 0)
		{
            $this->setErrorCode(107);
            return 0;
        }
        $source = Intention::SRC_IOS;
        if(strtolower($deviceType) == 'iphone')
        {
            $source = Intention::SRC_IOS;
        }
        else if(strtolower($deviceType) == 'ipad')
        {
            $source = Intention::SRC_IPAD;
        }
        else if(strtolower($deviceType) == 'android')
        {
            $source = Intention::SRC_ANDROID;
        }
        $expectedtimeStr = "越快越好";
        //创建或更新patient
        if(0 == $patientId)
        {
            $birthday = date('Y-m-d',$birthday);
            if("" == trim($name))
            {
                $this->setErrorCode(176);
                return 0;
            }
            if("" == trim($birthday))
            {
                $this->setErrorCode(171);
                return 0;
            }
            if("" == trim($sex))
            {
                $this->setErrorCode(172);
                return 0;
            }
            if("" == trim($province))
            {
                $this->setErrorCode(173);
                return 0;
            }
            if("" == trim($city))
            {
                $this->setErrorCode(174);
                return 0;
            }
            if("" == trim($relation))
            {
                $this->setErrorCode(175);
                return 0;
            }
            $patientInfo = array();
            $patientInfo['name'] = $name;
            $patientInfo['sex'] = $sex;
            $patientInfo['province'] = $province;
            $patientInfo['city'] = $city;
            $patientInfo['birthday'] = $birthday;
            $patientInfo['relation'] = $relation;
            $patientInfo['mobile'] = $phoneNumber;
            $params = $patientInfo;
            $patient = PatientClient::getInstance()->add($user, $params);
        }
        else
        {
            $modifyPatientInfo = array();
            $modifyPatientInfo['mobile'] = $phoneNumber;
            $patientId = $patientId;
            $patient = DAL::get()->find('patient', $patientId);
            PatientClient::getInstance()->modifyInfo($patient->id , $modifyPatientInfo);
        }
        $intention = IntentionClient::getInstance()->add4Tel($product, $patient, $expectedtimeStr, $content, $source);
        $this->content = array('id' => $intention->id);
    }/*}}}*/
예제 #17
0
 public function addPatient($request, $response)
 {/*{{{*/
     $this->checkEmptyDiseaseInfos($response);
     $patientInfo = array();
     $birthday = "{$request->dateyear}-{$request->datemonth}-{$request->dateday}";
     $patientInfo['birthday'] = $birthday;
     $patientInfo['name'] = XString::convertUTF8ToGBK($request->patientname);
     $patientInfo['sex'] = $request->sex;
     $patientInfo['province'] = XString::convertUTF8ToGBK($request->province);
     $patientInfo['city'] = XString::convertUTF8ToGBK($request->city);
     $patientInfo['relation'] = $request->relation;
     $patientInfo['mobile'] = $request->mobile;
     $params = $patientInfo;
     $patientId = $request->existedPatientId;
     if($patientId)
     {
         PatientClient::getInstance()->modifyInfo($patientId, $params);
         $patient = DAL::get()->find('Patient', $patientId);
         AskSessionInfo::bindPatient($patient->id);
         AskSessionInfo::flushPatientInfos();
     }
     else if($this->user instanceof User)
     {
         $patient = PatientClient::getInstance()->add($this->user, $params);        
         AskSessionInfo::bindPatient($patient->id);
         AskSessionInfo::flushPatientInfos();
     }
     $response->setRedirect($response->router->urlfor('newcase/attachexperience'));
 }/*}}}*/
예제 #18
0
    public function saveOrderInfo($request, $response)
    {/*{{{*/
        DBC::requireTrue(isset($_SESSION['telOrderInfo']['productId']), '选择服务内容失效,请返回重新选择');
        $telOrderInfo = array();
        DBC::requireFalse(false == XString::isMobile($request->mobile), '您填写的手机号码格式不正确!');
        $cloneSession = $_SESSION;
        $_SESSION['telOrderInfo']['mobile'] = $request->mobile;
        $_SESSION['telOrderInfo']['productId'] = $request->productId;
        $_SESSION['telOrderInfo']['desc'] = XString::convertUTF8ToGBK($request->desc);
        $_SESSION['telOrderInfo']['disease'] = XString::convertUTF8ToGBK($request->disease);

        //监控日志 电话咨询病情描述为空的。疾病信息为空的 PAM-6749 djf
        $this->watchEmptyContent($request, $cloneSession);

        $mobile = $request->mobile; 
        if ($this->user->isNull()) 
        {
            //用户不存在,则创建user并且登录
            $res = UserClient::getInstance()->createRandUser($mobile);
            if($res['user'] == '')
            {
                $currentUrl = $response->router->urlfor('tel/telorderform', array('productId'=> $_SESSION['telOrderInfo']['productId']));
                $response->setRedirect($response->router->urlfor('user/login', array('forward' => $currentUrl)));
                return;                                                                       
            }
            //自动登录
            $this->user = $res['user'];
            UserClient::getInstance()->login($this->user->name, $res['password']);
            $_SESSION['user']['userName'] = $this->user->name;
            $_SESSION['user']['password'] = $res['password'];
        }
        $this->watchAndEmailUserInfo($request, $this->user);

        DBC::requireTrue(isset($_SESSION['telOrderInfo']['patientInfo']) || isset($_SESSION['telOrderInfo']['patientId']), '患者信息失效,请重新选择');
        $patientId = 0;
        if (isset($_SESSION['telOrderInfo']['patientId']) && is_numeric($_SESSION['telOrderInfo']['patientId']))
        {
            $patientId = $_SESSION['telOrderInfo']['patientId'];
        }
        if (isset($_SESSION['telOrderInfo']['patientInfos']))
        {
            foreach ($_SESSION['telOrderInfo']['patientInfos'] as $info)
            {
                $existedPatientId = $_SESSION['telOrderInfo']['existedPatientId'];
                if($existedPatientId)
                {
                    PatientClient::getInstance()->modifyInfo($existedPatientId, $info);
                    $patientId = $existedPatientId;
                }
                else
                {
                    $newPatient = PatientClient::getInstance()->add($this->user, $info);
                    if (isset($_SESSION['telOrderInfo']['patientId']) && $info['id'] == $_SESSION['telOrderInfo']['patientId'])
                    {
                        $patientId = $newPatient->id;
                    }
                }
            }
        }
        $response->setRedirect($response->router->urlfor('tel/newtelorder', array('patientId'=>$patientId)));
    }/*}}}*/
 public function modifySinglePatientInfo($request, $response)
 {
     /*{{{*/
     $patientId = $request->patientId;
     $patient = DAL::get()->find('Patient', $patientId);
     $params = array();
     $birthday = "{$request->dateyear}-{$request->datemonth}-{$request->dateday}";
     $params['name'] = $request->name;
     $params['sex'] = $request->patientSex;
     $params['paperstype'] = $request->paperstype;
     $params['idcard'] = $request->getRequest('idCard', '');
     $params['province'] = $request->province;
     $params['city'] = $request->city;
     $params['birthday'] = $birthday;
     $params['relation'] = $request->relation;
     $params['mobile'] = $request->mobile;
     $params['phone'] = $request->getRequest('phone', '');
     $params['backupPhone'] = $request->getRequest('backupPhone', '');
     PatientClient::getInstance()->modifyInfo($patient->id, $params);
     S3LogClient::getInstance()->add($this->curInspector, $patient->getLogable()->action(PatientLog::ACTION_MODIFY_PATIENT, $this->addPatientLogInfo($params, $patient)));
     $msg = "修改成功";
     $url = $response->router->urlfor('intention/showpatientdetail', array('patientId' => $patientId, 'simpleCheck' => $request->getRequest('simpleCheck', 0), 'msg' => $msg));
     $response->setRedirect($url);
 }
예제 #20
0
    private function getPatient($request)
    {/*{{{*/
        if (isset($request->patient['id']) && $request->patient['id'] == DoctorComment::NEED_PATIENT_FALSE)
        {
            return 0;
        }
        else if (isset($request->patient['id']) && $request->patient['id'])
        {
            $patient = DAL::get()->find('patient', $request->patient['id']);
            if ($patient instanceof Patient)
            {
                return $patient->id;
            }
        }
        else if ($this->curUser instanceof user)
        {
            $params = array(
                'name' => $request->patient['name'],
                'sex' => $request->patient['sex'],
                'relation' => $request->patient['relation'],
                'province' => $request->patient['province'],
                'birthday' => $request->dateyear.'-'.$request->datemonth.'-'.$request->dateday,
                'city' => $request->patient['city'],
                'mobile' => $request->patient['mobileOrEmail']
            );

            $patient = DAL::get()->find('Patient', $request->existedPatientId);
            if ($patient instanceof Patient && $patient->user->id == $this->curUser->id)
            {
                PatientClient::getInstance()->modifyInfo($patient->id, $params);
            }
            else
            {
                $patient = PatientClient::getInstance()->add($this->curUser, $params);
            }

            if ($patient instanceof Patient)
            {
                return $patient->id;
            }
        }

        return 0;
    }/*}}}*/
예제 #21
0
 public function addPatient($request, $response)
 {/*{{{*/
     $space = DAL::get()->find('space', $request->spaceid);
     DBC::requireFalse($space->isNull(), '找不到该医生,请确认医生id');
     $response->space = $space;
     $response->userId = $request->userid;
     $userId = $request->userid;
     $spaceId = $request->spaceid;
     $name = $request->name;
     $diseaseName = $request->diseaseName;
     $age = $request->age;
     $province = $request->province;
     $city = $request->city;
     $relation = $request->relation;
     $sex = $request->sex;
     $user = DAL::get()->find('user', $userId);
     $patient = PatientClient::getInstance()->addOrMergePatient($user, $name, "", $sex, $age, $province, $city, "", "", "", $relation);
     $url = $response->router->urlfor('weixin/finishsignin',  array('patientid'=>$patient->id, 'spaceid'=>$spaceId,'disease'=>$diseaseName));
     $response->setRedirect($url);
 }/*}}}*/
예제 #22
0
 public function success4Signin($request, $response)
 {
     $response->title = "提交申请成功";
     $attachIds = explode(',', $request->attachIds);
     $space = DAL::get()->find('space', $request->spaceId);
     $patient = DAL::get()->find('patient', $request->patientId);
     DBC::requireFalse($patient->isNull(), '无效的patientId');
     DBC::requireFalse($space->isNull(), '无效的spaceId');
     $mobile = isset($_SESSION['newSignin']['mobile']) ? ($_SESSION['newSignin']['mobile']) : '';
     $diseaseName = isset($_SESSION['newSignin']['diseaseName']) ? ($_SESSION['newSignin']['diseaseName']) : '';
     PatientClient::getInstance()->modifyPatientMobile($patient->id, $mobile);
     $canSignin = 0;
     $oldSignins = DAL::get()->find_all_by_spaceid_and_patientid_and_status('patientsignin', $space->id, $patient->id, PatientSignin::STATUS_UNAUDITED);
     if(empty($oldSignins))
     {
         $signinId = PatientSigninClient::getInstance()->addOrdinaryPatientSignin($space->id, $patient->id, array('diseaseName' => $diseaseName));
         $newQRCodePatientSignin = DAL::get()->find('patientsignin', $signinId);
         if ($newQRCodePatientSignin->isNull())
         {
             $this->_exit404();
             return;
         }
         PatientSigninClient::getInstance()->addPatientSigninHelpInfo($signinId, "", $attachIds, PatientSigninHelpInfo::TYPE_ATTACH);
         $canSignin = 1;
     }
     $response->space = $space;
     $response->canSignin = $canSignin;
     if (!session_id())
     {
         session_start();
     }
     session_unset();
     session_destroy();
 }
예제 #23
0
 /**
  * addOrder 
  * 
  * @param mixed $request 
  * @param mixed $response 
  * @author mq <*****@*****.**> 
  * @access public
  * @return void
  */
 public function addOrder($request, $response)
 {
     /*{{{*/
     $request->convertToGBK();
     $mobile = $request->buyerPhone;
     $product = DAL::get()->find('Product', $request->saId);
     DBC::requireFalse($product->isNull(), "产品不能为空");
     $user = $this->user;
     $patientId = 0;
     $patientId = $request->curPatientId4Tel;
     if (empty($patientId) && isset($request->patient['id'])) {
         $patientId = $request->patient['id'];
     }
     $rand = 0;
     //患者不存在情况,需创建患者
     if (empty($patientId)) {
         //用户不存在,则创建user并且登录
         if ($user->isNull()) {
             $rand = 1;
             setcookie("MyRand", "1", 0);
             $res = UserClient::getInstance()->createRandUser($mobile);
             $user = $res['user'];
             User::sendRegisterMsg($user->id);
             //自动登录
             UserClient::getInstance()->login($res['user']->name, $res['password']);
         }
         $patientInfo = array();
         $birthday = "{$request->dateyear}-{$request->datemonth}-{$request->dateday}";
         $patientInfo['name'] = $request->patient['name'];
         $patientInfo['sex'] = $request->patient['sex'];
         $patientInfo['province'] = $request->patient['province'];
         $patientInfo['city'] = $request->patient['city'];
         $patientInfo['birthday'] = $birthday;
         $patientInfo['relation'] = $request->patient['relation'];
         $patientInfo['mobile'] = $mobile;
         $params = $patientInfo;
         $patient = PatientClient::getInstance()->add($user, $params);
     } else {
         //用户不存在,则创建user并且登录
         $modifyPatientInfo = array();
         $existedPatientId = $request->existedPatientId;
         if (false == empty($existedPatientId)) {
             $modifyPatientInfo['name'] = $request->patient['name'];
             $modifyPatientInfo['sex'] = $request->patient['sex'];
             $modifyPatientInfo['province'] = $request->patient['province'];
             $modifyPatientInfo['city'] = $request->patient['city'];
             $birthday = "{$request->dateyear}-{$request->datemonth}-{$request->dateday}";
             $modifyPatientInfo['birthday'] = $birthday;
             $modifyPatientInfo['relation'] = $request->patient['relation'];
         }
         $modifyPatientInfo['mobile'] = $mobile;
         $patient = DAL::get()->find('patient', $patientId);
         PatientClient::getInstance()->modifyInfo($patient->id, $modifyPatientInfo);
     }
     //期望时间
     $expectedtimes = '';
     if ($request->expectedtime == 'other') {
         $expectedtimes = $request->expectedtimeInput;
     } else {
         $expectedtimes = $request->expectTimes;
     }
     $expectedtimeStr = "";
     if (false == empty($expectedtimes)) {
         foreach ($expectedtimes as $expectedtime) {
             $expectedtimeStr .= $expectedtime . ' ';
         }
     }
     $inconvenientTime = $request->inconvenientTime;
     if (false == empty($inconvenientTime)) {
         $expectedtimeStr .= '方便时间为:' . $request->inconvenientTime;
     }
     $src = Intention::SRC_WEB;
     $intention = IntentionClient::getInstance()->add4Tel($product, $patient, $expectedtimeStr, $request->diseaseDescription, $src, $request->disease);
     if ($intention->needPay()) {
         $response->setRedirect($response->router->urlfor('payment/showpaytype', array('sourceId' => $intention->id, 'sourceType' => "intention", 'rand' => $rand)));
     } else {
         $response->setRedirect($intention->getUrl());
     }
     return parent::DIRECT_OUTPUT;
 }
예제 #24
0
 public function addPatient($request, $response)
 {/*{{{*/
     $this->checkEmptyDiseaseInfos($response);
     $birthday = "{$request->dateyear}-{$request->datemonth}-{$request->dateday}";
     $patientInfo = array();
     $patientInfo['name'] = $request->patientName;
     $patientInfo['sex'] = $request->sex;
     $patientInfo['province'] = $request->province;
     $patientInfo['city'] = $request->city;
     $patientInfo['birthday'] = $birthday;
     $patientInfo['relation'] = $request->relation;
     $patientInfo['mobile'] = $request->mobile;
     $patientInfo['phone'] = $request->phone;
     $patientInfo['backupPhone'] = $request->backupPhone;
     $params = $patientInfo;
     if($this->_newUser->isNull())
     {
         throw new BizException("不能在未登录的情况下添加患者");
     }
     $patientId = $request->existedPatientId;
     if($patientId)
     {
         PatientClient::getInstance()->modifyInfo($patientId, $params);
         $patient = DAL::get()->find('Patient', $patientId);
     }
     else
     {
         $patient = PatientClient::getInstance()->add($this->_newUser, $params);
     }
     AskSessionInfo::bindPatient($patient->id);
     AskSessionInfo::flushPatientInfos();
     //   $askInfo = AskSessionInfo::getAskInfo();
     $treated = AskSessionInfo::getTreatedHospital();
     if(false == $treated)
     {
         $response->setRedirect($response->router->urlfor('newcase/askfinishpagenottreated'));
     }
     else
     {
         $response->setRedirect($response->router->urlfor('newcase/askfinishpage'));
     }
 }/*}}}*/
	public function askPost($request, $response)
	{/*{{{*/
        $preHostpital = $request->getRequest('case_prehospital', ''). " ".$request->getRequest('case_prekeshi', '');
        $isLogin = UserClient::getInstance()->isLogin();
        if (false == $isLogin)
        {
            $username = $request->patient['mobileOrEmail'];
            $password = $request->password;
            $this->_newUser = UserClient::getInstance()->register($username, $password);
            User::sendRegisterMsg($this->_newUser->id);
            $this->_newUser = UserClient::getInstance()->login($username, $password, false);
        }
        if ($this->_newUser->isNull())
        {
            throw new BizException('对不起,您的密码输入有误。建议您到好大夫在线取回密码');
        }

    	$spaceUserId = $request->getRequest('host_user_id', 0);
		$askSpace = DAL::get()->find('space', $spaceUserId);
		if ($askSpace->isNull())
		{
			$askSpace = DAL::get()->find('space', 0);
		}

        $options = array();
        $options['title'] = $request->getRequest('case_title', '');
        $options['disease'] = $request->getRequest('case_disease_tag', '');
        $options['prehospital'] = $preHostpital;
        $options['ExpireAction'] = $request->getRequest('case_expire_action');
        //post content; for unity
        $contents = "";
        foreach(IntentionContentsFix::$postRule as $id => $item)
        {
            $textAreaName =IntentionContentsFix::$textAreaNames[$id];
            $contents .= IntentionContentsFix::$postRule[$id]."\n".$request->$textAreaName;
        }
        $options['content'] = $contents;

		$options['allowSpaceReplyCount'] = '3';
		$options['attachmentIds'] = $request->getRequest('post_patient_attachment_ids', '');
        
		$caseTypeId = 0;
		$options['facultyId'] = $request->getRequest('host_user_faculty_id', 0);
		$out = array();
		$res = $this->_userIsAllowAsk($askSpace, $out, $response);
		if (false === $res) {
			return false;
		}
        $user = $this->_newUser;
        $patients = $user->patients;
        $patientInfos = array_shift($patients);
		if ($patientInfos == null || $patientInfos->isNull()) {
			$patient = $request->patient;
			if (empty($patient))
			{
                throw new BizException('系统忙,请重试');
			}

            $patient['birthday'] = $request->dateyear."-".$request->datemonth."-".$request->dateday;
            $params = array(
                'name' => $patient['name'],
                'sex' => $patient['sex'],
                'relation' => $patient['relation'],
                'province' => $patient['province'],
                'birthday' => $patient['birthday'],
                'city' => $patient['city'],
                'mobile' => $patient['mobileOrEmail'],
            );

            $patient = PatientClient::getInstance()->add($user, $params);
		} else {
			$patient = $patientInfos;
		}
		if ($this->_newUser->isNull())
		{
			error_log(print_r(debug_backtrace(), true), 3, '/tmp/ask_user_null.log');
            throw new BizException('系统忙,请重试');
		}

        $src = $_SERVER['HTTP_HOST'];
        $hospital = $options['prehospital'];
        $disease = $options['disease'];
        $content = $options['content'];
        $title = $options['title'];
        $attachmentIds = explode(',', $options['attachmentIds']);
        $askSpace = $askSpace;
        $intention = IntentionClient::getInstance()->add4ThreadFromWap($patient, $askSpace, $src, $hospital, $content, $attachmentIds, $disease, $title);
		if (false == $intention->isNull())
		{
            $response->setRedirect($response->router->urlfor('hzhospitalthread/askcomplete', array('id'=>$intention->id)));
		}
		else
        {
            throw new BizException('提交咨询出错,请重试');
        }
	}/*}}}*/
예제 #26
0
    public function patientSelect($request, $response)
    {/*{{{*/
        $target = $request->target;
        $from  = $request->from;
        if ($from <> 'comment' && $from <> 'telorder' && false == $this->user->hasPatient())
        {
            $response->setRedirect($target);
        }
        $patient = array();
        $list = Patient::$compareArr;
        foreach ($list as $item)
        {
            $patient[$item] = $request->$item;
        }

        $response->thePatient = $patient;
        $response->patientId = PatientClient::getInstance()->theSame($this->user, $patient);
        $response->user = $this->user;
        $response->target = $target;
        $response->from= $from;
    }/*}}}*/