package com.yihu.wlyy.web.doctor.patient;

import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroup;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.DoctorPatientGroupService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 医生端：患者分组管理
 *
 * @author George
 */
@Controller
@RequestMapping(value = "/doctor/patient", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-患者信息")
public class PatientInfoController extends BaseController {

    @Autowired
    private PatientInfoService patientInfoService;
    /**
     * 获取患者基本信息
     *
     * @return
     */
    @RequestMapping(value = "info")
    @ResponseBody
    public String getPatient(String patient) {
        try {
            // 获取医生下的患者
            Patient temp = patientInfoService.findByCode(patient);
            return write(200, "获取患者信息成功！", "data", temp);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取患者信息失败！");
        }
    }
}
