Exemple #1
0
 public function getReminderAll($user_id)
 {
     global $CONFIG;
     $Array = array();
     $arr = array();
     $arr["name"] = "未读通知";
     $user_id = parameter_filter($user_id);
     $sql = "select top 3 id,title as first,\n case notice_type when 'I' then '重要' else  '一般' end as second,publish_date  as third \n from v_notice_doctor where doctor_id={$user_id} and haveread='N'\norder by publish_date desc ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     $arr["result"] = $result;
     $arr["first"] = "标题";
     $arr["second"] = "重要性";
     $arr["third"] = "发布日期";
     $arr["count"] = count($result);
     $arr["link"] = $CONFIG['rootpath'] . "/Info/notice.php#";
     $Array[] = $arr;
     $arr = array();
     $arr["name"] = "未回复评价";
     $user_id = parameter_filter($user_id);
     $sql = "select top 3 id,order_no as first,\n comment as second,comment_date  as third \n from v_order_full \n where doctor_id={$user_id} and isnull(reply,'')='' and hascomment='Y' and status='F'\norder by comment_date desc ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     $arr["result"] = $result;
     $arr["first"] = "订单编号";
     $arr["second"] = "评价";
     $arr["third"] = "评价日期";
     $arr["count"] = count($result);
     $arr["link"] = $CONFIG['rootpath'] . "/Order/ordercomment.php#";
     $Array[] = $arr;
     return $Array;
 }
Exemple #2
0
 public function getContent($code)
 {
     $code = parameter_filter($code);
     $sql = "select content from tb_general where code='{$code}' ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     return $result[0];
 }
Exemple #3
0
 public function getGeneralContext($code)
 {
     $code = parameter_filter($code);
     $sql = "select * from tb_general where index_key='{$code}' ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     return $result["content"];
 }
 public function Save($dbMgr, $request, $sysuser)
 {
     $remark = parameter_filter($request["remark"]);
     $id = $request["primary_id"];
     $sql = "update tb_order set remark='{$remark}'  where id={$id} ";
     $query = $dbMgr->query($sql);
     return "right" . $id;
 }
Exemple #5
0
 public function getContent($id)
 {
     $id = parameter_filter($id);
     $sql = "select * from tb_news where id='{$id}' ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     return $result[0];
 }
 public function Save($dbMgr, $request, $sysuser)
 {
     $reply = parameter_filter($request["reply"]);
     $id = $request["primary_id"];
     $sql = "update tb_order_comment set reply='{$reply}',reply_date=getdate() where order_id={$id} ";
     $query = $dbMgr->query($sql);
     return "right" . $id;
 }
Exemple #7
0
 public function getOrder($id)
 {
     $id = parameter_filter($id);
     $sql = "select * from tb_order where id={$id}";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     return $result;
 }
Exemple #8
0
 public function updateMeetingInfo($id, $ret)
 {
     $meeting_id = parameter_filter($ret["id"]);
     $meeting_number = parameter_filter($ret["number"]);
     $meeting_organizerJoinUrl = parameter_filter($ret["organizerJoinUrl"]);
     $meeting_organizerToken = parameter_filter($ret["organizerToken"]);
     $meeting_panelistJoinUrl = parameter_filter($ret["panelistJoinUrl"]);
     $meeting_panelistToken = parameter_filter($ret["panelistToken"]);
     $sql = "update tb_order set meeting_id='{$meeting_id}'\n\t\t,meeting_number='{$meeting_number}'\n\t\t,meeting_organizerJoinUrl='{$meeting_organizerJoinUrl}'\n\t\t,meeting_organizerToken='{$meeting_organizerToken}'\n\t\t,meeting_panelistJoinUrl='{$meeting_panelistJoinUrl}'\n\t\t,meeting_panelistToken='{$meeting_panelistToken}' where id={$id}";
     $query = $this->dbmgr->query($sql);
 }
Exemple #9
0
 public function getBannerList($lastupdate_time)
 {
     $lastupdate_time = parameter_filter($lastupdate_time);
     $sql = "select  id,code,title,link,pic,status  from tb_banner where 1=1  ";
     if ($lastupdate_time != "") {
         $sql .= " and updated_date>'{$lastupdate_time}'  ";
     }
     //echo $sql;
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     return $result;
 }
 public function Save($dbMgr, $request, $sysuser)
 {
     $remark = parameter_filter($request["remark"]);
     $status = parameter_filter($request["status"]);
     if ($status == 'T') {
         return "你不能把状态改为<订单创建>";
     }
     $id = $request["primary_id"];
     $sql = "update tb_order set remark='{$remark}',status='{$status}'  where id={$id} ";
     $query = $dbMgr->query($sql);
     return "right" . $id;
 }
Exemple #11
0
 public function changsePassword($doctor_id, $current_password, $new_password)
 {
     $new_password = parameter_filter($new_password);
     $doctor = $this->getDoctor($doctor_id);
     if (md5($current_password) != $doctor["password"]) {
         return "原密码错误";
     }
     $new_password = md5($new_password);
     $new_password = parameter_filter($new_password);
     $sql = "update tb_doctor set password='******',updated_user=-1,updated_date=" . $this->dbmgr->getDate() . " where id={$doctor_id}";
     $query = $this->dbmgr->query($sql);
     return "SUCCESS";
 }
 public function Save($dbMgr, $request, $sysuser)
 {
     global $SysLang;
     if ($request["primary_id"] == "") {
         $code = $request["license"];
         $code = parameter_filter($code);
         $sql = "select * from tb_doctor where license='{$code}' ";
         $query = $dbMgr->query($sql);
         $userRows = $dbMgr->fetch_array_all($query);
         if (count($userRows) > 0) {
             return $SysLang["doctor"]["codehasbeenused"];
         }
     }
     return parent::Save($dbMgr, $request, $sysuser);
 }
 public function Save($dbMgr, $request, $sysuser)
 {
     global $SysLang;
     if ($request["primary_id"] == "") {
         $key = $request["key"];
         $loginname = parameter_filter($key);
         $sql = "select * from tb_general where `index_key`='{$key}' ";
         $query = $dbMgr->query($sql);
         $userRows = $dbMgr->fetch_array_all($query);
         if (count($userRows) > 0) {
             return $SysLang["general"]["keyduplicate"];
         }
     }
     return parent::Save($dbMgr, $request, $sysuser);
 }
Exemple #14
0
 public function Save($dbMgr, $request, $sysuser)
 {
     global $SysLang;
     if ($request["primary_id"] == "") {
         $login_id = $request["login_id"];
         $loginname = parameter_filter($login_id);
         $sql = "select * from tb_user where login_id='{$login_id}' ";
         $query = $dbMgr->query($sql);
         $userRows = $dbMgr->fetch_array_all($query);
         if (count($userRows) > 0) {
             return $SysLang["user"]["loginnameduplicate"];
         }
     }
     return parent::Save($dbMgr, $request, $sysuser);
 }
Exemple #15
0
 public function getDepartmentList($hospital_id, $search)
 {
     $hospital_id = parameter_filter($hospital_id);
     $arrcol = array();
     $arrcol[] = "d.name";
     $arrcol[] = "c.name";
     $arrcol[] = "s.name";
     $arrcol[] = "cat.name";
     $arrcol[] = "dc.name";
     $searchsql = splitCodition($arrcol, $search);
     $sql = "select distinct d.id, d.college_id,d.name from \ntb_hospital h\ninner join rc_hospital_college rc_hc on h.id=rc_hc.pid\ninner join tb_college c on rc_hc.fid=c.id and c.status='A'\ninner join tb_department d on c.id=d.college_id and d.status='A'\ninner join rc_department_subcategory rc_ds on d.id=rc_ds.pid \ninner join tb_subcategory s on rc_ds.fid=s.id\ninner join tb_category cat on s.category_id=cat.id\ninner join tb_doctor dc on h.id=dc.hospital_id and dc.status='A'\nwhere h.status='A' and h.id={$hospital_id}\nand {$searchsql}\norder by c.seq ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     return $result;
 }
Exemple #16
0
 public function voteNews($news_id)
 {
     $news_id = parameter_filter($news_id);
     if ($news_id == "") {
         return outResult(-1, "news_id can not be null");
     }
     $sql = "select 1\n\t\tfrom tb_news_statistic where news_id={$news_id}";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     if (count($result) == 0) {
         $sql = "insert into tb_news_statistic (news_id) values ({$news_id})";
         $this->dbmgr->query($sql);
     }
     $sql = "update tb_news_statistic set upvote=" . $this->dbmgr->getIsNull("upvote", 0) . "+1 where news_id={$news_id}";
     $this->dbmgr->query($sql);
     return outResult(0, "success");
 }
 public function Save($dbMgr, $request, $sysuser)
 {
     global $SysLang;
     $id = 0;
     if ($request["primary_id"] != "") {
         $id = $request["primary_id"];
     }
     $doctor_id = $request["doctor_id"];
     $office_id = $request["office_id"];
     $id = parameter_filter($id);
     $doctor_id = parameter_filter($doctor_id);
     $office_id = parameter_filter($office_id);
     $sql = "select * from dr_tb_office_openhour where doctor_id={$doctor_id} and office_id={$office_id} and id<>{$id} ";
     $query = $dbMgr->query($sql);
     $userRows = $dbMgr->fetch_array_all($query);
     if (count($userRows) > 0) {
         return $SysLang["doctor"]["duplicatedoctoroffice"];
     }
     return parent::Save($dbMgr, $request, $sysuser);
 }
Exemple #18
0
 public function getDoctorReserve($doctor_id, $first_day)
 {
     $first_day = parameter_filter($first_day);
     $doctor_id = parameter_filter($doctor_id);
     $sql = "select d.duty_mon_m,d.duty_mon_a, \nd.duty_tue_m,d.duty_tue_a, \nd.duty_wed_m,d.duty_wed_a,\nd.duty_thu_m,d.duty_thu_a, \nd.duty_fri_m,d.duty_fri_a, \nd.duty_sat_m,d.duty_sat_a,\nd.duty_sun_m,d.duty_sun_a,\ndr.mon_m,dr.mon_a, DATE_ADD('{$first_day}',INTERVAL 0 DAY) mon_date,\ndr.tue_m,dr.tue_a, DATE_ADD('{$first_day}',INTERVAL 1 DAY) tue_date, \ndr.wed_m,dr.wed_a, DATE_ADD('{$first_day}',INTERVAL 2 DAY) wed_date,\ndr.thu_m,dr.thu_a, DATE_ADD('{$first_day}',INTERVAL 3 DAY) thu_date, \ndr.fri_m,dr.fri_a, DATE_ADD('{$first_day}',INTERVAL 4 DAY) fri_date, \ndr.sat_m,dr.sat_a, DATE_ADD('{$first_day}',INTERVAL 5 DAY) sat_date,\ndr.sun_m,dr.sun_a, DATE_ADD('{$first_day}',INTERVAL 6 DAY) sun_date from tb_doctor d\nleft join tb_doctor_reserve dr on d.id=dr.doctor_id and dr.first_day='{$first_day}'\nwhere id={$doctor_id} and status='A'\n";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     $vacations = $this->getVacation($doctor_id, $first_day);
     $t_arr = array();
     $t_arr[] = "m";
     $t_arr[] = "a";
     $d_arr = array();
     $d_arr[] = "mon";
     $d_arr[] = "tue";
     $d_arr[] = "wed";
     $d_arr[] = "thu";
     $d_arr[] = "fri";
     $d_arr[] = "sat";
     $d_arr[] = "sun";
     $ret = array();
     foreach ($t_arr as $t) {
         $tac = array();
         foreach ($d_arr as $val) {
             $arr = array();
             $arr["dut"] = $result["duty_" . $val . "_{$t}"] + 0;
             $arr["use"] = $result[$val . "_{$t}"] + 0;
             $arr["day"] = $result[$val . "_date"];
             if (date("Y-m-d") < date("Y-m-d", strtotime($arr["day"]))) {
                 $arr["active"] = "Y";
             }
             if ($this->inSchedule($vacations, $arr["day"], "vacation")) {
                 $arr["onvacation"] = "Y";
             }
             $arr["tac"] = $t;
             $tac[] = $arr;
         }
         $ret[] = $tac;
     }
     //print_r($ret);
     return $ret;
 }
Exemple #19
0
 public function Save($dbMgr, $request, $sysuser)
 {
     global $SysLangConfig;
     //print_r($request);
     $sql = "";
     $dbMgr->begin_trans();
     $haveMutilLang = false;
     if ($request["primary_id"] == "") {
         $id = $dbMgr->getNewId($this->XmlData["tablename"]);
         $haveMutilLang = false;
         $sql = "insert into " . $this->XmlData["tablename"] . " (id";
         $fields = $this->XmlData["fields"]["field"];
         foreach ($fields as $value) {
             if ($value["ismutillang"] == "1") {
                 $haveMutilLang = true;
                 continue;
             }
             if ($value["type"] == "grid") {
                 continue;
             }
             $sql = $sql . "," . $value["key"] . "";
         }
         $sql = $sql . ",created_date,created_user,updated_date,updated_user ) values (";
         $sql = $sql . $id;
         foreach ($fields as $value) {
             if ($value["type"] == "grid" || $value["ismutillang"]) {
                 continue;
             }
             if ($value["type"] == "password") {
                 $sql = $sql . ",'" . md5($request[$value["key"]]) . "'";
             } else {
                 $sql = $sql . ",'" . parameter_filter($request[$value["key"]]) . "'";
             }
         }
         $sql = $sql . "," . $dbMgr->getDate() . ",{$sysuser}," . $dbMgr->getDate() . ",{$sysuser} )";
         $query = $dbMgr->query($sql);
     } else {
         $haveMutilLang = false;
         $id = $request["primary_id"];
         $sql = "update " . $this->XmlData["tablename"] . " set updated_date=" . $dbMgr->getDate() . ",updated_user={$sysuser}";
         $fields = $this->XmlData["fields"]["field"];
         foreach ($fields as $value) {
             if ($value["ismutillang"] == "1") {
                 $haveMutilLang = true;
                 continue;
             }
             if ($value["type"] == "grid" || $value["type"] == "password") {
                 continue;
             }
             $sql = $sql . ", " . $value["key"] . "='" . parameter_filter($request[$value["key"]]) . "'";
         }
         $sql = $sql . " where id={$id}";
         $query = $dbMgr->query($sql);
         foreach ($fields as $value) {
             if ($value["type"] == "password") {
                 $sql = "update " . $this->XmlData["tablename"] . " set ";
                 $sql = $sql . " " . $value["key"] . "='" . md5($request[$value["key"]]) . "'";
                 $sql = $sql . " where id={$id} and " . $value["key"] . "<>'" . parameter_filter($request[$value["key"]]) . "'";
                 $query = $dbMgr->query($sql);
             }
         }
         if ($haveMutilLang) {
             foreach ($SysLangConfig["langs"]["lang"] as $lang) {
                 $sql = "update " . $this->XmlData["tablename"] . "_lang set lang='" . $lang["code"] . "'";
                 foreach ($fields as $value) {
                     if ($value["ismutillang"] == "1") {
                         $sql = $sql . ", " . $value["key"] . "='" . parameter_filter($request[$value["key"] . "_" . $lang["code"]]) . "'";
                     }
                 }
                 $sql = $sql . " where oid={$id} and lang='" . $lang["code"] . "'";
                 $query = $dbMgr->query($sql);
             }
         }
     }
     if ($haveMutilLang) {
         $sql = "delete from " . $this->XmlData["tablename"] . "_lang where oid={$id} ";
         $query = $dbMgr->query($sql);
         foreach ($SysLangConfig["langs"]["lang"] as $lang) {
             $sql = "insert into " . $this->XmlData["tablename"] . "_lang (oid,lang";
             $fields = $this->XmlData["fields"]["field"];
             foreach ($fields as $value) {
                 if ($value["ismutillang"] == "1") {
                     $sql = $sql . "," . $value["key"] . "";
                 }
             }
             $sql = $sql . " ) values ( {$id} ,'" . $lang["code"] . "' ";
             foreach ($fields as $value) {
                 if ($value["ismutillang"] == "1") {
                     $sql = $sql . ",'" . parameter_filter($request[$value["key"] . "_" . $lang["code"]]) . "'";
                 }
             }
             $sql = $sql . " )";
             $query = $dbMgr->query($sql);
         }
     }
     $dbMgr->commit_trans();
     return "right" . $id;
 }
Exemple #20
0
 public function getMeeting($member_id, $date)
 {
     $member_id = parameter_filter($member_id);
     $date = parameter_filter($date);
     $sql = "select o.*,c.sexual,c.status case_status from tb_order o\ninner join tb_member_case c on o.case_id=c.id\nwhere o.member_id={$member_id} \nand o.meeting_date='{$date}'\norder by o.meeting_time  ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     for ($i = 0; $i < count($result); $i++) {
         $meeting_time_start = explode("-", $result[$i]["meeting_time"]);
         $meeting_time_start = $meeting_time_start[0];
         $result[$i]["meeting_time_start"] = $meeting_time_start;
     }
     return $result;
 }
Exemple #21
0
 public function getDoctorWorktime($doctor_id, $date)
 {
     if ($doctor_id == "") {
         return outResult(-1, "doctor_id can not be null");
     }
     $workday_arr = array();
     $doctor_id = parameter_filter($doctor_id);
     $sql = "select worktime from tb_doctor where id={$doctor_id} ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     if ($date != "") {
         $date = parameter_filter($date);
         //F:fail,D:delete,C:cancel
         $sql = "select order_time from tb_order o\n\t\t\tinner join tb_order_videochat ov on o.id=ov.order_id\n\t\t\t where doctor_id={$doctor_id} and order_date='{$date}' and status<>'F' and status<>'D' and status<>'C' ";
         $query = $this->dbmgr->query($sql);
         $ordertime = $this->dbmgr->fetch_array_all($query);
     }
     $numberOfWeek = date('w', strtotime($date));
     if ($numberOfWeek == 0) {
         $numberOfWeek = 7;
     }
     $worktime_schedule = explode("\n", $result[0]);
     $ret = array();
     foreach ($worktime_schedule as $value) {
         $value = trim(" " . $value);
         if ($value != "" && $value[0] == "#") {
             if (is_int(intval($value[1])) && ($value[1] <= 7 && $value[1] >= 1)) {
                 $acce = array();
                 $acce[0] = 0;
                 $acce["day"] = $value[1];
                 $workday_arr[$value[1]] = $acce;
                 if ($value[1] == $numberOfWeek) {
                     $dayworktime_arr = explode("->", $value);
                     $dayworktime = $dayworktime_arr[1];
                     $invalworktime_arr = explode(",", $dayworktime);
                     foreach ($invalworktime_arr as $intval) {
                         $intval = trim($intval);
                         $fromto = explode("-", $intval);
                         $from = $fromto[0];
                         $to = $fromto[1];
                         $arr = $this->getFromToArray($from, $to, $ordertime);
                         $ret = array_merge($ret, $arr);
                     }
                 }
             }
         }
     }
     if ($date != "") {
         return $ret;
     } else {
         return $workday_arr;
     }
 }
Exemple #22
0
 public function getOrder($order_id, $member_id)
 {
     if ($order_id == "") {
         return outResult(-1, "order_id can not be null");
     }
     if ($member_id == "") {
         return outResult(-2, "member_id can not be null");
     }
     $order_id = parameter_filter($order_id);
     $member_id = parameter_filter($member_id);
     $sql = "select * from (\n( select v.*,v1.doctor_id tag from v_order v\ninner join tb_order_videochat v1 on v.id=v1.order_id and v.act='VC')\n  union ( select v.*,v1.doctor_id tag from v_order v\ninner join tb_order_charchat v1 on v.id=v1.order_id and v.act='CC')\n) v1 where status<>'D' and id={$order_id} and member_id={$member_id}  ";
     //echo $sql;
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     return $result;
 }
Exemple #23
0
 private function sendNotice($title, $context, $send_type, $specify_id)
 {
     $id = $this->dbmgr->getNewId("tb_notice");
     $publish_date = date('Y-m-d H:i:s', time());
     $id = parameter_filter($id);
     $title = parameter_filter($title);
     $context = parameter_filter($context);
     $doctor_id = parameter_filter($doctor_id);
     $member_id = parameter_filter($member_id);
     $send_type = parameter_filter($send_type);
     $sql = "insert into tb_notice (id,created_date,created_user,updated_date,updated_user,\n\t\ttitle,publish_date,notice_type,context,remarks,status,specify_id,sent_type)\n\t\tvalues ({$id}," . $this->dbmgr->getDate() . ",-1," . $this->dbmgr->getDate() . ",-1,\n\t\t'{$title}','{$publish_date}','M','{$context}','系统自动发送','A',{$specify_id},'{$send_type}')";
     $query = $this->dbmgr->query($sql);
 }
Exemple #24
0
 public function updateVacation($doctor_id, $year, $month, $days)
 {
     $doctor_id = parameter_filter($doctor_id);
     $this->dbmgr->begin_trans();
     $days = explode(",", $days);
     foreach ($days as $day) {
         if (trim($day) != "") {
             $date = "{$year}-{$month}-{$day}";
             $date = parameter_filter($date);
             $sql = "select 1 from tb_doctor_vacation where doctor_id={$doctor_id} and vacation='{$date}'";
             $query = $this->dbmgr->query($sql);
             $result = $this->dbmgr->fetch_array_all($query);
             if (count($result) > 0) {
                 $sql = "delete from tb_doctor_vacation where doctor_id={$doctor_id} and vacation='{$date}'";
                 $query = $this->dbmgr->query($sql);
             } else {
                 $sql = "insert into tb_doctor_vacation (doctor_id,vacation) values ({$doctor_id},'{$date}')";
                 $this->dbmgr->query($sql);
             }
         }
     }
     $this->dbmgr->commit_trans();
     return "RIGHT";
 }
function splitCodition($cols, $keyword)
{
    $ret = "(1=2 ";
    $condition = explode(" ", $keyword);
    foreach ($cols as $col) {
        foreach ($condition as $v) {
            $ret = $ret . " or {$col} like '%" . parameter_filter($v) . "%' \n\t\t\t";
        }
    }
    $ret .= " )";
    return $ret;
}
Exemple #26
0
 public function upHospitalCount($id)
 {
     $id = parameter_filter($id);
     $sql = "update tb_hospital set count=ifnull(count,10000)+1 where  id={$id}";
     $query = $this->dbmgr->query($sql);
 }
Exemple #27
0
 public function registerMember($mobile, $verifycode, $password, $name)
 {
     if ($mobile == "") {
         return outResult(-1, "mobile can not be null");
     }
     if ($verifycode == "") {
         return outResult(-11, "verify code can not be null");
     }
     if ($password == "") {
         return outResult(-12, "password can not be null");
     }
     $mobile = parameter_filter($mobile);
     $sql = "select count(1) from tb_member where mobile='{$mobile}' ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     if ($result[0] > 0) {
         return outResult(-2, "mobile has been used");
     }
     global $smsMgr;
     $lastsent_verifycode = $smsMgr->getLastSent($mobile, "G");
     if ($verifycode != $lastsent_verifycode["code"]) {
         return outResult(-3, "verify code is incorrect");
     }
     $id = $this->dbmgr->getNewId("tb_member");
     $sql = "insert into tb_member (id,mobile,password,name,status,created_date,created_user,updated_date,updated_user) values\n\t\t({$id},'{$mobile}','{$password}','{$name}','A'," . $this->dbmgr->getDate() . ",-1," . $this->dbmgr->getDate() . ",-1)";
     $query = $this->dbmgr->query($sql);
     return outResult(0, "register success", $id);
 }
Exemple #28
0
 public function createCase($member_id, $doctor_id, $file_id, $request)
 {
     $id = $this->dbmgr->getNewId("tb_member_case");
     $apply_hospital = parameter_filter($request["apply_hospital"]);
     $apply_date = parameter_filter($request["apply_date"]);
     $name = parameter_filter($request["name"]);
     $sexual = parameter_filter($request["sexual"]);
     $age = parameter_filter($request["age"]);
     $category = parameter_filter($request["category"]);
     $way = parameter_filter($request["way"]);
     $urgent = parameter_filter($request["urgent"]);
     $necessary = parameter_filter($request["necessary"]);
     $meeting_date = parameter_filter($request["meeting_date"]);
     $first_result = parameter_filter($request["first_result"]);
     $acresult = parameter_filter($request["result"]);
     $checking = parameter_filter($request["checking"]);
     $solution = parameter_filter($request["solution"]);
     $caution = parameter_filter($request["caution"]);
     $signature = parameter_filter($request["signature"]);
     $status = parameter_filter($request["status"]);
     $summary = parameter_filter($request["summary"]);
     $contact = parameter_filter($request["contact"]);
     $apply_department = parameter_filter($request["apply_department"]);
     $apply_doctor = parameter_filter($request["apply_doctor"]);
     $apply_history = parameter_filter($request["apply_history"]);
     $apply_situation = parameter_filter($request["apply_situation"]);
     $apply_report = parameter_filter($request["apply_report"]);
     $apply_procedure = parameter_filter($request["apply_procedure"]);
     $apply_first_result = parameter_filter($request["apply_first_result"]);
     $contact_tel = parameter_filter($request["contact_tel"]);
     $contact_address = parameter_filter($request["contact_address"]);
     $hospital = parameter_filter($request["hospital"]);
     $department = parameter_filter($request["department"]);
     $tel = parameter_filter($request["tel"]);
     $tac = parameter_filter($request["tac"]);
     $meeting_date_mon = getmon(strtotime($meeting_date));
     $dayshort = getDayShortName($meeting_date);
     $dayshorttac = $dayshort . "_" . $tac;
     $sql = "select d.duty_{$dayshorttac} duty,ifnull(dr.{$dayshorttac},0) `use`  from tb_doctor d\nleft join tb_doctor_reserve dr on d.id=dr.doctor_id and dr.first_day='{$meeting_date_mon}'\nwhere d.id={$doctor_id} ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     if ($result["duty"] <= $result["use"]) {
         return "FULLRESERVE";
     }
     $meetweek = getmonsun(strtotime($meeting_date));
     $mon = $meetweek["mon_str_t"];
     $sun = $meetweek["sun_str_t"];
     $sql = "select * from tb_order\nwhere status='T' and meeting_date>='{$mon} 0:0:0' and meeting_date<='{$sun} 23:59:59'";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     if (count($result) > 0) {
         return "RESERVEINWEEK";
     }
     $sql = "INSERT INTO `tb_member_case`\n(`id`,\n`member_id`,`file_id`,`title`,`doctor_id`,`apply_hospital`,`apply_date`,\n`name`,`sexual`,`age`,`category`,`way`,`urgent`,`necessary`,`meeting_date`,\n`first_result`,`position`,`result`,`checking`,`solution`,`caution`,`signature`,`status`,`created_date`,\n`updated_date`,`summary`,`contact`,`apply_department`,`apply_doctor`,`apply_history`,`apply_situation`,\n`apply_report`,`apply_procedure`,`apply_first_result`,`contact_tel`,`contact_address`,`hospital`,`department`,`tel`)\nVALUES\n({$id},\n{$member_id},{$file_id},'申请单{$meeting_date}',{$doctor_id},'{$apply_hospital}',\n'{$apply_date}','{$name}','{$sexual}','{$age}','{$category}','{$way}','{$urgent}','{$necessary}',\n'{$meeting_date}','{$first_result}','{$position}','{$acresult}','{$checking}','{$solution}','{$caution}','{$signature}','T',\nnow(),now(),'{$summary}','{$contact}','{$apply_department}','{$apply_doctor}','{$apply_history}',\n'{$apply_situation}','{$apply_report}','{$apply_procedure}','{$apply_first_result}',\n'{$contact_tel}','{$contact_address}','{$hospital}','{$department}','{$tel}');\n";
     $this->dbmgr->begin_trans();
     $this->dbmgr->query($sql);
     $uploadfiles = explode("<||>", $request["uploadfiles"]);
     $attid = $this->dbmgr->getNewId("tb_member_case_attachment");
     foreach ($uploadfiles as $value) {
         if ($value != "") {
             $uploadfile = explode("<~>", $value);
             $filesavename = parameter_filter($uploadfile[0]);
             $filename = parameter_filter($uploadfile[1]);
             $sql = "insert into tb_member_case_attachment (id,case_id,filesavename,filename)\n\t\t\t\tvalues ({$attid},{$id},'{$filesavename}','{$filename}')";
             $this->dbmgr->query($sql);
             $attid++;
         }
     }
     $case_id = $id;
     $sql = "select 1 from tb_doctor_reserve where doctor_id={$doctor_id} and first_day='{$meeting_date_mon}'";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array_all($query);
     if (count($result) > 0) {
         $sql = "insert into tb_doctor_reserve (doctor_id,first_day) values ({$doctor},'{$meeting_date_mon}')";
         $this->dbmgr->query($sql);
     }
     $sql = "select price from tb_doctor where id={$doctor_id} ";
     $query = $this->dbmgr->query($sql);
     $result = $this->dbmgr->fetch_array($query);
     $price = $result["price"];
     $id = $this->dbmgr->getNewId("tb_order");
     $order_no = $this->genOrderNo("PT");
     $sql = "insert into tb_order \n\t\t(id,case_id,price,submit_date,meeting_date,tac,status,\n\t\tcreated_date,created_user,updated_date,updated_user,\n\t\torder_no,doctor_id) values \n\t\t({$id},{$case_id},{$price},now(),'{$meeting_date}','{$tac}','T',\n\t\tnow(),1,now(),1,\n\t\t'{$order_no}',{$doctor_id} )";
     $this->dbmgr->query($sql);
     $sql = "update tb_doctor_reserve set {$dayshorttac}=ifnull({$dayshorttac},0)+1 \n\t\twhere doctor_id={$doctor_id} and first_day='{$meeting_date_mon}' ";
     $this->dbmgr->query($sql);
     $this->dbmgr->commit_trans();
     return "RIGHT" . $id;
 }
Exemple #29
0
 private function PerpareSendWithVerifyCode($mobile, $type, $templeteId)
 {
     $lstrs = $this->getLastSent($mobile, $type);
     if ($lstrs["id"] == "") {
         $verifycode = $this->genVerifyCode(6, "NUMBER");
     } else {
         if ($lstrs["lastsent"] < 1) {
             return;
         }
         $verifycode = $lstrs["code"];
     }
     $arr = array($verifycode, $this->timeout);
     $result = $this->Send($mobile, $arr, $templeteId);
     if ($result) {
         $mobile = parameter_filter($mobile);
         $verifycode = parameter_filter($verifycode);
         $verifycode = parameter_filter($verifycode);
         $templeteId = parameter_filter($templeteId);
         if ($lstrs["id"] == "") {
             $sql = "insert into tb_sms_code (mobile,code,type,created_time,lastsent_time,templete_id)\n\t\t\t\tvalues ('{$mobile}','{$verifycode}','{$type}',getdate(),getdate(),'{$templeteId}')";
         } else {
             $id = $lstrs["id"];
             $sql = "update tb_sms_code set lastsent_time=getdate() where id={$id} ";
         }
         $query = $this->dbmgr->query($sql);
     }
 }
Exemple #30
0
 public function resetPassword($user_id, $password, $sysUser_id)
 {
     $password = parameter_filter($password);
     $sql = "update tb_user set password='******',updated_user={$sysUser_id},updated_date=" . $dbMgr->getDate() . " where user_id={$user_id}";
     $query = $this->dbmgr->query($sql);
 }