|
@ -7,13 +7,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
|
|
import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
|
|
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
|
|
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
|
|
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
|
|
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorDao;
|
|
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
|
|
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
|
|
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
|
|
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
|
|
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorHospitalDao;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorHospitalDao;
|
|
import com.yihu.jw.base.dao.org.BaseOrgDao;
|
|
|
|
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
|
|
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
|
|
import com.yihu.jw.base.service.org.OrgTree;
|
|
import com.yihu.jw.base.service.org.OrgTree;
|
|
import com.yihu.jw.base.service.org.OrgTreeService;
|
|
import com.yihu.jw.base.service.org.OrgTreeService;
|
|
@ -22,6 +20,7 @@ import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
|
|
import com.yihu.jw.base.service.org.tree.TreeNode;
|
|
import com.yihu.jw.base.service.org.tree.TreeNode;
|
|
import com.yihu.jw.base.util.ConstantUtils;
|
|
import com.yihu.jw.base.util.ConstantUtils;
|
|
import com.yihu.jw.base.util.JavaBeanUtils;
|
|
import com.yihu.jw.base.util.JavaBeanUtils;
|
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
|
|
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
|
|
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
|
|
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
|
|
@ -32,6 +31,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
import com.yihu.jw.exception.business.ManageException;
|
|
import com.yihu.jw.exception.business.ManageException;
|
|
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@ -226,10 +226,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public String createDoctor(String jsonData){
|
|
|
|
|
|
public String createDoctor(String jsonData) {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
if(StringUtils.isEmpty(jsonData)){
|
|
|
|
result.put("msg","jsonData is null");
|
|
|
|
|
|
if (StringUtils.isEmpty(jsonData)) {
|
|
|
|
result.put("msg", "jsonData is null");
|
|
result.put("response", ConstantUtils.FAIL);
|
|
result.put("response", ConstantUtils.FAIL);
|
|
return result.toJSONString();
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
@ -237,58 +237,60 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
JSONObject doctor = jsonObject.getJSONObject("doctor");
|
|
JSONObject doctor = jsonObject.getJSONObject("doctor");
|
|
JSONArray role = jsonObject.getJSONArray("role");
|
|
JSONArray role = jsonObject.getJSONArray("role");
|
|
JSONArray hospital = jsonObject.getJSONArray("hospital");
|
|
JSONArray hospital = jsonObject.getJSONArray("hospital");
|
|
if(null == doctor || CollectionUtils.isEmpty(hospital)){
|
|
|
|
result.put("msg","parameter doctor or hospital of jsonData is null");
|
|
|
|
|
|
if (null == doctor) {
|
|
|
|
result.put("msg", "医生信息不可为空!");
|
|
result.put("response", ConstantUtils.FAIL);
|
|
result.put("response", ConstantUtils.FAIL);
|
|
return result.toJSONString();
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
//组装医生信息
|
|
//组装医生信息
|
|
BaseDoctorDO baseDoctorDO = null;
|
|
BaseDoctorDO baseDoctorDO = null;
|
|
try {
|
|
try {
|
|
baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
|
|
|
|
|
|
baseDoctorDO = objectMapper.readValue(doctor.toJSONString(), BaseDoctorDO.class);
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
|
|
|
|
result.put("response",ConstantUtils.FAIL);
|
|
|
|
return result.toJSONString();
|
|
|
|
|
|
result.put("msg", "convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
|
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
|
|
|
|
|
|
baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11, 17));
|
|
this.save(baseDoctorDO);
|
|
this.save(baseDoctorDO);
|
|
|
|
|
|
//组装医生角色关联关系,医生默认可以没有角色
|
|
|
|
if(!CollectionUtils.isEmpty(role)){
|
|
|
|
BaseDoctorRoleDO baseDoctorRoleDO = null;
|
|
|
|
List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
for(Object object : role){
|
|
|
|
baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
|
|
|
|
baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
|
|
|
|
baseDoctorRoleDOList.add(baseDoctorRoleDO);
|
|
|
|
|
|
//组装医生角色关联关系,医生默认可以没有角色,没有机构/部门信息等
|
|
|
|
if (!CollectionUtils.isEmpty(role)) {
|
|
|
|
BaseDoctorRoleDO baseDoctorRoleDO = null;
|
|
|
|
List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
for (Object object : role) {
|
|
|
|
baseDoctorRoleDO = objectMapper.readValue(object.toString(), BaseDoctorRoleDO.class);
|
|
|
|
baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
|
|
|
|
baseDoctorRoleDOList.add(baseDoctorRoleDO);
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
|
|
|
result.put("msg", "convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
|
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
} catch (IOException e) {
|
|
|
|
result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
|
|
|
|
result.put("response",ConstantUtils.FAIL);
|
|
|
|
return result.toJSONString();
|
|
|
|
}
|
|
|
|
baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
|
|
|
|
|
|
baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
|
|
}
|
|
}
|
|
|
|
|
|
// 组装医生任职机构及职业信息
|
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = null;
|
|
|
|
List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
for(Object object : hospital){
|
|
|
|
baseDoctorHospitalDO = objectMapper.readValue(object.toString(),BaseDoctorHospitalDO.class);
|
|
|
|
baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
|
|
|
|
hospitalDOList.add(baseDoctorHospitalDO);
|
|
|
|
|
|
// 组装医生任职机构及职业信息,医生默认可以没有角色,没有机构/部门信息等
|
|
|
|
if (!CollectionUtils.isEmpty(hospital)) {
|
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = null;
|
|
|
|
List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
for (Object object : hospital) {
|
|
|
|
baseDoctorHospitalDO = objectMapper.readValue(object.toString(), BaseDoctorHospitalDO.class);
|
|
|
|
baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
|
|
|
|
hospitalDOList.add(baseDoctorHospitalDO);
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
|
|
|
result.put("msg", "convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
|
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
} catch (IOException e) {
|
|
|
|
result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
|
|
|
|
result.put("response",ConstantUtils.FAIL);
|
|
|
|
return result.toJSONString();
|
|
|
|
|
|
baseDoctorHospitalService.batchInsert(hospitalDOList);
|
|
}
|
|
}
|
|
baseDoctorHospitalService.batchInsert(hospitalDOList);
|
|
|
|
result.put("response",ConstantUtils.SUCCESS);
|
|
|
|
result.put("msg",baseDoctorDO);
|
|
|
|
|
|
result.put("response", ConstantUtils.SUCCESS);
|
|
|
|
result.put("msg", baseDoctorDO);
|
|
return result.toJSONString();
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
|
|
|
|
@ -310,7 +312,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
JSONArray role = jsonObject.getJSONArray("role");
|
|
JSONArray role = jsonObject.getJSONArray("role");
|
|
JSONArray hospital = jsonObject.getJSONArray("hospital");
|
|
JSONArray hospital = jsonObject.getJSONArray("hospital");
|
|
if(null == doctor){
|
|
if(null == doctor){
|
|
result.put("msg","parameter role of jsonData is null");
|
|
|
|
|
|
result.put("msg","parameter doctor of jsonData is null");
|
|
result.put("response", ConstantUtils.FAIL);
|
|
result.put("response", ConstantUtils.FAIL);
|
|
return result.toJSONString();
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
@ -334,7 +336,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
}
|
|
}
|
|
this.save(baseDoctorDO);
|
|
this.save(baseDoctorDO);
|
|
|
|
|
|
//修改医生角色关联关系,医生默认可以没有角色
|
|
|
|
|
|
//修改医生角色关联关系,医生默认可以没有角色,前端不修改就不做任何操作
|
|
if(!CollectionUtils.isEmpty(role)){
|
|
if(!CollectionUtils.isEmpty(role)){
|
|
BaseDoctorRoleDO baseDoctorRoleDO = null;
|
|
BaseDoctorRoleDO baseDoctorRoleDO = null;
|
|
Set<Object> roleIdList = baseDoctorRoleService.findRoleIdList(baseDoctorDO.getId());
|
|
Set<Object> roleIdList = baseDoctorRoleService.findRoleIdList(baseDoctorDO.getId());
|
|
@ -356,8 +358,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改医生任职机构及职业信息,前端不修改就不做任何操作
|
|
|
|
|
|
// 修改医生任职机构及职业信息,,医生默认可以没有机构/部门信息,前端不修改就不做任何操作
|
|
if(!CollectionUtils.isEmpty(hospital)){
|
|
if(!CollectionUtils.isEmpty(hospital)){
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = null;
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = null;
|
|
Set<Object> hospitalIdList = baseDoctorHospitalService.findDocHospIdList(baseDoctorDO.getId());
|
|
Set<Object> hospitalIdList = baseDoctorHospitalService.findDocHospIdList(baseDoctorDO.getId());
|