|
@ -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());
|