diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/QuestionLogController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/QuestionLogController.php index 69feaf4..20a5e7b 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/QuestionLogController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/QuestionLogController.php @@ -20,6 +20,7 @@ class QuestionLogController extends Controller $q_type = request('q_type'); $dateRange = request('dateRange'); if(!isset($dateRange) or count($dateRange)<>2) return \Yz::echoError1("请选择日期"); + $dateRange=[$dateRange[0].' 00:00:00',$dateRange[1].' 23:59:59']; $q_list=DB::table('questions')->where(['q_type'=>2,'is_del'=>0,'status'=>1])->orderBy('order','asc')->get(); $log_list = DB::table('questions_log')->whereBetween('created_at',$dateRange)->where(['q_type' => $q_type])->get(); if(count($log_list)==0) return \Yz::echoError1("暂无数据可导出"); diff --git a/Laravel/app/Http/Controllers/API/H5/QuestionController.php b/Laravel/app/Http/Controllers/API/H5/QuestionController.php index 6abeb3c..af70018 100644 --- a/Laravel/app/Http/Controllers/API/H5/QuestionController.php +++ b/Laravel/app/Http/Controllers/API/H5/QuestionController.php @@ -12,6 +12,8 @@ class QuestionController extends Controller { $hospital_id = request('hospital_id'); $q_type = request('q_type'); + $person= request('person'); + $count=0; if (!isset($hospital_id)) return \Yz::echoError1("医院id不能为空"); if (!isset($q_type)) return \Yz::echoError1("问卷类型不能为空"); $list = DB::table('questions') @@ -22,10 +24,15 @@ class QuestionController extends Controller ])->orderBy('order','asc')->get(); foreach ($list as $key=>$item){ $item->content=json_decode($item->content,true); - + if($person['sex']==1 and strpos($item->question, '女性') !== false){ + $item->show=false; + }else{ + $item->show=true; + $count++; + } } - return \Yz::Return(true,"查询成功",['list'=>$list]); + return \Yz::Return(true,"查询成功",['list'=>$list,'count'=>$count]); } //提交调查 public function SubmitAnswer() diff --git a/h5/pages/main/questionnaire/index.vue b/h5/pages/main/questionnaire/index.vue index 0dd7014..327f06c 100644 --- a/h5/pages/main/questionnaire/index.vue +++ b/h5/pages/main/questionnaire/index.vue @@ -17,6 +17,7 @@ const $store = useStore(); let topicList = ref([]); // 题目列表 let topicIndex = ref(0); // 题目索引 +let question_count=ref(0);//题目总数 const tabPatients = () => { uni.navigateTo({ @@ -28,10 +29,12 @@ const getmyddcSelect = async () => { uni.showLoading(); const response = await $api("QuestionGetList", { hospital_id: $store.save.hospital, + person:$store.user, q_type: 2, }); //目前请求的套餐 头的接口 $response(response, () => { uni.hideLoading(); + question_count.value=response.data.count topicList.value = response.data.list.map((val) => { let answer = val.type != 1 ? [] : "" let content = val.content @@ -46,6 +49,18 @@ const getmyddcSelect = async () => { content = '' } } + if(val.question=='请问您的性别'){ + if($store.user.sex==1){ + answer=['男性'] + } + if($store.user.sex==2){ + answer=['女性'] + } + + } + if(val.question.includes('女性') && $store.user.sex==1){ + answer=['不涉及'] + } return { ...val, content: content, @@ -297,11 +312,11 @@ onShow(() => { - 共 {{ topicList.length }} 题 + 共 {{ question_count }}