package thyyxxk.webserver.controller.zhuyuanyiji;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.datamodify.MzChargeDetail;
import thyyxxk.webserver.service.zhuyuanyiji.MenZhengXiangMuServer;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 描述： 门诊项目取消或确认
 * </p>
 *
 * @author xc
 * @date 2021-10-09 15:17
 */
@RestController
@RequestMapping("/menZhenXiangMu")
public class MenZhengXiangMuController {
    private final MenZhengXiangMuServer server;

    public MenZhengXiangMuController(MenZhengXiangMuServer server) {
        this.server = server;
    }


    @GetMapping("/kuaiSuChaZhao")
    public ResultVo<List<MzChargeDetail>> kuaiSuChaZhao(@RequestParam("startTime") String startTime,
                                                        @RequestParam("endTime") String endTime,
                                                        @RequestParam("execDept") String execDept) {
        return server.kuaiSuChaZhao(startTime, endTime, execDept);
    }

    @GetMapping("/getMzPatient")
    public ResultVo<MzChargeDetail> getMzPatient(@RequestParam("patientId") String patientId,
                                                 @RequestParam("xiangMuZhuangTai") Integer xiangMuZhuangTai,
                                                 @RequestParam("startTime") String startTime,
                                                 @RequestParam("endTime") String endTime,
                                                 @RequestParam("dept") String dept) {
        return server.getMzPatient(patientId, xiangMuZhuangTai, startTime, endTime, dept);
    }

    @GetMapping("/getFeiYongXinXi")
    public ResultVo<Map<String, List<MzChargeDetail>>> getFeiYongXinXi(@RequestParam("realNo") Integer realNo,
                                                                       @RequestParam("patientId") String patientId,
                                                                       @RequestParam("times") Integer times,
                                                                       @RequestParam("xiangMuZhuangTai") Integer xiangMuZhuangTai) {
        return server.getFeiYongXinXi(realNo, patientId, times, xiangMuZhuangTai);
    }

    @PostMapping("/getMingXi")
    public ResultVo<List<MzChargeDetail>> getMingXi(@RequestBody MzChargeDetail mzChargeDetail) {
        return server.getMingXi(mzChargeDetail);
    }

    @PostMapping("/queRenOrQuXiao")
    public ResultVo<String> menZhenXiangMuQueXiaoHuoQueRen(@RequestBody MzChargeDetail mzChargeDetail) {
        mzChargeDetail.setSource("本院");
        return server.menZhenXiangMuQueXiaoHuoQueRen(mzChargeDetail);
    }


    @GetMapping("/getReqDetailsByNo")
    public ResultVo<JSONObject> getReqDetailsByNo(@RequestParam("reqNo") String reqNo,
                                                  @RequestParam("patientId") Integer patientId) {
        return server.getReqDetailsByNo(reqNo, patientId);
    }

}
