作者 sgj

inquiry 添加内容

@@ -65,7 +65,7 @@ class IndexController extends WeChatBaseController @@ -65,7 +65,7 @@ class IndexController extends WeChatBaseController
65 $this->error('内部错误'); 65 $this->error('内部错误');
66 }else{ 66 }else{
67 /*添加相应的信息到用户表*/ 67 /*添加相应的信息到用户表*/
68 - $insert['paltform']=$info['platform']; 68 + $insert['platform']=$info['platform'];
69 $insert['hospital']=$info['hospital']; 69 $insert['hospital']=$info['hospital'];
70 $insert['office']=$info['office']; 70 $insert['office']=$info['office'];
71 $insert['job']=$info['job']; 71 $insert['job']=$info['job'];
@@ -367,7 +367,21 @@ class IndexController extends HomeBaseController @@ -367,7 +367,21 @@ class IndexController extends HomeBaseController
367 $hospital=$Hospital->getHospital()->toArray(); 367 $hospital=$Hospital->getHospital()->toArray();
368 $this->assign('hospital',$hospital); 368 $this->assign('hospital',$hospital);
369 $this->assign('platment',$platment); 369 $this->assign('platment',$platment);
370 - dump($platment);  
371 return $this->fetch(); 370 return $this->fetch();
372 } 371 }
  372 +
  373 + /**
  374 + * 通过平台获取专家
  375 + * @throws \think\db\exception\DataNotFoundException
  376 + * @throws \think\db\exception\ModelNotFoundException
  377 + * @throws \think\exception\DbException
  378 + */
  379 + public function getExportByPlatment(){
  380 + $platment_id=input('platment_id');
  381 + $Hospital= new HospitalModel();
  382 + $User=new UserModel();
  383 + $export=$User->getExpertByPlatment($platment_id)->toArray();
  384 + $this->success('','',$export);
  385 + }
  386 +
373 } 387 }
@@ -421,5 +421,22 @@ class UserModel extends Model @@ -421,5 +421,22 @@ class UserModel extends Model
421 return $userinfo; 421 return $userinfo;
422 } 422 }
423 423
424 - 424 + /**
  425 + * 通过平台id获取到专家信息
  426 + * @param $id
  427 + * @return false|\PDOStatement|string|\think\Collection
  428 + * @throws \think\db\exception\DataNotFoundException
  429 + * @throws \think\db\exception\ModelNotFoundException
  430 + * @throws \think\exception\DbException
  431 + */
  432 + public function getExpertByPlatment($id){
  433 + $map['platform']=$id;
  434 + $map['is_expert']=1;
  435 + $user=$this
  436 + ->where($map)
  437 + ->field('user_login,avatar,job,hospital,id,office,platform')
  438 + ->order('is_top Desc')
  439 + ->select();
  440 + return $user;
  441 + }
425 } 442 }
@@ -213,6 +213,7 @@ @@ -213,6 +213,7 @@
213 <!--<script src="__TMPL__/public/assets/js/referral.js"></script>--> 213 <!--<script src="__TMPL__/public/assets/js/referral.js"></script>-->
214 <script type="application/javascript"> 214 <script type="application/javascript">
215 //文本框显示字数 215 //文本框显示字数
  216 +
216 $(".area").on("input propertychange", function () { 217 $(".area").on("input propertychange", function () {
217 218
218 var $this = $(this), 219 var $this = $(this),
@@ -233,32 +234,53 @@ @@ -233,32 +234,53 @@
233 </volist> 234 </volist>
234 ], { 235 ], {
235 onChange: function (res) { 236 onChange: function (res) {
236 - console.log(res) 237 + $('.expert_value').val('')
  238 + $('.expert_value').data('data-id','')
237 }, 239 },
238 onConfirm: function (res) { 240 onConfirm: function (res) {
239 $('.inquiry_value').val(res[0].label) 241 $('.inquiry_value').val(res[0].label)
  242 + $('.inquiry_value').data('data-id',res[0].value)
240 } 243 }
241 } 244 }
242 ) 245 )
243 }) 246 })
244 // 疾病分类下拉 247 // 疾病分类下拉
245 $('.expert').click(function () { 248 $('.expert').click(function () {
  249 + var doctor = new Array()
  250 + var platment_id = $('.inquiry_value').data('data-id');
  251 + if (!platment_id) {
  252 + alert('请先选择疾病分类!');
  253 + return;
  254 + }
246 $.ajax({ 255 $.ajax({
247 - url:'{:url()}', 256 + url: '{:url('getExportByPlatment')}',
  257 + data: {
  258 + platment_id: platment_id
  259 + },
  260 + type: 'POST',
  261 + success: function (res) {
  262 + console.log(res);
248 263
249 - })  
250 - weui.picker([  
251 - {label: '王医生', value: 0},  
252 - {label: '刘易斯', value: 1}  
253 - ], {  
254 - onChange: function (res) {  
255 - console.log(res)  
256 - },  
257 - onConfirm: function (res) {  
258 - $('.expert_value').val(res[0].label) 264 + for (key in res.data) {
  265 + var info = new Object();
  266 + info.label = res.data[key].user_login;
  267 + info.value = res.data[key].id;
  268 + doctor[key] = info
259 } 269 }
  270 + console.log(doctor);
  271 + var doctor1 = new Array();
  272 + weui.picker(doctor, {
  273 + onChange: function (res) {
  274 + console.log(res)
  275 + },
  276 + onConfirm: function (res) {
  277 + $('.expert_value').val(res[0].label)
  278 + $('.expert_value').data('data-id', res[0].value)
  279 + }
  280 + }
  281 + )
260 } 282 }
261 - ) 283 + })
262 }) 284 })
263 // 性别分类 285 // 性别分类
264 $('.sex_type').click(function () { 286 $('.sex_type').click(function () {