|
@ -0,0 +1,2033 @@
|
|
|
package com.yihu.wlyy.web.doctor.account;
|
|
|
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.DoctorComment;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
import com.yihu.wlyy.entity.organization.HospitalDept;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
|
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
|
|
|
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
|
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
|
import com.yihu.wlyy.service.app.account.PatientInfoService;
|
|
|
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
|
|
|
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
|
|
|
import com.yihu.wlyy.service.app.hospital.HospitalDeptService;
|
|
|
import com.yihu.wlyy.service.app.hospital.HospitalService;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.app.sign.FamilyContractService;
|
|
|
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
|
|
|
import com.yihu.wlyy.service.common.account.RoleService;
|
|
|
import com.yihu.wlyy.service.common.account.TokenService;
|
|
|
import com.yihu.wlyy.util.CommonUtil;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.IdcardValidator;
|
|
|
import com.yihu.wlyy.util.RSAUtils;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
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.domain.Page;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* 用户注册的Controller.
|
|
|
*
|
|
|
* @author calvin
|
|
|
*/
|
|
|
@Controller
|
|
|
@RequestMapping(value = "/doctor", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@Api(description = "医生")
|
|
|
public class DoctorController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private DoctorInfoService doctorInfoService;
|
|
|
@Autowired
|
|
|
private TokenService tokenService;
|
|
|
@Autowired
|
|
|
private DoctorCommentService doctorCommentService;
|
|
|
@Autowired
|
|
|
private DrHealthTeamService drHealthTeamService;
|
|
|
@Autowired
|
|
|
private FamilyContractService familyContractService;
|
|
|
@Autowired
|
|
|
private ConsultTeamService consultTeamService;
|
|
|
@Autowired
|
|
|
private HospitalService hospitalService;
|
|
|
@Autowired
|
|
|
private SocialSecurityInfoDao socialSecurityInfoDao;
|
|
|
@Autowired
|
|
|
private PatientInfoService patientInfoService;
|
|
|
@Autowired
|
|
|
private HospitalDeptService hospitalDeptService;
|
|
|
@Autowired
|
|
|
private HospitalDeptService deptService;
|
|
|
@Autowired
|
|
|
private DoctorWorkTimeService workTimeService;
|
|
|
@Autowired
|
|
|
StringRedisTemplate redisTemplate;
|
|
|
@Autowired
|
|
|
private RoleService roleService;
|
|
|
@Autowired
|
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
|
@Autowired
|
|
|
SignPatientLabelDao labelDao;
|
|
|
@Autowired
|
|
|
private CommonUtil CommonUtil;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 社区医院下医生列表查询接口 没分页
|
|
|
*
|
|
|
* @param hospital 医院标识
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("社区医院下医生列表查询接口 没分页")
|
|
|
@RequestMapping(value = "getDoctorsByhospitalNoPage",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getDoctorsByhospitalNoPage(
|
|
|
@RequestParam(required = false) String hospital,
|
|
|
@RequestParam(required = false) String name,
|
|
|
@RequestParam(required = false) Integer type) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
List<Map<String, Object>> list = familyContractService.getDoctorsByhospitalNoPage(hospital, name, type);
|
|
|
if (list != null) {
|
|
|
for (Map<String, Object> doctor : list) {
|
|
|
if (doctor == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.get("id"));
|
|
|
// 医生标识
|
|
|
json.put("code", doctor.get("code"));
|
|
|
// 医生姓名
|
|
|
json.put("name", doctor.get("name"));
|
|
|
// 所在医院名称
|
|
|
json.put("hospital", doctor.get("hospital"));
|
|
|
// 所在医院名称
|
|
|
json.put("hospital_name", doctor.get("hospital_name"));
|
|
|
// 科室名称
|
|
|
json.put("dept_name", (doctor.get("dept_name") == null ||
|
|
|
StringUtils.isEmpty(doctor.get("dept_name").toString())) ? " " : doctor.get("dept_name"));
|
|
|
// 职称名称
|
|
|
json.put("job_name", (doctor.get("job_name") == null ||
|
|
|
StringUtils.isEmpty(doctor.get("job_name").toString())) ? " " : doctor.get("job_name"));
|
|
|
// 头像
|
|
|
json.put("photo", doctor.get("photo"));
|
|
|
// 简介
|
|
|
json.put("introduce", doctor.get("introduce"));
|
|
|
// 专长
|
|
|
json.put("expertise", doctor.get("expertise"));
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "获取医院医生列表成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取医院医生列表失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 社区医院下医生列表查询接口 有分页
|
|
|
*
|
|
|
* @param hospital 医院标识
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("社区医院下医生列表查询接口 有分页")
|
|
|
@RequestMapping(value = "getDoctorsByhospital",method ={RequestMethod.POST,RequestMethod.GET})
|
|
|
@ResponseBody
|
|
|
public String getDoctorsByhospital(
|
|
|
@RequestParam(required = false) String hospital, //医院code
|
|
|
@RequestParam(required = false) String city, //市代码
|
|
|
@RequestParam(required = false) String town, //区代码
|
|
|
@RequestParam(required = false) Integer type,
|
|
|
@RequestParam(required = false) String name, //名称
|
|
|
@RequestParam(required = true) Long id,
|
|
|
@RequestParam(required = true) Integer pagesize) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Doctor> list = familyContractService.findDoctors(hospital, city, town, name, type, id, pagesize);
|
|
|
if (list != null) {
|
|
|
for (Doctor doctor : list) {
|
|
|
if (doctor == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
// 医生标识
|
|
|
json.put("code", doctor.getCode());
|
|
|
// 医生姓名
|
|
|
json.put("name", doctor.getName());
|
|
|
// 所在医院名称
|
|
|
json.put("hospital_name", doctor.getHospitalName());
|
|
|
// 科室名称
|
|
|
json.put("dept_name", StringUtils.isEmpty(doctor.getDeptName()) ? " " : doctor.getDeptName());
|
|
|
// 职称名称
|
|
|
json.put("job_name", StringUtils.isEmpty(doctor.getJobName()) ? " " : doctor.getJobName());
|
|
|
// 头像
|
|
|
json.put("photo", doctor.getPhoto());
|
|
|
// 简介
|
|
|
json.put("introduce", doctor.getIntroduce());
|
|
|
// 专长
|
|
|
json.put("expertise", doctor.getExpertise());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "获取医院医生列表成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取医院医生列表失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 社区医院列表查询接口
|
|
|
*
|
|
|
* @param type 医院类型:0全部,1大医院,2社区医院
|
|
|
* @param province 患标识
|
|
|
* @param city 城市标识
|
|
|
* @param key 搜索关键字,用于搜索医院名称
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("社区医院列表查询接口")
|
|
|
@RequestMapping(value = "hospitals",method ={RequestMethod.POST,RequestMethod.GET})
|
|
|
@ResponseBody
|
|
|
public String hospitals(
|
|
|
int type,
|
|
|
@RequestParam(required = false) String province,
|
|
|
@RequestParam(required = false) String city,
|
|
|
@RequestParam(required = false) String town,
|
|
|
@RequestParam(required = false) String key,
|
|
|
long id,
|
|
|
int pagesize) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Hospital> list = familyContractService.findHospitals(type, province, city, town, key, id, pagesize);
|
|
|
if (list != null) {
|
|
|
for (Hospital hospital : list) {
|
|
|
if (hospital == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", hospital.getId());
|
|
|
// 医院标识
|
|
|
json.put("code", hospital.getCode());
|
|
|
// 医院名称
|
|
|
json.put("name", hospital.getName());
|
|
|
// 省名
|
|
|
json.put("province_name", hospital.getProvinceName());
|
|
|
// 城市名
|
|
|
json.put("city_name", hospital.getCityName());
|
|
|
// 区县名
|
|
|
json.put("town_name", hospital.getTownName());
|
|
|
// 详细地址
|
|
|
json.put("address", hospital.getAddress());
|
|
|
// 简介
|
|
|
json.put("intro", hospital.getIntro());
|
|
|
// 医院图片
|
|
|
json.put("photo", hospital.getPhoto());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "获取医院列表成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取医院列表失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询存在医生的医院列表
|
|
|
*
|
|
|
* @param type 类型 1:医院 2社区
|
|
|
* @param province 省份
|
|
|
* @param city 城市
|
|
|
* @param town 城镇
|
|
|
* @param key 名字搜索
|
|
|
* @param page 第几页
|
|
|
* @param pagesize 页大小
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("查询存在医生的医院列表")
|
|
|
@RequestMapping(value = "hospitals_list",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String hospitalL(@RequestParam(required = true) int type,
|
|
|
@RequestParam(required = false) String province,
|
|
|
@RequestParam(required = false) String city,
|
|
|
@RequestParam(required = false) String town,
|
|
|
@RequestParam(required = false) String key,
|
|
|
@RequestParam(required = true) int page,
|
|
|
@RequestParam(required = true) int pagesize) {
|
|
|
try {
|
|
|
if (type != 1 && type != 2) {
|
|
|
return error(-1, "医院类型错误");
|
|
|
}
|
|
|
|
|
|
page = page >= 1 ? page - 1 : 0;
|
|
|
|
|
|
List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key,null, page, pagesize);
|
|
|
|
|
|
return write(200, "查询成功", "data", hos);
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询某个医院存在医生科室列表
|
|
|
*
|
|
|
* @param hospital 医院
|
|
|
* @param key 科室名字搜索
|
|
|
* @param page 第几页
|
|
|
* @param pagesize 页大小
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("查询某个医院存在医生科室列表")
|
|
|
@RequestMapping(value = "/dept_list",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String deptList(@RequestParam(required = true) String hospital,
|
|
|
@RequestParam(required = false) String key,
|
|
|
@RequestParam(required = true) int page,
|
|
|
@RequestParam(required = true) int pagesize) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(hospital)) {
|
|
|
return error(-1, "医院不能为空");
|
|
|
}
|
|
|
page = page >= 1 ? page - 1 : 0;
|
|
|
List<HospitalDept> dept = deptService.getHospitalDept(hospital, key, page, pagesize);
|
|
|
|
|
|
return write(200, "查询成功", "data", dept);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据科室查询当前在工作医生
|
|
|
*
|
|
|
* @param dept
|
|
|
* @param hospital
|
|
|
* @param level
|
|
|
* @param key
|
|
|
* @param page
|
|
|
* @param pagesize
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据科室查询当前在工作医生")
|
|
|
@RequestMapping(value = "/doctors_list",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String findWorkingDoctorByDept(@RequestParam(required = false) String dept,
|
|
|
@RequestParam(required = false) String hospital,
|
|
|
@RequestParam(required = false, defaultValue = "1") String level,
|
|
|
@RequestParam(required = false, defaultValue = "") String key,
|
|
|
@RequestParam(required = false, defaultValue = "1") int page,
|
|
|
@RequestParam(required = false, defaultValue = "15") int pagesize) {
|
|
|
try {
|
|
|
if (page >= 1) {
|
|
|
page = page - 1;
|
|
|
}
|
|
|
JSONArray doctors = doctorInfoService.findWorkingDoctorListByDept(dept, hospital, level, key, page, pagesize);
|
|
|
return write(200, "查询成功", "data", doctors);
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据机构查找科室
|
|
|
*
|
|
|
* @param hospital 机构code
|
|
|
* @param key 科室名称
|
|
|
* @param id 主键
|
|
|
* @param pagesize 每页显示条数
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据机构查找科室")
|
|
|
@RequestMapping(value = "findDeptByHsoptail",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String findDeptByHsoptail(
|
|
|
String hospital,
|
|
|
@RequestParam(required = false) String key,
|
|
|
long id,
|
|
|
int pagesize) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<HospitalDept> list = hospitalDeptService.findDeptByHsoptail(hospital, key, id, pagesize);
|
|
|
if (list != null) {
|
|
|
for (HospitalDept dept : list) {
|
|
|
if (hospital == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", dept.getId());
|
|
|
// 科室标识
|
|
|
json.put("code", dept.getCode());
|
|
|
// 科室名称
|
|
|
json.put("name", dept.getName());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "获取科室列表成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取科室列表失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据科室查找医生
|
|
|
*
|
|
|
* @param dept 科室code
|
|
|
* @param key 医生名称
|
|
|
* @param page 当前页
|
|
|
* @param pagesize 每页显示条数
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据科室查找医生")
|
|
|
@RequestMapping(value = "findDoctorByDept",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String findDoctorByDept(
|
|
|
@RequestParam(required = false) String dept,
|
|
|
@RequestParam(required = false) String hosptial,
|
|
|
@RequestParam(required = false) String key,
|
|
|
int page,
|
|
|
int pagesize) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Doctor> list = doctorInfoService.findDoctorByDept(dept, hosptial, key, page, pagesize);
|
|
|
if (list != null) {
|
|
|
for (Doctor doctor : list) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
json.put("photo", doctor.getPhoto());
|
|
|
json.put("sex", doctor.getSex());
|
|
|
String sexName = "";
|
|
|
switch (doctor.getSex()) {
|
|
|
case 1:
|
|
|
sexName = "男";
|
|
|
break;
|
|
|
case 2:
|
|
|
sexName = "女";
|
|
|
break;
|
|
|
}
|
|
|
json.put("sexName", sexName);
|
|
|
json.put("job", doctor.getJob());
|
|
|
json.put("jobName", doctor.getJobName());
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
json.put("dept", doctor.getDept());
|
|
|
json.put("deptName", doctor.getDeptName());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "获取科室列表成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取科室列表失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 名医列表
|
|
|
*
|
|
|
* @param key 医生名称
|
|
|
* @param type 是否是名医 1是 0不是
|
|
|
* @param level 医生的等级 1专科医生,2全科医生,3健康管理师 不传默认是全部
|
|
|
* @param page 当前页
|
|
|
* @param pagesize 每页显示条数
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("名医列表")
|
|
|
@RequestMapping(value = "findFamousDoctor",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String findFamousDoctor(
|
|
|
@RequestParam(required = false) String key,
|
|
|
@RequestParam(required = false) Integer level,
|
|
|
Integer type,
|
|
|
int page,
|
|
|
int pagesize) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
List<Doctor> list = doctorInfoService.findFamousDoctorList(key, type, page, pagesize, level);
|
|
|
if (list != null) {
|
|
|
for (Doctor doctor : list) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
json.put("photo", doctor.getPhoto());
|
|
|
json.put("sex", doctor.getSex());
|
|
|
String sexName = "";
|
|
|
switch (doctor.getSex()) {
|
|
|
case 1:
|
|
|
sexName = "男";
|
|
|
break;
|
|
|
case 2:
|
|
|
sexName = "女";
|
|
|
break;
|
|
|
}
|
|
|
json.put("sexName", sexName);
|
|
|
json.put("job", doctor.getJob());
|
|
|
json.put("jobName", doctor.getJobName());
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
json.put("dept", doctor.getDept());
|
|
|
json.put("deptName", doctor.getDeptName());
|
|
|
json.put("expertise", doctor.getExpertise());
|
|
|
json.put("isworking", 1);
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "获取名医列表成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取名医列表失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 退出登录
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("退出登录")
|
|
|
@RequestMapping(value = "loginout",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String loginout() {
|
|
|
try {
|
|
|
tokenService.delToken(2, getUID());
|
|
|
return success("已成功退出!");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "操作失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 医生基本信息查询接口
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("医生基本信息查询接口")
|
|
|
@RequestMapping(value = "baseinfo",method ={RequestMethod.POST,RequestMethod.GET})
|
|
|
@ResponseBody
|
|
|
public String baseinfo(
|
|
|
@RequestParam(required = false) String code) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
code = getUID();
|
|
|
}
|
|
|
Doctor temp = doctorInfoService.findDoctorByCode(code);
|
|
|
Integer leader = doctorAdminTeamDao.findLeader(code);
|
|
|
if (temp != null) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
// 设置医生手机号码
|
|
|
json.put("mobile", temp.getMobile());
|
|
|
// 设置医生标识
|
|
|
json.put("code", temp.getCode());
|
|
|
// 设置医生姓名
|
|
|
json.put("name", temp.getName());
|
|
|
// 设置医生头像
|
|
|
json.put("photo", temp.getPhoto());
|
|
|
// 设置医生性别
|
|
|
json.put("sex", temp.getSex());
|
|
|
// 设置省名称
|
|
|
json.put("provinceName", temp.getProvinceName());
|
|
|
// 设置城市名称
|
|
|
json.put("cityName", temp.getCityName());
|
|
|
// 设置医院名称
|
|
|
json.put("hospitalName", temp.getHospitalName());
|
|
|
// 设置医院
|
|
|
json.put("hospital", temp.getHospital());
|
|
|
// 设置部门名称
|
|
|
json.put("deptName", StringUtils.isNotEmpty(temp.getDeptName()) ? temp.getDeptName() : "");
|
|
|
// 设置职称
|
|
|
json.put("jobName", StringUtils.isNotEmpty(temp.getJobName()) ? temp.getJobName() : "");
|
|
|
// 设置医生专长
|
|
|
json.put("expertise", StringUtils.isNotEmpty(temp.getExpertise()) ? temp.getExpertise() : "");
|
|
|
// 设置医生简介
|
|
|
json.put("introduce", StringUtils.isNotEmpty(temp.getIntroduce()) ? temp.getIntroduce() : "");
|
|
|
// 二维码地址
|
|
|
json.put("qrcode", temp.getQrcode());
|
|
|
// 审核总数
|
|
|
json.put("signed_amount", familyContractService.countAmountSigned(getUID()));
|
|
|
// 等审核总数
|
|
|
json.put("unsign_amount", familyContractService.countAmountUnsign(getUID()));
|
|
|
// 咨询统计
|
|
|
Map<String, Long> consultCount = consultTeamService.getAllCount(getUID());
|
|
|
// 咨询总数
|
|
|
json.put("consultAmount", consultCount.get("all"));
|
|
|
// 当天咨询数
|
|
|
json.put("consultAmountToday", consultCount.get("today"));
|
|
|
//身份类型
|
|
|
json.put("level", temp.getLevel().intValue());
|
|
|
//身份证号
|
|
|
json.put("idcard", temp.getIdcard());
|
|
|
//是否认证
|
|
|
json.put("isCertified", temp.getIscertified());
|
|
|
//是否名医
|
|
|
json.put("isFamous", temp.getIsFamous());
|
|
|
//是否医生提示 提示过是1 其他都是0
|
|
|
json.put("isPasswordPrompt", StringUtils.isEmpty(temp.getIsPasswordPrompt()) ? "0" : temp.getIsPasswordPrompt());
|
|
|
//获取医生角色和区域权限
|
|
|
List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(temp.getCode());
|
|
|
json.put("userRole", roleMap);
|
|
|
json.put("evaluateScore", temp.getEvaluateScore());
|
|
|
// 是否团队长
|
|
|
json.put("isLeader", leader == null ? "0" : "1");
|
|
|
// 团队长所管辖的团队code 一个团队长只管辖一个团队
|
|
|
json.put("adminTeamCode", leader);
|
|
|
return write(200, "医生信息查询成功!", "data", json);
|
|
|
} else {
|
|
|
return error(-1, "医生信息查询失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "医生信息查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 医生基本信息查询接口
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("医生基本信息查询接口")
|
|
|
@RequestMapping(value = "baseinfoCount",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String baseinfoCount(
|
|
|
String doctorType) {
|
|
|
try {
|
|
|
Doctor temp = doctorInfoService.findDoctorByCode(getUID());
|
|
|
if (temp != null) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
int count = familyContractService.countAmountSigned(getUID());
|
|
|
// 审核总数
|
|
|
json.put("signed_amount", count);
|
|
|
|
|
|
int count1 = familyContractService.countAmountUnsign(getUID());
|
|
|
// 等审核总数
|
|
|
json.put("unsign_amount", count1);
|
|
|
return write(200, "医生信息查询成功!", "data", json);
|
|
|
} else {
|
|
|
return error(-1, "医生信息查询失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "医生信息查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 患者基本信息保存
|
|
|
*
|
|
|
* @param photo 頭像
|
|
|
* @param sex 性別
|
|
|
* @param expertise 专长
|
|
|
* @param introduce 简介
|
|
|
* @param province 省标识
|
|
|
* @param city 市标识
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("患者基本信息保存")
|
|
|
@RequestMapping(value = "save",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String save(
|
|
|
@RequestParam(required = false) String photo,
|
|
|
@RequestParam(required = false) Integer sex,
|
|
|
@RequestParam(required = false) String expertise,
|
|
|
@RequestParam(required = false) String introduce,
|
|
|
@RequestParam(required = false) String province,
|
|
|
@RequestParam(required = false) String city,
|
|
|
@RequestParam(required = false) String mobile) {
|
|
|
try {
|
|
|
Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
|
|
|
|
|
|
if (StringUtils.isNotEmpty(mobile)) {
|
|
|
if (!mobile.equals(doctor.getMobile())) {
|
|
|
if (doctorInfoService.findNormalByMobile(mobile) != null) {
|
|
|
return error(-2, "该手机号码已被注册!");
|
|
|
}
|
|
|
doctor.setMobile(mobile);
|
|
|
}
|
|
|
}
|
|
|
// 设置头像
|
|
|
if (StringUtils.isNotEmpty(photo)) {
|
|
|
photo = CommonUtil.copyTempImage(photo);
|
|
|
if (StringUtils.isNotEmpty(photo)) {
|
|
|
doctor.setPhoto(photo);
|
|
|
}
|
|
|
}
|
|
|
// 设置性别
|
|
|
if (sex != null) {
|
|
|
doctor.setSex(sex);
|
|
|
}
|
|
|
// 设置生日
|
|
|
// if (StringUtils.isNotEmpty(birthday)) {
|
|
|
// doctor.setBirthday(DateUtil.strToDate(birthday, DateUtil.YYYY_MM_DD));
|
|
|
// }
|
|
|
// 设置医生专长
|
|
|
if (StringUtils.isNotEmpty(expertise)) {
|
|
|
doctor.setExpertise(expertise);
|
|
|
}
|
|
|
// 设置介绍内容
|
|
|
if (StringUtils.isNotEmpty(introduce)) {
|
|
|
doctor.setIntroduce(introduce);
|
|
|
}
|
|
|
// 设置省份标识
|
|
|
if (StringUtils.isNotEmpty(province)) {
|
|
|
doctor.setProvince(province);
|
|
|
}
|
|
|
// 设置城市标识
|
|
|
if (StringUtils.isNotEmpty(city)) {
|
|
|
doctor.setCity(city);
|
|
|
}
|
|
|
// 设置区县标识
|
|
|
// if (StringUtils.isNotEmpty(town)) {
|
|
|
// doctor.setTown(town);
|
|
|
// }
|
|
|
// 设置医院标识
|
|
|
// if (StringUtils.isNotEmpty(hospital)) {
|
|
|
// doctor.setHospital(hospital);
|
|
|
// }
|
|
|
// // 设置部门标识
|
|
|
// if (StringUtils.isNotEmpty(dept)) {
|
|
|
// doctor.setDept(dept);
|
|
|
// }
|
|
|
// // 设置职称
|
|
|
// if (StringUtils.isNotEmpty(job)) {
|
|
|
// doctor.setJob(job);
|
|
|
// }
|
|
|
if (doctorInfoService.updateDoctor(doctor) != null) {
|
|
|
// 修改成功
|
|
|
return write(200, "保存成功!", "data", doctor.getPhoto());
|
|
|
} else {
|
|
|
// 注册失败
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "保存失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 患者评价查询接口
|
|
|
*
|
|
|
* @param id 最后一个id
|
|
|
* @param pagesize 分页大小
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("患者评价查询接口")
|
|
|
@RequestMapping(value = "comments",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String comments(Integer id, Integer pagesize) {
|
|
|
try {
|
|
|
Page<DoctorComment> page = doctorCommentService.findByDoctor(getUID(), id, pagesize);
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (page != null) {
|
|
|
for (DoctorComment dc : page) {
|
|
|
if (dc == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
// id
|
|
|
json.put("id", dc.getId());
|
|
|
// 评价人姓名
|
|
|
json.put("name", dc.getUname());
|
|
|
// 设置评价内容
|
|
|
json.put("content", dc.getContent());
|
|
|
// 评价星级
|
|
|
json.put("star", dc.getStar());
|
|
|
// 评价类型:1视频咨询评价、2图文咨询评价
|
|
|
json.put("type", dc.getType());
|
|
|
// 评价时间
|
|
|
json.put("czrq", DateUtil.dateToStrLong(dc.getCzrq()));
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", page, array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据类别获取医院列表
|
|
|
*
|
|
|
* @param type
|
|
|
* @param query 查询条件 医院名称
|
|
|
* @param id
|
|
|
* @param pageSize 页数
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据类别获取医院列表")
|
|
|
@RequestMapping(value = "/hospital_list",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getHospitalList(
|
|
|
@RequestParam(required = true) Integer type,
|
|
|
@RequestParam(required = false) String query,
|
|
|
@RequestParam(required = true) long id,
|
|
|
@RequestParam(required = true) Integer pageSize) {
|
|
|
try {
|
|
|
|
|
|
Page<Hospital> hospitalList = hospitalService.getHospitalList(query, type, id, pageSize);
|
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (hospitalList != null) {
|
|
|
for (Hospital hospital : hospitalList) {
|
|
|
if (hospital == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", hospital.getId());
|
|
|
json.put("code", hospital.getCode());
|
|
|
json.put("name", hospital.getName());
|
|
|
json.put("province", hospital.getProvince());
|
|
|
json.put("provinceName", hospital.getProvinceName());
|
|
|
json.put("city", hospital.getCity());
|
|
|
json.put("cityName", hospital.getCityName());
|
|
|
json.put("town", hospital.getTown());
|
|
|
json.put("townName", hospital.getTownName());
|
|
|
json.put("level", hospital.getLevel());
|
|
|
String levelName = "";
|
|
|
switch (hospital.getLevel()) {
|
|
|
case 1:
|
|
|
levelName = "医院";
|
|
|
break;
|
|
|
case 2:
|
|
|
levelName = "社区医院";
|
|
|
break;
|
|
|
}
|
|
|
json.put("levelName", levelName);
|
|
|
json.put("address", hospital.getAddress());
|
|
|
json.put("intro", hospital.getIntro());
|
|
|
json.put("photo", hospital.getPhoto());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 邀请医生咨询
|
|
|
*
|
|
|
* @param patientCode
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据类别获取医院列表")
|
|
|
@RequestMapping(value = "/hospital_list_type",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getHospitalList(
|
|
|
@RequestParam(required = true) int doctorType,
|
|
|
@RequestParam(required = true) int consultType,
|
|
|
@RequestParam(required = true) String patientCode,
|
|
|
@RequestParam(required = false) String name,
|
|
|
@RequestParam(required = true) Integer page,
|
|
|
@RequestParam(required = true) Integer pageSize) {
|
|
|
try {
|
|
|
if (doctorType == 3) {
|
|
|
//查找所有的全科医生
|
|
|
Doctor doctor = doctorInfoService.getDoctor(consultType, patientCode);
|
|
|
return null;
|
|
|
} else if (doctorType == 2) {
|
|
|
//查找所有的专科医生
|
|
|
Page<Doctor> doctorList = doctorInfoService.getDoctorListByPatientCode(consultType, patientCode, name, page, pageSize);
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (doctorList != null) {
|
|
|
for (Doctor doctor : doctorList) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
json.put("photo", doctor.getPhoto());
|
|
|
json.put("sex", doctor.getSex());
|
|
|
String sexName = "";
|
|
|
switch (doctor.getSex()) {
|
|
|
case 1:
|
|
|
sexName = "男";
|
|
|
break;
|
|
|
case 2:
|
|
|
sexName = "女";
|
|
|
break;
|
|
|
}
|
|
|
json.put("sexName", sexName);
|
|
|
json.put("job", doctor.getJob());
|
|
|
json.put("jobName", doctor.getJobName());
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
json.put("dept", doctor.getDept());
|
|
|
json.put("deptName", doctor.getDeptName());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
}
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据医院标识获取医生信息
|
|
|
*
|
|
|
* @param hospital 医院标识
|
|
|
* @param query 查询条件 :医生名称
|
|
|
* @param page
|
|
|
* @param pageSize 页数
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据医院标识获取医生信息")
|
|
|
@RequestMapping(value = "/doctor_list",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getDoctorByHospital(
|
|
|
@RequestParam(required = true) String hospital,
|
|
|
@RequestParam(required = false) String query,
|
|
|
@RequestParam(required = true) Integer page,
|
|
|
@RequestParam(required = true) Integer pageSize) {
|
|
|
|
|
|
try {
|
|
|
Page<Doctor> doctorList = doctorInfoService.getDoctorListByHospital(query, hospital, page, pageSize,2);
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (doctorList != null) {
|
|
|
for (Doctor doctor : doctorList) {
|
|
|
if (hospital == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
json.put("photo", doctor.getPhoto());
|
|
|
json.put("sex", doctor.getSex());
|
|
|
String sexName = "";
|
|
|
switch (doctor.getSex()) {
|
|
|
case 1:
|
|
|
sexName = "男";
|
|
|
break;
|
|
|
case 2:
|
|
|
sexName = "女";
|
|
|
break;
|
|
|
}
|
|
|
json.put("sexName", sexName);
|
|
|
json.put("job", doctor.getJob());
|
|
|
json.put("jobName", doctor.getJobName());
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
json.put("dept", doctor.getDept());
|
|
|
json.put("evaluateScore", doctor.getEvaluateScore());
|
|
|
json.put("deptName", doctor.getDeptName());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 登录患者获取三师信息
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("登录患者获取三师信息")
|
|
|
@RequestMapping(value = "teachers",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String teachers(String patient) {
|
|
|
try {
|
|
|
// 查询签约信息
|
|
|
SignFamily signContract = familyContractService.findBySsPatient(patient);
|
|
|
if (signContract == null) {
|
|
|
return error(1, "无三师签约信息");
|
|
|
}
|
|
|
JSONObject doctorJson = new JSONObject();
|
|
|
// 设置签约日期
|
|
|
doctorJson.put("qyrq", DateUtil.dateToStr(signContract.getBegin(), DateUtil.YYYY_MM_DD));
|
|
|
// 签约编号
|
|
|
doctorJson.put("team_code", signContract.getTeamCode());
|
|
|
// 查询三师医生信息
|
|
|
List<Doctor> doctors = drHealthTeamService.findTeamDoctors(patient, 1);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if (doctors != null) {
|
|
|
for (Doctor doctor : doctors) {
|
|
|
if (doctor == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
json.put("photo", CommonUtil.getPhoneUrl(doctor.getPhoto()));
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
json.put("deptName", doctor.getDeptName());
|
|
|
json.put("jobName", doctor.getJobName());
|
|
|
json.put("expertise", doctor.getExpertise());
|
|
|
// 类型:1专科医生,2全科医生,3健康管理师
|
|
|
int type = doctor.getLevel();
|
|
|
if (type == 1) {
|
|
|
json.put("typename", "专科医生");
|
|
|
} else if (type == 2) {
|
|
|
json.put("typename", "全科医生");
|
|
|
} else if (type == 3) {
|
|
|
json.put("typename", "健康管理师");
|
|
|
} else {
|
|
|
json.put("typename", "");
|
|
|
}
|
|
|
jsonArray.put(json);
|
|
|
}
|
|
|
}
|
|
|
doctorJson.put("list", jsonArray);
|
|
|
return write(200, "查询成功!", "data", doctorJson);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param type 医生类别 1专科医生,2全科医生,3健康管理师
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/doctor_combobox",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getDoctorCombobxByHospital(
|
|
|
@RequestParam(required = true) String hospital,
|
|
|
@RequestParam(required = false) String type) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Doctor> doctorList = doctorInfoService.getDoctorCombobxByHospital(type, hospital);
|
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (doctorList != null) {
|
|
|
for (Doctor doctor : doctorList) {
|
|
|
if (hospital == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
json.put("photo", doctor.getPhoto());
|
|
|
json.put("sex", doctor.getSex());
|
|
|
String sexName = "";
|
|
|
switch (doctor.getSex()) {
|
|
|
case 1:
|
|
|
sexName = "男";
|
|
|
break;
|
|
|
case 2:
|
|
|
sexName = "女";
|
|
|
break;
|
|
|
}
|
|
|
json.put("sexName", sexName);
|
|
|
json.put("job", doctor.getJob());
|
|
|
json.put("jobName", doctor.getJobName());
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
json.put("dept", doctor.getDept());
|
|
|
json.put("deptName", doctor.getDeptName());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 患者端 专科医生列表
|
|
|
*
|
|
|
* @param name
|
|
|
* @param paitentCode
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("专科医生列表")
|
|
|
@RequestMapping(value = "/doctor_1_list",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String doctor_1_list(
|
|
|
@RequestParam(required = false) String name,
|
|
|
@RequestParam(required = false) String paitentCode,
|
|
|
@RequestParam(required = true) Integer page,
|
|
|
@RequestParam(required = true) Integer pageSize) {
|
|
|
|
|
|
try {
|
|
|
Page<Doctor> doctorList = doctorInfoService.getDoctorListByHospital(name, null, page, pageSize,1);
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (doctorList != null) {
|
|
|
for (Doctor doctor : doctorList) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
// json.put("photo", doctor.getPhoto());
|
|
|
// json.put("sex", doctor.getSex());
|
|
|
// String sexName = "";
|
|
|
// switch (doctor.getSex()) {
|
|
|
// case 1:
|
|
|
// sexName = "男";
|
|
|
// break;
|
|
|
// case 2:
|
|
|
// sexName = "女";
|
|
|
// break;
|
|
|
// }
|
|
|
// //json.put("sexName", sexName);
|
|
|
// json.put("job", doctor.getJob());
|
|
|
// json.put("jobName", doctor.getJobName());
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
// json.put("dept", doctor.getDept());
|
|
|
// json.put("deptName", doctor.getDeptName());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 把专科医生拉到团队里面
|
|
|
*
|
|
|
* @param teamCode 团队code
|
|
|
* @param doctor 专科医生code
|
|
|
* @param sickNCode 慢病code
|
|
|
* @param sickName 慢病名字
|
|
|
* @param doctorName 专科医生名字
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("把专科医生拉到团队里面")
|
|
|
@RequestMapping(value = "/doctor_1_Toteam",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String doctor_1_Toteam(
|
|
|
@RequestParam(required = false) String teamCode, //没用
|
|
|
@RequestParam(required = true) String parientCode,
|
|
|
@RequestParam(required = false) String groupCode,//没用
|
|
|
@RequestParam(required = true) String doctor,
|
|
|
@RequestParam(required = true) String doctorName,
|
|
|
@RequestParam(required = true) String sickName,
|
|
|
@RequestParam(required = true) String sickNCode) {
|
|
|
try {
|
|
|
doctorInfoService.doctor_1_Toteam(teamCode, doctor, doctorName, groupCode, super.getIMEI(), parientCode, sickName, sickNCode);
|
|
|
|
|
|
return write(200, "成功!");
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据病人ID查找团队里面的全科医生
|
|
|
*
|
|
|
* @param parientCode 病人code
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据病人ID查找团队里面的全科医生")
|
|
|
@RequestMapping(value = "/getDoctor2ByParient",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getDoctor2ByParient(
|
|
|
@RequestParam(required = true) String parientCode,
|
|
|
@RequestParam(required = true) String consultCode) {
|
|
|
try {
|
|
|
Doctor doctor = doctorInfoService.getDoctor2ByParient(parientCode, consultCode);
|
|
|
JSONObject json = null;
|
|
|
if (doctor != null) {
|
|
|
json = new JSONObject(doctor);
|
|
|
if (json.has("password")) {
|
|
|
json.remove("password");
|
|
|
}
|
|
|
if (json.has("salt")) {
|
|
|
json.remove("salt");
|
|
|
}
|
|
|
JSONObject iswork = workTimeService.isDoctorWorking(doctor.getCode());
|
|
|
if (iswork.getString("status").equals("1")) {
|
|
|
json.put("isworking", 1);
|
|
|
} else {
|
|
|
json.put("isworking", 0);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "doctor", json);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据病人ID查找所有的专科医生,如果团队有专科医生那么专科医生拍第一个
|
|
|
*
|
|
|
* @param parientCode 病人code
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据病人ID查找所有的专科医生,如果团队有专科医生那么专科医生拍第一个")
|
|
|
@RequestMapping(value = "/getDoctor1ByParient",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getDoctor1ByParient(
|
|
|
@RequestParam(required = true) String consultCode,
|
|
|
@RequestParam(required = true) String parientCode,
|
|
|
Integer page,
|
|
|
Integer pageSize) {
|
|
|
|
|
|
try {
|
|
|
Map<String, Object> doctorList = doctorInfoService.getDoctor1ByParient(consultCode, parientCode, page, pageSize);
|
|
|
JSONObject jo = new JSONObject();
|
|
|
List<JSONObject> doctors = doctorList.get("doctors") != null ? (List<JSONObject>) doctorList.get("doctors") : new ArrayList<>();
|
|
|
|
|
|
for (JSONObject obj : doctors) {
|
|
|
JSONObject iswork = workTimeService.isDoctorWorking(obj.getString("code"));
|
|
|
|
|
|
if (iswork.getString("status").equals("1")) {
|
|
|
obj.put("isworking", 1);
|
|
|
} else {
|
|
|
obj.put("isworking", 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
jo.put("totalPage", doctorList.get("totalPage"));
|
|
|
jo.put("doctors", doctors);
|
|
|
return write(200, "查询成功!", "data", jo);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 验证患者的名字,身份证和医保卡
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("验证患者的名字,身份证和医保卡")
|
|
|
@RequestMapping(value = "/validatePatient",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String validatePatient(
|
|
|
@RequestParam(required = true) String name,
|
|
|
@RequestParam(required = true) String idcard,
|
|
|
@RequestParam(required = true) String ssc) {
|
|
|
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(name)) {
|
|
|
return error(-1, "姓名不允许为空");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(idcard)) {
|
|
|
return error(-1, "身份证号不允许为空");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(ssc)) {
|
|
|
return error(-1, "社保卡号不允许为空");
|
|
|
}
|
|
|
// 校验身份证号
|
|
|
IdcardValidator validator = new IdcardValidator();
|
|
|
if (validator.isValidatedAllIdcard(idcard)) {
|
|
|
if (idcard.length() == 15) {
|
|
|
idcard = validator.convertIdcarBy15bit(idcard);
|
|
|
if (StringUtils.isEmpty(idcard)) {
|
|
|
return error(-1, "请输入正确的身份证号");
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
return error(-1, "请输入正确的身份证号");
|
|
|
}
|
|
|
|
|
|
SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
|
|
|
if (socialSecurityInfo != null) {
|
|
|
if (name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0) {
|
|
|
return error(-1, "身份证号与姓名不一致,请检查后重新输入");
|
|
|
}
|
|
|
if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0 && ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
|
|
|
return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
|
|
|
}
|
|
|
} else {
|
|
|
return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
|
|
|
}
|
|
|
return write(200, "查询成功!");
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 根据身份证号
|
|
|
*
|
|
|
* @param idcard
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据身份证号")
|
|
|
@RequestMapping(value = "/patient_cardno",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getPatientCardNo(String idcard) {
|
|
|
try {
|
|
|
String cardNo = "";
|
|
|
Patient patient = patientInfoService.findByIdcard(idcard);
|
|
|
if (patient == null || StringUtils.isEmpty(patient.getSsc())) {
|
|
|
SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18(idcard);
|
|
|
if (socialSecurityInfo != null) {
|
|
|
cardNo = socialSecurityInfo.getCardno();
|
|
|
}
|
|
|
} else {
|
|
|
cardNo = patient.getSsc();
|
|
|
}
|
|
|
|
|
|
return write(200, "查询成功!", "data", cardNo);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据level查找机构下的类别医生
|
|
|
*
|
|
|
* @param hospital
|
|
|
* @param level
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("根据level查找机构下的类别医生")
|
|
|
@RequestMapping(value = "/findDoctorByLevelAndHospital",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String findDoctorByLevelAndHospital(String hospital, Integer level) {
|
|
|
try {
|
|
|
List<Doctor> doctorList = doctorInfoService.findDoctorByLevelAndHospital(hospital, level);
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (doctorList != null) {
|
|
|
for (Doctor doctor : doctorList) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
json.put("code", doctor.getCode());
|
|
|
json.put("name", doctor.getName());
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "doctors", array);
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新身份证号
|
|
|
*
|
|
|
* @param idcard
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("更新身份证号")
|
|
|
@RequestMapping(value = "/idcard_update",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String updateIdcard(String idcard) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(idcard)) {
|
|
|
return error(-1, "身份证号不能为空");
|
|
|
}
|
|
|
|
|
|
if (doctorInfoService.updateDoctorIdcard(idcard, getUID())) {
|
|
|
return write(200, "更新成功");
|
|
|
} else {
|
|
|
return error(-1, "更新成功");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新医生性别
|
|
|
*
|
|
|
* @param sex
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("更新医生性别")
|
|
|
@RequestMapping(value = "/sex_update",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String updateSex(int sex) {
|
|
|
try {
|
|
|
if (doctorInfoService.updateSex(sex, getUID())) {
|
|
|
return write(200, "更新成功");
|
|
|
} else {
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新医生介绍
|
|
|
*
|
|
|
* @param introduce
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("更新医生介绍")
|
|
|
@RequestMapping(value = "/introduce_update",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String updateIntroduce(String introduce) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(introduce)) {
|
|
|
return error(-1, "身份证号不能为空");
|
|
|
}
|
|
|
if (doctorInfoService.updateIntroduce(introduce, getUID())) {
|
|
|
return write(200, "更新成功");
|
|
|
} else {
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新医生专长
|
|
|
*
|
|
|
* @param expertise
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("更新医生专长")
|
|
|
@RequestMapping(value = "/expertise_update",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String updateExpertise(String expertise) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(expertise)) {
|
|
|
return error(-1, "专长不能为空");
|
|
|
}
|
|
|
if (doctorInfoService.updateExpertise(expertise, getUID())) {
|
|
|
return write(200, "更新成功");
|
|
|
} else {
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置给医生名医
|
|
|
*
|
|
|
* @param doctorCode 医生code
|
|
|
* @param status 1 是 0否
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("设置给医生名医")
|
|
|
@RequestMapping(value = "/setFamous",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String setFamous(String doctorCode, Integer status) {
|
|
|
try {
|
|
|
doctorInfoService.setFamous(doctorCode, status);
|
|
|
return write(200, "更新成功");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 转换团队中的健康管理师
|
|
|
*
|
|
|
* @param newDoctorCode 新的健康管理师的code
|
|
|
* @param oldDoctorCode 旧的健康管理师的code
|
|
|
* @param patients 患者code 多个逗号分隔
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("转换团队中的健康管理师")
|
|
|
@RequestMapping(value = "/updateTeamHealthDoctors",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String updateTeamHealthDoctors(String newDoctorCode,
|
|
|
@RequestParam(required = false) String oldDoctorCode,
|
|
|
@RequestParam(required = false) String patients,
|
|
|
@RequestParam(required = false) String isAll) {
|
|
|
try {
|
|
|
String status = redisTemplate.opsForValue().get("jianguanshifenpei:" + getUID());
|
|
|
status = StringUtils.isEmpty(status) ? "0" : status;
|
|
|
if (!status.equals("1")) {
|
|
|
redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "1");
|
|
|
redisTemplate.expire("jianguanshifenpei:" + getUID(), 20, TimeUnit.MINUTES);
|
|
|
} else {
|
|
|
return error(-2, "正在分配,请勿重复操作");
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
|
|
|
|
|
|
int result = doctorInfoService.updateTeamHealthDoctorsAll(newDoctorCode, getUID());
|
|
|
redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
|
|
|
redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
|
|
|
if (result == 1) {
|
|
|
return write(200, "分配健管师成功");
|
|
|
} else if (result == 2) {
|
|
|
return write(200, "部分居民因没有服务团队分配失败");
|
|
|
}
|
|
|
} else {
|
|
|
if (StringUtils.isEmpty(patients)) {
|
|
|
redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
|
|
|
redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
|
|
|
return error(-1, "居民不能为空");
|
|
|
}
|
|
|
Map<String, Integer> returnMap = doctorInfoService.updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
|
|
|
redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
|
|
|
redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
|
|
|
return write(200, "已成功处理" + returnMap.get("success") + "个居民," + returnMap.get("error") + "个居民因有未结束的咨询,无法处理");
|
|
|
}
|
|
|
redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
|
|
|
redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
|
|
|
return write(200, "更新成功");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
|
|
|
redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 转换团队中的全科医生
|
|
|
*
|
|
|
* @param newDoctorCode 新的全科医生的code
|
|
|
* @param oldDoctorCode 旧的全科医生的code
|
|
|
* @param patients 患者code 多个逗号分隔
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("转换团队中的全科医生")
|
|
|
@RequestMapping(value = "/updateTeamDoctors",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String updateTeamDoctors(String newDoctorCode,
|
|
|
String oldDoctorCode,
|
|
|
String patients) {
|
|
|
try {
|
|
|
String status = redisTemplate.opsForValue().get("quankeyishengfenpei:" + getUID());
|
|
|
status = StringUtils.isEmpty(status) ? "0" : status;
|
|
|
if (!status.equals("1")) {
|
|
|
redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "1");
|
|
|
redisTemplate.expire("quankeyishengfenpei:" + getUID(), 20, TimeUnit.MINUTES);
|
|
|
} else {
|
|
|
return error(-2, "正在分配,请勿重复操作");
|
|
|
}
|
|
|
|
|
|
Map<String, Integer> returnMap = doctorInfoService.updateTeamDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
|
|
|
redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "0");
|
|
|
redisTemplate.expire("quankeyishengfenpei:" + getUID(), 10, TimeUnit.MINUTES);
|
|
|
|
|
|
return write(200, "已成功处理" + returnMap.get("success") + "个居民," + returnMap.get("error") + "个居民因有未结束的咨询,无法处理");
|
|
|
} catch (Exception e) {
|
|
|
redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "0");
|
|
|
redisTemplate.expire("quankeyishengfenpei:" + getUID(), 10, TimeUnit.MINUTES);
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 医生手机号变更
|
|
|
*
|
|
|
* @param mobile 新手机号
|
|
|
* @param captcha 验证码
|
|
|
* @param type 1:变更手机号 2:绑定手机号
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("医生手机号变更")
|
|
|
@RequestMapping(value = "/mobile_update", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String changeDoctorMobile(String mobile, String captcha, int type) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(mobile)) {
|
|
|
return error(-1, "请填写新手机号码");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(captcha)) {
|
|
|
return error(-1, "请输入验证码");
|
|
|
}
|
|
|
if (type != 1 && type != 2) {
|
|
|
return error(-1, "操作类型参数错误");
|
|
|
}
|
|
|
|
|
|
int result = doctorInfoService.changeMobile(getUID(), mobile, captcha, type);
|
|
|
|
|
|
if (result == -1) {
|
|
|
return error(-1, "医生信息查找失败");
|
|
|
} else if (result == -2) {
|
|
|
return error(-1, "手机已注册");
|
|
|
} else if (result == -3) {
|
|
|
return error(-1, "验证码错误");
|
|
|
} else if (result == 1) {
|
|
|
return write(200, "手机号更新成功");
|
|
|
} else {
|
|
|
return write(-1, "手机号更新失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "手机号更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 手机号是否注册
|
|
|
*
|
|
|
* @param mobile 手机号
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("手机号是否注册")
|
|
|
@RequestMapping(value="/is_mobile_register",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String isMobileRegister(String mobile) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(mobile)) {
|
|
|
return error(-1, "手机号码不能为空");
|
|
|
}
|
|
|
|
|
|
int result = doctorInfoService.isMobileRegister(mobile);
|
|
|
|
|
|
|
|
|
return write(200, "查询成功", "data", result);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改密码
|
|
|
*
|
|
|
* @param newPassword1 新密码1
|
|
|
* @param newPassword2 新密码2
|
|
|
* @param oldPassword 旧密码
|
|
|
* @param doctorCode 医生code
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("修改密码")
|
|
|
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String updatePassword(String newPassword1,
|
|
|
String newPassword2,
|
|
|
String oldPassword,
|
|
|
String doctorCode) {
|
|
|
try {
|
|
|
newPassword1 = RSAUtils.getInstance(doctorInfoService).decryptString(newPassword1);
|
|
|
newPassword2 = RSAUtils.getInstance(doctorInfoService).decryptString(newPassword2);
|
|
|
oldPassword = RSAUtils.getInstance(doctorInfoService).decryptString(oldPassword);
|
|
|
newPassword1 = StringUtils.reverse(newPassword1);
|
|
|
newPassword2 = StringUtils.reverse(newPassword2);
|
|
|
oldPassword = StringUtils.reverse(oldPassword);
|
|
|
|
|
|
doctorInfoService.updatePassword(newPassword1, newPassword2, oldPassword, doctorCode);
|
|
|
return write(200, "更新成功");
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 当前医生是否与居民签约
|
|
|
*
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("当前医生是否与居民签约")
|
|
|
@RequestMapping(value = "/is_patient_signed",method =RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public String isPatientSign(String patient) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(patient)) {
|
|
|
return error(-1, "居民不能为空");
|
|
|
}
|
|
|
|
|
|
boolean isSigned = doctorInfoService.isPatientSigned(patient, getUID());
|
|
|
|
|
|
return write(200, "查询成功", "data", isSigned ? "1" : "0");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 心跳接口
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("心跳接口")
|
|
|
@RequestMapping(value = "/islive",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String islive() {
|
|
|
try {
|
|
|
return write(200, "成功");
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分配及转移健管师
|
|
|
*
|
|
|
* @param newDoctorCode
|
|
|
* @param oldDoctorCode
|
|
|
* @param patients 多个患者用,隔开
|
|
|
* @param group 团队标签分组名称
|
|
|
* @param sendCount
|
|
|
* @param teamId
|
|
|
* @param typeId
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("分配及转移健管师")
|
|
|
@RequestMapping(value = "/allotOrMoveHealth",method =RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String allotOrMoveHealth(
|
|
|
@RequestParam String newDoctorCode,
|
|
|
@RequestParam(required = false) String oldDoctorCode,
|
|
|
@RequestParam(required = false) String patients,
|
|
|
@RequestParam(required = false) String group,
|
|
|
@RequestParam(required = false) Integer sendCount,
|
|
|
@RequestParam String teamId,
|
|
|
@RequestParam(required = false) String typeId) {
|
|
|
try {
|
|
|
Long teamCode = Long.parseLong(teamId);
|
|
|
// patients不为空是由团队中分配及转移的搜索居民 转移健管师 否则是分组分配健管师
|
|
|
if (StringUtils.isNotEmpty(patients)) {
|
|
|
String result = updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, null);
|
|
|
return result;
|
|
|
} else if(StringUtils.isNotEmpty(group)){
|
|
|
// 按条件获取居民
|
|
|
patients = "";
|
|
|
if (StringUtils.isEmpty(teamId)||StringUtils.isEmpty(typeId)||sendCount==null){
|
|
|
return write(-1, "参数不能为空!");
|
|
|
}
|
|
|
JSONObject list = familyContractService.findNoHealthSignFamilyHealth(null, typeId, null, teamCode);
|
|
|
List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatusAndTeamCode(typeId, 1, teamCode);
|
|
|
for (SignPatientLabel label :s) {
|
|
|
// String labelName = label.getLabelCode();
|
|
|
String labelName = label.getLabelName();
|
|
|
if (labelName.equals(group)){
|
|
|
JSONArray jsonArray = list.getJSONArray(labelName);
|
|
|
for (int i=0;i<sendCount;i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
String patient = jsonObject.get("code").toString();
|
|
|
// 转移时需要剔除处于咨询状态的居民
|
|
|
if (StringUtils.isNotEmpty(oldDoctorCode)){
|
|
|
ConsultTeam consultTeam = consultTeamService.getConsultByPatientAndDoctor(patient, oldDoctorCode);
|
|
|
if (consultTeam == null) {
|
|
|
// 不是咨询状态
|
|
|
patients+=(patient+",");
|
|
|
}
|
|
|
}else {
|
|
|
patients+=(patient+",");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
patients = patients.substring(0,patients.length()-1);
|
|
|
String result = updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, null);
|
|
|
return result;
|
|
|
}else {
|
|
|
List<SignFamily> signFamily = familyContractService.findNoHealthSignFamilyNum(teamCode);
|
|
|
patients = "";
|
|
|
if (StringUtils.isEmpty(teamId)||StringUtils.isEmpty(typeId)||sendCount==null){
|
|
|
return write(-1, "参数不能为空!");
|
|
|
}
|
|
|
for (SignFamily patient:signFamily) {
|
|
|
String code = patient.getPatient();
|
|
|
patients+=(code+",");
|
|
|
}
|
|
|
patients = patients.substring(0,patients.length()-1);
|
|
|
String result = updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, null);
|
|
|
return result;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 设置审方密码
|
|
|
// * @param password
|
|
|
// * @return
|
|
|
// */
|
|
|
// @RequestMapping(value = "/setCheckPassword", method = RequestMethod.POST)
|
|
|
// @ResponseBody
|
|
|
// @ObserverRequired
|
|
|
// public String setCheckPassword(@RequestParam String password){
|
|
|
//
|
|
|
// try {
|
|
|
//
|
|
|
// Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
|
|
|
// if (doctor == null) {
|
|
|
// return error(-1, "密码设置失败!");
|
|
|
// }
|
|
|
//// doctorInfoService.setCheckPassword(doctor,password);
|
|
|
// return write(200, "密码设置成功");
|
|
|
// }catch (Exception e){
|
|
|
// error(e);
|
|
|
// return invalidUserException(e, -1, "密码设置失败");
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// /**
|
|
|
// * 修改审方密码
|
|
|
// * @param oldPassword
|
|
|
// * @param newPassword
|
|
|
// * @return
|
|
|
// */
|
|
|
// @ObserverRequired
|
|
|
// @ResponseBody
|
|
|
// @RequestMapping(value = "/updateCheckPassword", method = RequestMethod.POST)
|
|
|
// public String updateCheckPassword(@RequestParam String oldPassword,@RequestParam String newPassword){
|
|
|
//
|
|
|
// try {
|
|
|
// Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
|
|
|
// if (doctor == null) {
|
|
|
// return error(-1, "修改审方密码失败!");
|
|
|
// } else {
|
|
|
// String encodePWD = EncodesUtil.entryptPassword(Encodes.decodeHex(doctor.getCheckSalt()), oldPassword);
|
|
|
// if (StringUtils.equals(doctor.getCheckPassword(), encodePWD)) {
|
|
|
//// doctorInfoService.setCheckPassword(doctor,newPassword);
|
|
|
// return write(200, "密码设置成功");
|
|
|
// } else {
|
|
|
// return error(-1, "修改失败:审方旧密码错误!");
|
|
|
// }
|
|
|
// }
|
|
|
// } catch (Exception e) {
|
|
|
// error(e);
|
|
|
// return invalidUserException(e, -1, "修改失败!");
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
//获取实名软证书的过期时间
|
|
|
@ApiOperation("获取实名软证书的过期时间")
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/getAuthenticationCAOvertime", method = RequestMethod.GET)
|
|
|
public String getAuthenticationCAOvertime(){
|
|
|
|
|
|
try {
|
|
|
// Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
|
|
|
JSONObject data = doctorInfoService.getCAPastDue(getUID(),new JSONObject());
|
|
|
return write(200, "获取信息成功!", "data", data);
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取信息失败!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断是否在线上安装证书
|
|
|
@ObserverRequired
|
|
|
@ApiOperation("判断是否在线上安装证书")
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/isAuthentication", method = RequestMethod.GET)
|
|
|
public String isAuthentication(){
|
|
|
try {
|
|
|
//0de6a26a62dd11e69faffa163e8aee56
|
|
|
JSONObject data = doctorInfoService.isAuthentication(getUID());
|
|
|
return write(200, "获取信息成功!", "data", data);
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//修改实名软证书调用保护口令
|
|
|
@ApiOperation("修改实名软证书调用保护口令")
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/updateAuthenticationPassword", method = RequestMethod.POST)
|
|
|
public String updateAuthenticationPassword(
|
|
|
@RequestParam(value = "strOldCalledPasswd",required = true) String strOldCalledPasswd,
|
|
|
@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
|
|
|
try {
|
|
|
Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
|
|
|
boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getUID());//hxmD201703150222
|
|
|
if(b){
|
|
|
return write(200, "修改密码成功!", "data", b);
|
|
|
}
|
|
|
return error(-1, "修改密码失败!");
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 初始设置实名软证书调用保护口令
|
|
|
*/
|
|
|
@ApiOperation("初始设置实名软证书调用保护口令")
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/installAuthenticationPassword", method = RequestMethod.POST)
|
|
|
public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
|
|
|
try {
|
|
|
Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
|
|
|
String strOldCalledPasswd = StringUtils.isNotEmpty(doctor.getCheckPassword())?doctor.getCheckPassword():"11111111";
|
|
|
boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getUID());
|
|
|
if(b){
|
|
|
return write(200, "设置密码成功!", "data", b);
|
|
|
}
|
|
|
return error(-1, "设置密码失败!");
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 重置密码
|
|
|
*/
|
|
|
@ApiOperation("重置实名软证书调用保护口令")
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/resetAuthenticationPassword", method = RequestMethod.POST)
|
|
|
public String resetAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
|
|
|
try {
|
|
|
Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
|
|
|
boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),strNewCalledPasswd,getUID());
|
|
|
if(b){
|
|
|
return write(200, "重置密码成功!", "data", b);
|
|
|
}
|
|
|
return error(-1, "重置密码失败!");
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 请求实名软证书并进行数字签名
|
|
|
*/
|
|
|
@ApiOperation("请求实名软证书并进行数字签名")
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/requestRealNameSoftCertAndSign", method = RequestMethod.POST)
|
|
|
public String requestRealNameSoftCertAndSign(
|
|
|
@ApiParam(required = true, name = "strRealNameSoftCertCalledPasswd", value = "证书被调用保护口令") @RequestParam(value = "strRealNameSoftCertCalledPasswd",required = true) String strRealNameSoftCertCalledPasswd,
|
|
|
@ApiParam(required = true, name = "strOriginalData", value = "原文") @RequestParam(value = "strOriginalData",required = true) String strOriginalData,
|
|
|
@ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
|
|
|
|
|
|
try {
|
|
|
Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
|
|
|
// JSONObject obj = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,srcBusinessStreamNO);
|
|
|
JSONObject jsonObject = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,prescriptionCode);
|
|
|
// if(b){
|
|
|
return write(200, "获取信息成功!", "data", jsonObject);
|
|
|
// }
|
|
|
// return error(-1, "认证失败!");
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 校验医师输入的CA证书是否正确
|
|
|
* @return
|
|
|
*/
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/checkCertificate", method = RequestMethod.GET)
|
|
|
@ApiOperation("校验医师输入的身份证是否正确")
|
|
|
public String checkCertificate(
|
|
|
@ApiParam(required = true, name = "certificateNum", value = "证书编号") @RequestParam(value = "certificateNum",required = true) String certificateNum){
|
|
|
|
|
|
try {
|
|
|
boolean b = doctorInfoService.checkCertificate(getUID(),certificateNum);
|
|
|
return write(200, "获取信息成功!", "data", b);
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 验证签名( ( 带多服务器负载均衡) )
|
|
|
*/
|
|
|
@ApiOperation("验证签名")
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/verifySignOnMultiServer", method = RequestMethod.GET)
|
|
|
public String verifySignOnMultiServer(
|
|
|
@ApiParam(required = true, name = "strSignData", value = "签名值") @RequestParam(value = "strSignData",required = true) String strSignData,
|
|
|
@ApiParam(required = true, name = "strCertData", value = "证书主体数据") @RequestParam(value = "strCertData",required = true) String strCertData,
|
|
|
@ApiParam(required = true, name = "strOriginalData", value = "原文数据") @RequestParam(value = "strOriginalData",required = true) String strOriginalData){
|
|
|
|
|
|
try {
|
|
|
boolean bl = doctorInfoService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData,getUID());
|
|
|
return write(200, "获取信息成功!", "data", bl);
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation("取消认证")
|
|
|
@ObserverRequired
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/cancelAuthentication", method = RequestMethod.GET)
|
|
|
public String cancelAuthentication(){
|
|
|
|
|
|
try {
|
|
|
if(doctorInfoService.cancelAuthentication(getUID())){
|
|
|
|
|
|
return write(200, "取消认证成功!");
|
|
|
}else{
|
|
|
return error(-1, "取消认证失败!");
|
|
|
}
|
|
|
}catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "取消认证失败!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|