|
@ -29,6 +29,7 @@ import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientSickDao;
|
|
import com.yihu.wlyy.repository.patient.PatientSickDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -47,6 +48,8 @@ import org.springside.modules.persistence.SearchFilter.Operator;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.util.EncodesUtil;
|
|
import com.yihu.wlyy.util.EncodesUtil;
|
|
|
|
|
|
|
|
import javax.print.Doc;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 医生基本信息类.
|
|
* 医生基本信息类.
|
|
*
|
|
*
|
|
@ -83,8 +86,10 @@ public class DoctorInfoService extends BaseService {
|
|
private ConsultDao consultDao;
|
|
private ConsultDao consultDao;
|
|
@Autowired
|
|
@Autowired
|
|
private SignFamilyDao signFamilyDao;
|
|
private SignFamilyDao signFamilyDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
private ConsultTeamDao consultTeamDao;
|
|
private ConsultTeamDao consultTeamDao;
|
|
|
|
@Autowired
|
|
|
|
SMSService smsService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取医生的签约病人
|
|
* 获取医生的签约病人
|
|
@ -92,7 +97,7 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<Object> getDoctorSignPatients(String doctor){
|
|
|
|
|
|
public List<Object> getDoctorSignPatients(String doctor) {
|
|
return signFamilyDao.findDoctorSignPatients(doctor);
|
|
return signFamilyDao.findDoctorSignPatients(doctor);
|
|
}
|
|
}
|
|
|
|
|
|
@ -102,8 +107,8 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<Object> getDoctorSignPatientsLikeName(String doctor,String patientName){
|
|
|
|
return signFamilyDao.findDoctorSignPatientsLikeName(doctor,patientName);
|
|
|
|
|
|
public List<Object> getDoctorSignPatientsLikeName(String doctor, String patientName) {
|
|
|
|
return signFamilyDao.findDoctorSignPatientsLikeName(doctor, patientName);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -112,8 +117,8 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<Object> getDoctorSignPatientsBySignType(String doctor,int type){
|
|
|
|
return signFamilyDao.findDoctorSignPatientsBySignType(doctor,type);
|
|
|
|
|
|
public List<Object> getDoctorSignPatientsBySignType(String doctor, int type) {
|
|
|
|
return signFamilyDao.findDoctorSignPatientsBySignType(doctor, type);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -122,8 +127,8 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<Object> getDoctorSignPatientsByTypeName(String doctor,int type,String patientName){
|
|
|
|
return signFamilyDao.findDoctorSignPatientsByTypeName(doctor,type,patientName);
|
|
|
|
|
|
public List<Object> getDoctorSignPatientsByTypeName(String doctor, int type, String patientName) {
|
|
|
|
return signFamilyDao.findDoctorSignPatientsByTypeName(doctor, type, patientName);
|
|
}
|
|
}
|
|
|
|
|
|
public Doctor findDoctorByCode(String code) {
|
|
public Doctor findDoctorByCode(String code) {
|
|
@ -197,7 +202,7 @@ public class DoctorInfoService extends BaseService {
|
|
}
|
|
}
|
|
|
|
|
|
public Page<Object> findPatientByDoctorSign(String doctor, long id,
|
|
public Page<Object> findPatientByDoctorSign(String doctor, long id,
|
|
int pagesize, String patientName){
|
|
|
|
|
|
int pagesize, String patientName) {
|
|
// return doctorDao.findPatientByDoctorSign(doctor);
|
|
// return doctorDao.findPatientByDoctorSign(doctor);
|
|
|
|
|
|
Page<Object> signList = null;
|
|
Page<Object> signList = null;
|
|
@ -281,8 +286,8 @@ public class DoctorInfoService extends BaseService {
|
|
if (StringUtils.isNotEmpty(query)) {
|
|
if (StringUtils.isNotEmpty(query)) {
|
|
filters.put("name", new SearchFilter("name", Operator.LIKE, query));
|
|
filters.put("name", new SearchFilter("name", Operator.LIKE, query));
|
|
}
|
|
}
|
|
if(StringUtils.isNotEmpty(hospital)){
|
|
|
|
hospital=hospital.substring(0,8);
|
|
|
|
|
|
if (StringUtils.isNotEmpty(hospital)) {
|
|
|
|
hospital = hospital.substring(0, 8);
|
|
filters.put("hospital", new SearchFilter("hospital", Operator.LIKE,
|
|
filters.put("hospital", new SearchFilter("hospital", Operator.LIKE,
|
|
hospital));
|
|
hospital));
|
|
}
|
|
}
|
|
@ -501,7 +506,7 @@ public class DoctorInfoService extends BaseService {
|
|
}
|
|
}
|
|
|
|
|
|
public List<Doctor> findDoctorByLevelAndHospital(String hospital, Integer level) {
|
|
public List<Doctor> findDoctorByLevelAndHospital(String hospital, Integer level) {
|
|
return doctorDao.findDoctorByLevelAndHospital(hospital,level);
|
|
|
|
|
|
return doctorDao.findDoctorByLevelAndHospital(hospital, level);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -511,9 +516,9 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public boolean updateDoctorIdcard(String idcard,String doctor) throws Exception {
|
|
|
|
|
|
public boolean updateDoctorIdcard(String idcard, String doctor) throws Exception {
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
if(doc == null){
|
|
|
|
|
|
if (doc == null) {
|
|
throw new Exception("医生不存在");
|
|
throw new Exception("医生不存在");
|
|
}
|
|
}
|
|
doc.setIdcard(idcard);
|
|
doc.setIdcard(idcard);
|
|
@ -527,9 +532,9 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public boolean updateExpertise(String expertise,String doctor) throws Exception {
|
|
|
|
|
|
public boolean updateExpertise(String expertise, String doctor) throws Exception {
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
if(doc == null){
|
|
|
|
|
|
if (doc == null) {
|
|
throw new Exception("医生不存在");
|
|
throw new Exception("医生不存在");
|
|
}
|
|
}
|
|
doc.setExpertise(expertise);
|
|
doc.setExpertise(expertise);
|
|
@ -543,9 +548,9 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public boolean updateSex(int sex,String doctor) throws Exception {
|
|
|
|
|
|
public boolean updateSex(int sex, String doctor) throws Exception {
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
if(doc == null){
|
|
|
|
|
|
if (doc == null) {
|
|
throw new Exception("医生不存在");
|
|
throw new Exception("医生不存在");
|
|
}
|
|
}
|
|
doc.setSex(sex);
|
|
doc.setSex(sex);
|
|
@ -559,9 +564,9 @@ public class DoctorInfoService extends BaseService {
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public boolean updateIntroduce(String introduce,String doctor) throws Exception {
|
|
|
|
|
|
public boolean updateIntroduce(String introduce, String doctor) throws Exception {
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
if(doc == null){
|
|
|
|
|
|
if (doc == null) {
|
|
throw new Exception("医生不存在");
|
|
throw new Exception("医生不存在");
|
|
}
|
|
}
|
|
doc.setIntroduce(introduce);
|
|
doc.setIntroduce(introduce);
|
|
@ -570,19 +575,20 @@ public class DoctorInfoService extends BaseService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设置医生为名医
|
|
* 设置医生为名医
|
|
|
|
*
|
|
* @param doctorCode
|
|
* @param doctorCode
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
public void setFamous(String doctorCode,Integer status) {
|
|
|
|
Doctor doctor=doctorDao.findByCode(doctorCode);
|
|
|
|
|
|
public void setFamous(String doctorCode, Integer status) {
|
|
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
//如果是空或者大于1 默认是关闭名医
|
|
//如果是空或者大于1 默认是关闭名医
|
|
if(status==null||status>1){
|
|
|
|
status=0;
|
|
|
|
|
|
if (status == null || status > 1) {
|
|
|
|
status = 0;
|
|
}
|
|
}
|
|
doctor.setIsFamous(status);
|
|
doctor.setIsFamous(status);
|
|
}
|
|
}
|
|
|
|
|
|
public Page<Doctor> findDoctorByDept(String dept,String hosptial, String key, int page, int pageSize) {
|
|
|
|
|
|
public Page<Doctor> findDoctorByDept(String dept, String hosptial, String key, int page, int pageSize) {
|
|
if (pageSize <= 0) {
|
|
if (pageSize <= 0) {
|
|
pageSize = 10;
|
|
pageSize = 10;
|
|
}
|
|
}
|
|
@ -609,7 +615,7 @@ public class DoctorInfoService extends BaseService {
|
|
return doctorDao.findAll(spec, pageRequest);
|
|
return doctorDao.findAll(spec, pageRequest);
|
|
}
|
|
}
|
|
|
|
|
|
public Page<Doctor> findFamousDoctor(String key,Integer type, int page, int pageSize,Integer level) {
|
|
|
|
|
|
public Page<Doctor> findFamousDoctor(String key, Integer type, int page, int pageSize, Integer level) {
|
|
if (pageSize <= 0) {
|
|
if (pageSize <= 0) {
|
|
pageSize = 10;
|
|
pageSize = 10;
|
|
}
|
|
}
|
|
@ -623,12 +629,12 @@ public class DoctorInfoService extends BaseService {
|
|
// 查询全部
|
|
// 查询全部
|
|
Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
|
|
Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
|
|
if (StringUtils.isNotEmpty(key)) {
|
|
if (StringUtils.isNotEmpty(key)) {
|
|
filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, key));
|
|
|
|
|
|
filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, key));
|
|
}
|
|
}
|
|
|
|
|
|
filters.put("isFamous", new SearchFilter("isFamous", SearchFilter.Operator.EQ, type));
|
|
filters.put("isFamous", new SearchFilter("isFamous", SearchFilter.Operator.EQ, type));
|
|
|
|
|
|
if(level!=null&&level>0&&level<4){
|
|
|
|
|
|
if (level != null && level > 0 && level < 4) {
|
|
filters.put("level", new SearchFilter("level", SearchFilter.Operator.EQ, level));
|
|
filters.put("level", new SearchFilter("level", SearchFilter.Operator.EQ, level));
|
|
}
|
|
}
|
|
Specification<Doctor> spec = DynamicSpecifications.bySearchFilter(filters.values(), Doctor.class);
|
|
Specification<Doctor> spec = DynamicSpecifications.bySearchFilter(filters.values(), Doctor.class);
|
|
@ -636,37 +642,37 @@ public class DoctorInfoService extends BaseService {
|
|
return doctorDao.findAll(spec, pageRequest);
|
|
return doctorDao.findAll(spec, pageRequest);
|
|
}
|
|
}
|
|
|
|
|
|
public void updateTeamHealthDoctor(String newDoctorCode, String oldDoctorCode, String patient)throws Exception {
|
|
|
|
|
|
public void updateTeamHealthDoctor(String newDoctorCode, String oldDoctorCode, String patient) throws Exception {
|
|
//得到患者的签约信息
|
|
//得到患者的签约信息
|
|
SignFamily signFamily= signFamilyDao.findByPatient(patient);
|
|
|
|
String groupCode="";
|
|
|
|
if(StringUtils.isNoneBlank(oldDoctorCode)){
|
|
|
|
ConsultTeam consultTeam= consultTeamDao.findByParientCodeAndSignTypeAndDoctor(patient,oldDoctorCode,2);
|
|
|
|
if(consultTeam!=null){
|
|
|
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
|
|
String groupCode = "";
|
|
|
|
if (StringUtils.isNoneBlank(oldDoctorCode)) {
|
|
|
|
ConsultTeam consultTeam = consultTeamDao.findByParientCodeAndSignTypeAndDoctor(patient, oldDoctorCode, 2);
|
|
|
|
if (consultTeam != null) {
|
|
throw new Exception("存在没有关闭的健康咨询");
|
|
throw new Exception("存在没有关闭的健康咨询");
|
|
}
|
|
}
|
|
//修改医生服务团队 删除旧的健康管理师
|
|
//修改医生服务团队 删除旧的健康管理师
|
|
DoctorTeamMember doctorTeamMember= doctorTeamDoctor.findMemberByTeamAndCode(signFamily.getTeamCode(),oldDoctorCode);
|
|
|
|
|
|
DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findMemberByTeamAndCode(signFamily.getTeamCode(), oldDoctorCode);
|
|
doctorTeamMember.setDel("0");
|
|
doctorTeamMember.setDel("0");
|
|
//把患者移除旧的健康管理师的患者表
|
|
//把患者移除旧的健康管理师的患者表
|
|
List<DoctorPatientGroupInfo> oldDoctorPatientGroupInfos=doctorPatientGroupInfoDao.findByPatientAndDoctor(patient,oldDoctorCode);
|
|
|
|
for(DoctorPatientGroupInfo doctorPatientGroupInfo:oldDoctorPatientGroupInfos){
|
|
|
|
|
|
List<DoctorPatientGroupInfo> oldDoctorPatientGroupInfos = doctorPatientGroupInfoDao.findByPatientAndDoctor(patient, oldDoctorCode);
|
|
|
|
for (DoctorPatientGroupInfo doctorPatientGroupInfo : oldDoctorPatientGroupInfos) {
|
|
doctorPatientGroupInfo.setCzrq(new Date());
|
|
doctorPatientGroupInfo.setCzrq(new Date());
|
|
doctorPatientGroupInfo.setStatus(0);//设置为无效
|
|
doctorPatientGroupInfo.setStatus(0);//设置为无效
|
|
//保存原来旧的分组
|
|
//保存原来旧的分组
|
|
if(Integer.valueOf(doctorPatientGroupInfo.getGroup())<4){
|
|
|
|
groupCode=doctorPatientGroupInfo.getGroup()+"";
|
|
|
|
|
|
if (Integer.valueOf(doctorPatientGroupInfo.getGroup()) < 4) {
|
|
|
|
groupCode = doctorPatientGroupInfo.getGroup() + "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Patient patientObj=patientDao.findByCode(patient);
|
|
|
|
Doctor newD=doctorDao.findByCode(newDoctorCode);
|
|
|
|
|
|
Patient patientObj = patientDao.findByCode(patient);
|
|
|
|
Doctor newD = doctorDao.findByCode(newDoctorCode);
|
|
//修改签约中的健康管理师
|
|
//修改签约中的健康管理师
|
|
signFamily.setDoctorHealth(newD.getCode());
|
|
signFamily.setDoctorHealth(newD.getCode());
|
|
signFamily.setDoctorHealthName(newD.getName());
|
|
signFamily.setDoctorHealthName(newD.getName());
|
|
|
|
|
|
//添加新的健康管理师到服务团队里
|
|
//添加新的健康管理师到服务团队里
|
|
DoctorTeamMember newDoctorTeamMember=new DoctorTeamMember();
|
|
|
|
|
|
DoctorTeamMember newDoctorTeamMember = new DoctorTeamMember();
|
|
newDoctorTeamMember.setTeam(signFamily.getTeamCode());
|
|
newDoctorTeamMember.setTeam(signFamily.getTeamCode());
|
|
newDoctorTeamMember.setCzrq(new Date());
|
|
newDoctorTeamMember.setCzrq(new Date());
|
|
newDoctorTeamMember.setName(newD.getName());
|
|
newDoctorTeamMember.setName(newD.getName());
|
|
@ -674,7 +680,7 @@ public class DoctorInfoService extends BaseService {
|
|
newDoctorTeamMember.setType(3);
|
|
newDoctorTeamMember.setType(3);
|
|
newDoctorTeamMember.setSignType("2");
|
|
newDoctorTeamMember.setSignType("2");
|
|
newDoctorTeamMember.setDel("1");
|
|
newDoctorTeamMember.setDel("1");
|
|
newDoctorTeamMember.setCode(UUID.randomUUID().toString().replace("-",""));
|
|
|
|
|
|
newDoctorTeamMember.setCode(UUID.randomUUID().toString().replace("-", ""));
|
|
doctorTeamDoctor.save(newDoctorTeamMember);
|
|
doctorTeamDoctor.save(newDoctorTeamMember);
|
|
|
|
|
|
//把患者加到新的健康管理师的患者表
|
|
//把患者加到新的健康管理师的患者表
|
|
@ -691,10 +697,37 @@ public class DoctorInfoService extends BaseService {
|
|
doctorPatientGroupInfoDao.save(doctorPatientGroupInfo);
|
|
doctorPatientGroupInfoDao.save(doctorPatientGroupInfo);
|
|
}
|
|
}
|
|
|
|
|
|
public void updateTeamHealthDoctors(String newDoctorCode, String oldDoctorCode, String patients)throws Exception {
|
|
|
|
String [] patiensString=patients.split(",");
|
|
|
|
for (int i=0;i<patiensString.length;i++){
|
|
|
|
updateTeamHealthDoctor(newDoctorCode,oldDoctorCode,patiensString[i]);
|
|
|
|
|
|
public void updateTeamHealthDoctors(String newDoctorCode, String oldDoctorCode, String patients) throws Exception {
|
|
|
|
String[] patiensString = patients.split(",");
|
|
|
|
for (int i = 0; i < patiensString.length; i++) {
|
|
|
|
updateTeamHealthDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 医生更换手机号
|
|
|
|
*
|
|
|
|
* @param doctor 医生code
|
|
|
|
* @param mobile 新手机号
|
|
|
|
* @param captcha 验证码
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public int changeMobile(String doctor, String mobile, String captcha, int type) {
|
|
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
|
|
|
|
|
|
if (doc == null) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 验证码验证
|
|
|
|
int smsCheck = smsService.check(mobile, type == 1 ? 7 : 8, captcha);
|
|
|
|
// 验证失败,不允许变更
|
|
|
|
if (smsCheck != 1) {
|
|
|
|
return -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
doc.setMobile(mobile);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
}
|
|
}
|