package com.xinelu.applet.controller.nearbynursingstation;


import com.xinelu.applet.dto.nursestation.NurseStationAppletDTO;
import com.xinelu.applet.service.nearbynursingstation.INearbyNursingStationService;
import com.xinelu.applet.vo.nurseclassifyinfo.NurseClassifyInfoVO;
import com.xinelu.common.annotation.MobileRequestAuthorization;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 附近护理站信息Controller
 *
 * @author ljh
 * @date 2022-09-02
 */
@RestController
@RequestMapping("/nurseApplet/nearbyNursingStation")
public class NearbyNursingStationController extends BaseController {
    @Resource
    private INearbyNursingStationService nearbyNursingStationService;


    /**
     * 分页查询附近的护理站集合
     *
     * @param dto 搜获参数
     * @return com.xinyilu.common.core.page.TableDataInfo
     **/
    @MobileRequestAuthorization
    @GetMapping("/nearbyList")
    public TableDataInfo list(NurseStationAppletDTO dto) {
        return nearbyNursingStationService.getNearbyNursingStationInfoList(dto);
    }

    /**
     * 查询护理项目分类信息列表(护理站首页护理站与项目分类接口)
     */
    @MobileRequestAuthorization
    @GetMapping("/getNurseClassifyList")
    public AjaxResult getNurseClassifyList(NurseClassifyInfoVO nurseClassifyInfo) {
        return AjaxResult.success(nearbyNursingStationService.getNurseClassifyList(nurseClassifyInfo));
    }

    /**
     * 获取附近某个护理站详细信息对象
     *
     * @param nurseStationId 护理站id
     * @param homeLongitude  经度
     * @param homeLatitude   维度
     * @return com.xinyilu.common.core.domain.AjaxResult
     */
    @MobileRequestAuthorization
    @GetMapping("/introductionList")
    public AjaxResult list(Long nurseStationId, String homeLongitude, String homeLatitude) {
        return nearbyNursingStationService.selectNursingStationIntroductionList(nurseStationId, homeLongitude, homeLatitude);
    }

    /**
     * 查询附近某个护理站的服务信息列表
     *
     * @param nurseStationId      护理站id
     * @param nurseClassifyInfoId 护理项目所属分类id
     * @return com.xinyilu.nurseapplet.domain.nearbynursingstation.NearbyNursingStationVO
     */
    @MobileRequestAuthorization
    @GetMapping("/itemList")
    public TableDataInfo itemList(Long nurseStationId, Long nurseClassifyInfoId) {
        startPage();
        return getDataTable(nearbyNursingStationService.selectNursingStationItemList(nurseStationId, nurseClassifyInfoId));
    }

    /**
     * 查询附近某个护理站的产品信息列表
     *
     * @param nurseStationId 护理站id
     * @return com.xinyilu.nurseapplet.domain.nearbynursingstation.NearbyNursingStationVO
     */
    @MobileRequestAuthorization
    @GetMapping("/productInformation")
    public TableDataInfo productList(Long nurseStationId) {
        startPage();
        return getDataTable(nearbyNursingStationService.selectNursingStationProductList(nurseStationId));
    }

    /**
     * 小程序/App-首页获取健康常识列表信息
     *
     * @param informationCategoryType 资讯类型
     * @return com.xinyilu.common.core.page.TableDataInfo 参数列表
     */
    @GetMapping("/getHeathHousingList")
    @MobileRequestAuthorization
    public TableDataInfo getHeathHousingList(String informationCategoryType) {
        startPage();
        return getDataTable(nearbyNursingStationService.getHeathHousingList(informationCategoryType));
    }
}
