|
@ -4,11 +4,21 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.specialist.PatientDiseaseServer;
|
|
|
import com.yihu.wlyy.entity.specialist.SpecialDisease;
|
|
|
import com.yihu.wlyy.entity.specialist.TeamDiseaseRelation;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
|
|
|
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
|
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.specialist.PatientDiseaseServerDao;
|
|
|
import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
|
|
|
import com.yihu.wlyy.repository.specialist.TeamDiseaseRelationDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.util.http.HttpResponse;
|
|
|
import com.yihu.wlyy.util.http.HttpUtils;
|
|
@ -29,6 +39,8 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
|
import static com.yihu.wlyy.service.common.util.ManageUtilService.page;
|
|
|
|
|
|
/**
|
|
|
* Created by Trick on 2018/5/31.
|
|
|
*/
|
|
@ -36,6 +48,9 @@ import java.util.logging.Logger;
|
|
|
@Transactional
|
|
|
public class SpecialistService extends BaseService {
|
|
|
|
|
|
private static org.slf4j.Logger logger = LoggerFactory.getLogger(SpecialistService.class);
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private SignPatientLabelDao signPatientLabelDao;
|
|
|
@Autowired
|
|
@ -48,12 +63,22 @@ public class SpecialistService extends BaseService {
|
|
|
private String specialistUrl;
|
|
|
@Autowired
|
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
|
@Autowired
|
|
|
private TeamDiseaseRelationDao teamDiseaseRelationDao;
|
|
|
@Autowired
|
|
|
private PatientDiseaseServerDao patientDiseaseServerDao;
|
|
|
@Autowired
|
|
|
private PatientDao patientDao;
|
|
|
@Autowired
|
|
|
private SpecialDiseaseDao specialDiseaseDao;
|
|
|
@Autowired
|
|
|
private MessageDao messageDao;
|
|
|
|
|
|
public String setPatientLabelInfo(List<SignPatientLabelInfo> list){
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(SignPatientLabelInfo signPatientLabelInfo : list){
|
|
|
List<SignPatientLabelInfo> s = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(signPatientLabelInfo.getPatient(),signPatientLabelInfo.getLabelType(),1);
|
|
|
if(s==null||s.size()==0){
|
|
|
public String setPatientLabelInfo(List<SignPatientLabelInfo> list) {
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (SignPatientLabelInfo signPatientLabelInfo : list) {
|
|
|
List<SignPatientLabelInfo> s = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(signPatientLabelInfo.getPatient(), signPatientLabelInfo.getLabelType(), 1);
|
|
|
if (s == null || s.size() == 0) {
|
|
|
signPatientLabelInfo.setCzrq(new Date());
|
|
|
signPatientLabelInfo.setStatus(1);
|
|
|
signPatientLabelInfoDao.save(signPatientLabelInfo);
|
|
@ -63,9 +88,9 @@ public class SpecialistService extends BaseService {
|
|
|
return "1";
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> findHealthAssistant(String doctor){
|
|
|
public List<Map<String, Object>> findHealthAssistant(String doctor) {
|
|
|
|
|
|
String sql="SELECT " +
|
|
|
String sql = "SELECT " +
|
|
|
" d.`code`, " +
|
|
|
" d.`name`, " +
|
|
|
" d.photo, " +
|
|
@ -83,172 +108,173 @@ public class SpecialistService extends BaseService {
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team t " +
|
|
|
" WHERE " +
|
|
|
" t.leader_code = '"+doctor+"' " +
|
|
|
" t.leader_code = '" + doctor + "' " +
|
|
|
" )";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> findHealthAssistantPatientCount(String doctor)throws Exception{
|
|
|
List<Map<String,Object>> list = findHealthAssistant(doctor);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(Map<String,Object> map:list){
|
|
|
map.put("count",getAssistantPatientCount(doctor,map.get("code").toString()));
|
|
|
public List<Map<String, Object>> findHealthAssistantPatientCount(String doctor) throws Exception {
|
|
|
List<Map<String, Object>> list = findHealthAssistant(doctor);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (Map<String, Object> map : list) {
|
|
|
map.put("count", getAssistantPatientCount(doctor, map.get("code").toString()));
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
public Long getAssistantPatientCount(String doctor,String assistant)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
param.put("assistant",assistant);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/getAssistantPatientCount",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
|
|
|
public Long getAssistantPatientCount(String doctor, String assistant) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
param.put("assistant", assistant);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getAssistantPatientCount", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getLong("obj");
|
|
|
}
|
|
|
return 0L;
|
|
|
}
|
|
|
|
|
|
public JSONObject findPatientNoAssistant(String doctor,Integer page,Integer size)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
param.put("page",page);
|
|
|
param.put("size",size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/findPatientNoAssistant",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
public JSONObject findPatientNoAssistant(String doctor, Integer page, Integer size) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
param.put("page", page);
|
|
|
param.put("size", size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientNoAssistant", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs;
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<SignPatientLabel> findLabelbyType(String type,Long teamCode){
|
|
|
public List<SignPatientLabel> findLabelbyType(String type, Long teamCode) {
|
|
|
//自定义标签
|
|
|
if("4".equals(type)){
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatusAndTeamCode(type,1,teamCode);
|
|
|
if ("4".equals(type)) {
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatusAndTeamCode(type, 1, teamCode);
|
|
|
return list;
|
|
|
}else{
|
|
|
} else {
|
|
|
//非自定义标签
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatus(type,1);
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatus(type, 1);
|
|
|
return list;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> findLabelAndPatientCount(String doctor,String type,Long teamCode)throws Exception{
|
|
|
public List<Map<String, Object>> findLabelAndPatientCount(String doctor, String type, Long teamCode) throws Exception {
|
|
|
//自定义标签
|
|
|
if("4".equals(type)){
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatusAndTeamCode(type,1,teamCode);
|
|
|
if ("4".equals(type)) {
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatusAndTeamCode(type, 1, teamCode);
|
|
|
|
|
|
return setPatientCount(list,doctor);
|
|
|
}else{
|
|
|
return setPatientCount(list, doctor);
|
|
|
} else {
|
|
|
//非自定义标签
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatus(type,1);
|
|
|
List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatus(type, 1);
|
|
|
|
|
|
return setPatientCount(list,doctor);
|
|
|
return setPatientCount(list, doctor);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> setPatientCount(List<SignPatientLabel> list,String doctor)throws Exception{
|
|
|
List<Map<String,Object>> rs = new ArrayList<>();
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(SignPatientLabel label:list){
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
map.put("label",label.getLabelCode());
|
|
|
map.put("labelName",label.getLabelName());
|
|
|
map.put("labelType",label.getLabelType());
|
|
|
map.put("count",getLabelpatientCount(doctor,label.getLabelCode(),label.getLabelType()));
|
|
|
public List<Map<String, Object>> setPatientCount(List<SignPatientLabel> list, String doctor) throws Exception {
|
|
|
List<Map<String, Object>> rs = new ArrayList<>();
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (SignPatientLabel label : list) {
|
|
|
Map<String, Object> map = new HashedMap();
|
|
|
map.put("label", label.getLabelCode());
|
|
|
map.put("labelName", label.getLabelName());
|
|
|
map.put("labelType", label.getLabelType());
|
|
|
map.put("count", getLabelpatientCount(doctor, label.getLabelCode(), label.getLabelType()));
|
|
|
rs.add(map);
|
|
|
}
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public Long getLabelpatientCount(String doctor,String labelType,String labelCode)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
param.put("labelType",labelType);
|
|
|
param.put("labelCode",labelCode);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/getLabelpatientCount",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
public Long getLabelpatientCount(String doctor, String labelType, String labelCode) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
param.put("labelType", labelType);
|
|
|
param.put("labelCode", labelCode);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getLabelpatientCount", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getLong("obj");
|
|
|
}
|
|
|
return 0L;
|
|
|
}
|
|
|
|
|
|
|
|
|
public Long findSpecialistPatientRelationCout(String doctor)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/findSpecialistPatientRelationCout",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
public Long findSpecialistPatientRelationCout(String doctor) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findSpecialistPatientRelationCout", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getLong("obj");
|
|
|
}
|
|
|
return 0L;
|
|
|
}
|
|
|
|
|
|
public JSONArray findNoLabelPatientRelation(String doctor)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/findNoLabelPatientRelation",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
public JSONArray findNoLabelPatientRelation(String doctor) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findNoLabelPatientRelation", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getJSONArray("obj");
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public JSONArray findPatientRelatioByAssistant(String doctor,String assistant,Integer page,Integer size)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
param.put("assistant",assistant);
|
|
|
param.put("page",page);
|
|
|
param.put("size",size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/findPatientRelatioByAssistant",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
public JSONArray findPatientRelatioByAssistant(String doctor, String assistant, Integer page, Integer size) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
param.put("assistant", assistant);
|
|
|
param.put("page", page);
|
|
|
param.put("size", size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientRelatioByAssistant", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getJSONArray("obj");
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
public Boolean saveHealthAssistant(String json)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("json",json);
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl+"svr-specialist/saveHealthAssistant",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
public Boolean saveHealthAssistant(String json) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("json", json);
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/saveHealthAssistant", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getBoolean("obj");
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public JSONArray getPatientByLabel(String doctor,String labelType,String labelCode,Integer page,Integer size)throws Exception{
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
param.put("labelType",labelType);
|
|
|
param.put("labelCode",labelCode);
|
|
|
param.put("page",page);
|
|
|
param.put("size",size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/getPatientByLabel",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
public JSONArray getPatientByLabel(String doctor, String labelType, String labelCode, Integer page, Integer size) throws Exception {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
param.put("labelType", labelType);
|
|
|
param.put("labelCode", labelCode);
|
|
|
param.put("page", page);
|
|
|
param.put("size", size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getPatientByLabel", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getJSONArray("obj");
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public Map<String,Object> findDoctorTeamMenmber(String doctor){
|
|
|
public Map<String, Object> findDoctorTeamMenmber(String doctor) {
|
|
|
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
Map<String, Object> rs = new HashedMap();
|
|
|
|
|
|
AdminTeam adminTeam = doctorAdminTeamDao.findByLeaderCode(doctor);
|
|
|
AdminTeam adminTeam = doctorAdminTeamDao.findByLeaderCode(doctor);
|
|
|
|
|
|
rs.put("adminTeam",adminTeam);
|
|
|
rs.put("adminTeam", adminTeam);
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
" d.`code`, " +
|
|
@ -269,16 +295,16 @@ public class SpecialistService extends BaseService {
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team t " +
|
|
|
" WHERE " +
|
|
|
" t.leader_code = '"+doctor+"' " +
|
|
|
" t.leader_code = '" + doctor + "' " +
|
|
|
" )";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
rs.put("member",list);
|
|
|
rs.put("member", list);
|
|
|
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> getDoctorInHospital(String doctor,String name,Integer page,Integer size){
|
|
|
public List<Map<String, Object>> getDoctorInHospital(String doctor, String name, Integer page, Integer size) {
|
|
|
String sql = "SELECT " +
|
|
|
" d. name, " +
|
|
|
" d. code, " +
|
|
@ -296,31 +322,200 @@ public class SpecialistService extends BaseService {
|
|
|
" FROM " +
|
|
|
" wlyy_doctor dd " +
|
|
|
" WHERE " +
|
|
|
" dd. CODE = '"+doctor+"' " +
|
|
|
" ) " ;
|
|
|
if(StringUtils.isNotBlank(name)){
|
|
|
sql = sql +" AND d.`name` LIKE '%"+name+"%'";
|
|
|
" dd. CODE = '" + doctor + "' " +
|
|
|
" ) ";
|
|
|
if (StringUtils.isNotBlank(name)) {
|
|
|
sql = sql + " AND d.`name` LIKE '%" + name + "%'";
|
|
|
}
|
|
|
|
|
|
sql = sql +" LIMIT "+(page-1)*size+","+size;
|
|
|
sql = sql + " LIMIT " + (page - 1) * size + "," + size;
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public JSONArray getDoctorPatientByName(String doctor,String nameKey,Integer page,Integer size) throws Exception{
|
|
|
public JSONArray getDoctorPatientByName(String doctor, String nameKey, Integer page, Integer size) throws Exception {
|
|
|
|
|
|
Map<String,Object> param = new HashedMap();
|
|
|
param.put("doctor",doctor);
|
|
|
param.put("nameKey",nameKey);
|
|
|
param.put("page",page);
|
|
|
param.put("size",size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl+"svr-specialist/getDoctorPatientByName",param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if("succes".equals(rs.getString("message"))){
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
param.put("nameKey", nameKey);
|
|
|
param.put("page", page);
|
|
|
param.put("size", size);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getDoctorPatientByName", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
return rs.getJSONArray("obj");
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getSpecialistTeamList(String doctor) {
|
|
|
String sql = "SELECT " +
|
|
|
" t.id, " +
|
|
|
" t.name, " +
|
|
|
" d.photo " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team t " +
|
|
|
" JOIN wlyy_admin_team_member m ON t.id = m.team_id " +
|
|
|
" JOIN wlyy_doctor d ON d.code = t.leader_code " +
|
|
|
" WHERE " +
|
|
|
" m.doctor_code = '" + doctor + "' " +
|
|
|
" AND t.available ='1' " +
|
|
|
" AND m.available ='1' ";
|
|
|
List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
if (rs != null && rs.size() > 0) {
|
|
|
for (Map<String, Object> team : rs) {
|
|
|
Integer id = (Integer) team.get("id");
|
|
|
String sqlMember = "SELECT " +
|
|
|
" d.name, " +
|
|
|
" d.code " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team_member m " +
|
|
|
" JOIN wlyy_doctor d ON m.doctor_code = d.`code` " +
|
|
|
" WHERE " +
|
|
|
" m.team_id =" + id +
|
|
|
" AND m.available='1'";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sqlMember);
|
|
|
team.put("doctors", list);
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> findSpecialistTeamInfo(String doctor, Long teamCode) {
|
|
|
String sql = "SELECT t.id, " +
|
|
|
" t. NAME, " +
|
|
|
" d.photo " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team t " +
|
|
|
" JOIN wlyy_admin_team_member m ON t.id = m.team_id " +
|
|
|
" JOIN wlyy_doctor d ON d. CODE = t.leader_code " +
|
|
|
" WHERE " +
|
|
|
" m.doctor_code = '" + doctor + "' " +
|
|
|
" AND t.available = '1' " +
|
|
|
" AND m.available = '1' " +
|
|
|
" ANd m.team_id=" + teamCode;
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
Map<String, Object> map = list.get(0);
|
|
|
String sqlMember = "SELECT " +
|
|
|
" d.name, " +
|
|
|
" d.code " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team_member m " +
|
|
|
" JOIN wlyy_doctor d ON m.doctor_code = d.`code` " +
|
|
|
" WHERE " +
|
|
|
" m.team_id =" + teamCode +
|
|
|
" AND m.available='1'";
|
|
|
List<Map<String, Object>> members = jdbcTemplate.queryForList(sqlMember);
|
|
|
map.put("doctors", members);
|
|
|
return map;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public List<TeamDiseaseRelation> findTeamDiseaseRelation(Long teamCode) {
|
|
|
return teamDiseaseRelationDao.findByTeamCodeAndDel(teamCode, "1");
|
|
|
}
|
|
|
|
|
|
public List<PatientDiseaseServer> findPatientDiseaseServerList(String patient) {
|
|
|
return patientDiseaseServerDao.findByPatientAndDel(patient, "1");
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> signSpecialist(String patient, String doctor, String disease, Long teamCode) throws Exception {
|
|
|
|
|
|
Map<String, Object> mes = new HashedMap();
|
|
|
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
Doctor d = doctorDao.findByCode(doctor);
|
|
|
SpecialDisease dis = specialDiseaseDao.findByCode(disease);
|
|
|
if (p != null && d != null && dis != null) {
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctor", doctor);
|
|
|
param.put("doctorName", d.getName());
|
|
|
param.put("patient", patient);
|
|
|
param.put("patientName", p.getName());
|
|
|
param.put("teamCode", teamCode);
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/signSpecialistTeam", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
// 保存居民病种
|
|
|
PatientDiseaseServer server = new PatientDiseaseServer();
|
|
|
server.setCode(getCode());
|
|
|
server.setDel("1");
|
|
|
server.setSpecialistRelationCode(rs.getString("obj"));
|
|
|
server.setPatient(patient);
|
|
|
server.setPatientName(p.getName());
|
|
|
server.setDisease(dis.getCode());
|
|
|
server.setDiseaseName(dis.getName());
|
|
|
server.setCreateTime(new Date());
|
|
|
patientDiseaseServerDao.save(server);
|
|
|
|
|
|
// 添加签约申请消息
|
|
|
Message message = new Message();
|
|
|
message.setCzrq(new Date());
|
|
|
message.setCreateTime(new Date());
|
|
|
message.setContent("您有一个居民申请共管服务!");
|
|
|
message.setRead(1);//设置未读
|
|
|
message.setReceiver(doctor);//设置接受医生的code
|
|
|
message.setSender(patient);//设置发送的用户
|
|
|
message.setSenderName(p.getName());
|
|
|
message.setCode(getCode());
|
|
|
message.setSenderPhoto(p.getPhoto());
|
|
|
message.setTitle("专科医生共管申请");
|
|
|
message.setType(16);//家庭签约取消信息
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
message.setSex(p.getSex());
|
|
|
message.setOver("1");//未处理
|
|
|
message.setRelationCode(rs.getString("obj"));
|
|
|
message.setDel("1");
|
|
|
message.setState(1);
|
|
|
messageDao.save(message);
|
|
|
|
|
|
|
|
|
mes.put("code", 1);
|
|
|
mes.put("mes", "签约成功!");
|
|
|
mes.put("data", "");
|
|
|
return mes;
|
|
|
} else if ("doctor_exist".equals(rs.getString("message"))) {
|
|
|
mes.put("code", -1);
|
|
|
mes.put("mes", "医生与患者已经签约");
|
|
|
mes.put("data", rs.getJSONObject("obj"));
|
|
|
} else if ("team_exist".equals(rs.getString("message"))){
|
|
|
mes.put("code", -2);
|
|
|
mes.put("mes", "团队与患者已经签约");
|
|
|
mes.put("data", rs.getJSONObject("obj"));
|
|
|
} else {
|
|
|
logger.info(response.getContent());
|
|
|
}
|
|
|
}
|
|
|
mes.put("code",-3);
|
|
|
mes.put("mes","获取居民信息失败");
|
|
|
mes.put("data", "");
|
|
|
return mes;
|
|
|
}
|
|
|
|
|
|
public String agreeSpecialistTeam(String state,String relationCode,String remark,Long mesId)throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("state", state);
|
|
|
param.put("relationCode", relationCode);
|
|
|
param.put("remark", remark);
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/agreeSpecialistTeam", param);
|
|
|
JSONObject rs = new JSONObject(response.getContent());
|
|
|
if ("succes".equals(rs.getString("message"))) {
|
|
|
|
|
|
if(mesId!=null){
|
|
|
Message m = messageDao.findOne(mesId);
|
|
|
m.setOver("0");
|
|
|
m.setRead(0);
|
|
|
messageDao.save(m);
|
|
|
}
|
|
|
return "1";
|
|
|
}
|
|
|
return "0";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|