|
@@ -21,18 +21,19 @@ import com.diagbot.vo.TemplateInfosIdVO;
|
|
|
import com.diagbot.vo.TemplateInfosVO;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author wangfeng
|
|
|
- * @Description: 病历模板
|
|
|
+ * @Description: 演示病历
|
|
|
* @date 2018年11月16日 上午11:24:36
|
|
|
*/
|
|
|
@Component
|
|
|
public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
/**
|
|
|
- * 根据模板id 修改模板名
|
|
|
+ * 根据病历id 修改病历名
|
|
|
*
|
|
|
* @param templateInfoRevampVO
|
|
|
* @return
|
|
@@ -45,9 +46,9 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
.eq("id", templateInfoRevampVO.getId());
|
|
|
int sum = count(templateInfoFand);
|
|
|
if (sum == 0) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板不存在");
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历不存在");
|
|
|
}
|
|
|
- //2.再判断该医院下模板名是否重复存在
|
|
|
+ //2.再判断该医院下病历名是否重复存在
|
|
|
QueryWrapper<TemplateInfo> templates = new QueryWrapper<>();
|
|
|
Map<String, Object> mapAll = new HashMap<>();
|
|
|
mapAll.put("hospital_id", templateInfoRevampVO.getHospitalId());
|
|
@@ -56,12 +57,12 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
templates.allEq(mapAll);
|
|
|
TemplateInfo datas = getOne(templates, false);
|
|
|
if (datas != null) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板名已存在");
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历名已存在");
|
|
|
}
|
|
|
- //3.修改表数据的模板名字
|
|
|
+ //3.修改表数据的病历名字
|
|
|
TemplateInfo templateInfo = new TemplateInfo();
|
|
|
- templateInfo.setId(templateInfoRevampVO.getId());//模板id
|
|
|
- templateInfo.setName(templateInfoRevampVO.getModeName());//模板名称
|
|
|
+ templateInfo.setId(templateInfoRevampVO.getId());//病历id
|
|
|
+ templateInfo.setName(templateInfoRevampVO.getModeName());//病历名称
|
|
|
templateInfo.setGmtModified(DateUtil.now());//修改时间
|
|
|
boolean res = updateById(templateInfo);
|
|
|
if (!res) {
|
|
@@ -72,13 +73,13 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 保存模板
|
|
|
+ * 保存病历
|
|
|
*
|
|
|
* @param templateInfosVO
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean saveTemplateInfo(TemplateInfosVO templateInfosVO) {
|
|
|
- //1.判断该医院下是否存在模板名相同的数据
|
|
|
+ //1.判断该医院下是否存在病历名相同的数据
|
|
|
TemplateInfo templateInfo = new TemplateInfo();
|
|
|
QueryWrapper<TemplateInfo> templateInfoFand = new QueryWrapper<>();
|
|
|
Map<String, Object> mapAll = new HashMap<>();
|
|
@@ -89,15 +90,17 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
templateInfoFand.allEq(mapAll);
|
|
|
int sum = count(templateInfoFand);
|
|
|
if (sum != 0) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板名存在");
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历名存在");
|
|
|
}
|
|
|
//2.获取传入的数据,保存到数据表中。
|
|
|
- templateInfo.setGmtCreate(DateUtil.now());//创建时间
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ templateInfo.setGmtCreate(now);//创建时间
|
|
|
+ templateInfo.setGmtModified(now);//修改时间
|
|
|
templateInfo.setHospitalId(templateInfosVO.getHospitalId());//医院id
|
|
|
templateInfo.setSex(templateInfosVO.getSex());
|
|
|
templateInfo.setPreview(templateInfosVO.getPreview());//文本的展示
|
|
|
templateInfo.setDataJson(templateInfosVO.getDataJson());//页面json
|
|
|
- templateInfo.setName(templateInfosVO.getModeName());//模板名称
|
|
|
+ templateInfo.setName(templateInfosVO.getModeName());//病历名称
|
|
|
boolean res = save(templateInfo);
|
|
|
if (!res) {
|
|
|
throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED);
|
|
@@ -106,7 +109,7 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据模板id批量删除模板
|
|
|
+ * 根据病历id批量删除病历
|
|
|
*
|
|
|
* @param templateInfosIdVO
|
|
|
* @return
|
|
@@ -121,7 +124,7 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
String[] splitIds = substring.split(",");
|
|
|
//验证转化好的参数
|
|
|
if (ListUtil.isEmpty(ListUtil.arrayToList(splitIds))) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入模板id");
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入病历id");
|
|
|
}
|
|
|
//把分割的id数据传入对象中,在表中批量删除
|
|
|
UpdateWrapper<TemplateInfo> templateInfoNew = new UpdateWrapper<>();
|
|
@@ -147,14 +150,17 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
* @param templateIdVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public TemplateInfoDTO getTemplateIdAlls(TemplateIdVO templateIdVO) {
|
|
|
- //根据模板id在数据表中查出相应的模板数据
|
|
|
+ public TemplateInfoDTO getTemplatebyId(TemplateIdVO templateIdVO) {
|
|
|
+ //根据病历id在数据表中查出相应的病历数据
|
|
|
QueryWrapper<TemplateInfo> templateInfoQuery = new QueryWrapper<>();
|
|
|
templateInfoQuery
|
|
|
.eq("id", templateIdVO.getId())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
TemplateInfoDTO data = new TemplateInfoDTO();
|
|
|
TemplateInfo datas = getOne(templateInfoQuery, false);
|
|
|
+ if (datas == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历不存在");
|
|
|
+ }
|
|
|
//过滤
|
|
|
BeanUtil.copyProperties(datas, data);
|
|
|
return data;
|