package com.yihu.wlyy.service.app.label;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDiseaseDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* 患者标签信息服务
*
* Created by lyr on 2016/10/9.
*/
@Service
@Transactional
public class SignPatientLabelInfoService extends BaseService {
@Autowired
SignPatientLabelService labelService;
@Autowired
DoctorDao doctorDao;
@Autowired
PatientDao patientDao;
@Autowired
SignPatientLabelInfoDao labelInfoDao;
@Autowired
PatientDiseaseDao diseaseDao;
@Autowired
DoctorPatientGroupInfoDao groupInfoDao;
@Autowired
JdbcTemplate jdbcTemplate;
@Autowired
SignFamilyDao signFamilyDao;
/**
* 根据标签查询患者信息
*
* @param labelCode 标签code
* @param labelType 标签类型
* @param page 第几页
* @param pagesize 页大小
* @return
*/
public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType, Long teamCode, int page, int pagesize) throws Exception {
Doctor doc = doctorDao.findByCode(doctor);
if (doc == null) {
throw new Exception("doctor info can not find");
}
Map result = new HashMap<>();
List