|
@@ -1,209 +1,282 @@
|
|
-package com.diagbot.facade;
|
|
|
|
-
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
-import com.diagbot.dto.TemplateInfoDTO;
|
|
|
|
-import com.diagbot.dto.TemplateInfoPageDTO;
|
|
|
|
-import com.diagbot.entity.TemplateInfo;
|
|
|
|
-import com.diagbot.enums.IsDeleteEnum;
|
|
|
|
-import com.diagbot.exception.CommonErrorCode;
|
|
|
|
-import com.diagbot.exception.CommonException;
|
|
|
|
-import com.diagbot.service.impl.TemplateInfoServiceImpl;
|
|
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
|
-import com.diagbot.util.DateUtil;
|
|
|
|
-import com.diagbot.util.GsonUtil;
|
|
|
|
-import com.diagbot.util.ListUtil;
|
|
|
|
-import com.diagbot.vo.TemplateIdVO;
|
|
|
|
-import com.diagbot.vo.TemplateInfoPageVO;
|
|
|
|
-import com.diagbot.vo.TemplateInfoRevampVO;
|
|
|
|
-import com.diagbot.vo.TemplateInfoVO;
|
|
|
|
-import com.diagbot.vo.TemplateInfosIdVO;
|
|
|
|
-import com.diagbot.vo.TemplateInfosVO;
|
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
|
-
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * @author wangfeng
|
|
|
|
- * @Description: 病历模板
|
|
|
|
- * @date 2018年11月16日 上午11:24:36
|
|
|
|
- */
|
|
|
|
-@Component
|
|
|
|
-public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param templateInfoVO
|
|
|
|
- * @return 医生病历模板信息
|
|
|
|
- */
|
|
|
|
- public List<TemplateInfoDTO> findByDoctorIdTemplates(TemplateInfoVO templateInfoVO) {
|
|
|
|
- //根据传入的医生id和部门id还有医院id在数据表中查出相应的模板数据
|
|
|
|
-
|
|
|
|
- QueryWrapper<TemplateInfo> templateInfoQuery = new QueryWrapper<>();
|
|
|
|
- Map<String, Object> mapAll = new HashMap<>();
|
|
|
|
- mapAll.put("hospital_dept_id", templateInfoVO.getHospitalDeptId());
|
|
|
|
- mapAll.put("doctor_id", templateInfoVO.getDoctorId());
|
|
|
|
- mapAll.put("hospital_id", templateInfoVO.getHospitalId());
|
|
|
|
- mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
- mapAll.put("type", templateInfoVO.getType());
|
|
|
|
- if (templateInfoVO.getSex() != null) {
|
|
|
|
- templateInfoQuery.allEq(mapAll).in("sex", 3, templateInfoVO.getSex()).orderByDesc("gmt_create");
|
|
|
|
- } else {
|
|
|
|
- templateInfoQuery.allEq(mapAll).orderByDesc("gmt_create");
|
|
|
|
- }
|
|
|
|
- List<TemplateInfoDTO> data = new ArrayList<TemplateInfoDTO>();
|
|
|
|
- List<TemplateInfo> datas = list(templateInfoQuery);
|
|
|
|
- //过滤
|
|
|
|
- data = BeanUtil.listCopyTo(datas, TemplateInfoDTO.class);
|
|
|
|
-
|
|
|
|
- return data;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 根据模板id 修改模板名
|
|
|
|
- *
|
|
|
|
- * @param templateInfoRevampVO
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public boolean updateByIdUsName(TemplateInfoRevampVO templateInfoRevampVO) {
|
|
|
|
- //1.先判断数据是否存在有效
|
|
|
|
- QueryWrapper<TemplateInfo> templateInfoFand = new QueryWrapper<>();
|
|
|
|
- templateInfoFand
|
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
- .eq("id", templateInfoRevampVO.getId());
|
|
|
|
- int sum = count(templateInfoFand);
|
|
|
|
- if (sum == 0) {
|
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板不存在");
|
|
|
|
- }
|
|
|
|
- //2.再判断该医生下模板名是否重复重在
|
|
|
|
- QueryWrapper<TemplateInfo> templates = new QueryWrapper<>();
|
|
|
|
- Map<String, Object> mapAll = new HashMap<>();
|
|
|
|
- mapAll.put("hospital_dept_id", templateInfoRevampVO.getHospitalDeptId());
|
|
|
|
- mapAll.put("doctor_id", templateInfoRevampVO.getDoctorId());
|
|
|
|
- mapAll.put("hospital_id", templateInfoRevampVO.getHospitalId());
|
|
|
|
- mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
- mapAll.put("name", templateInfoRevampVO.getModeName());
|
|
|
|
- //mapAll.put("type", templateInfoRevampVO.getType());
|
|
|
|
- templates.allEq(mapAll);
|
|
|
|
- TemplateInfo datas = getOne(templates, false);
|
|
|
|
- if (datas != null) {
|
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板名已存在");
|
|
|
|
- }
|
|
|
|
- //3.修改表数据的模板名字
|
|
|
|
- TemplateInfo templateInfo = new TemplateInfo();
|
|
|
|
- templateInfo.setId(templateInfoRevampVO.getId());//模板id
|
|
|
|
- templateInfo.setName(templateInfoRevampVO.getModeName());//模板名称
|
|
|
|
- templateInfo.setGmtModified(DateUtil.now());//修改时间
|
|
|
|
- boolean res = updateById(templateInfo);
|
|
|
|
- if (!res) {
|
|
|
|
- throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return res;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 保存模板
|
|
|
|
- *
|
|
|
|
- * @param templateInfosVO
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public boolean saveTemplateInfo(TemplateInfosVO templateInfosVO) {
|
|
|
|
- //1.判断该医生下是否存在模板名相同的数据
|
|
|
|
- TemplateInfo templateInfo = new TemplateInfo();
|
|
|
|
- QueryWrapper<TemplateInfo> templateInfoFand = new QueryWrapper<>();
|
|
|
|
- Map<String, Object> mapAll = new HashMap<>();
|
|
|
|
- mapAll.put("hospital_dept_id", templateInfosVO.getHospitalDeptId());
|
|
|
|
- mapAll.put("doctor_id", templateInfosVO.getDoctorId());
|
|
|
|
- mapAll.put("hospital_id", templateInfosVO.getHospitalId());
|
|
|
|
- mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
- mapAll.put("name", templateInfosVO.getModeName());
|
|
|
|
- //mapAll.put("type", templateInfosVO.getModeType());
|
|
|
|
-
|
|
|
|
- templateInfoFand.allEq(mapAll);
|
|
|
|
- int sum = count(templateInfoFand);
|
|
|
|
- if (sum != 0) {
|
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板名存在");
|
|
|
|
- }
|
|
|
|
- //2.获取传入的数据,保存到数据表中。
|
|
|
|
- templateInfo.setCreator(templateInfosVO.getDoctorId().toString());//创建人id
|
|
|
|
- templateInfo.setDoctorId(templateInfosVO.getDoctorId());//医生id
|
|
|
|
- templateInfo.setGmtCreate(DateUtil.now());//创建时间
|
|
|
|
- templateInfo.setHospitalDeptId(templateInfosVO.getHospitalDeptId());//部门id
|
|
|
|
- templateInfo.setHospitalId(templateInfosVO.getHospitalId());//医院id
|
|
|
|
- templateInfo.setSex(templateInfosVO.getSex());
|
|
|
|
- templateInfo.setPreview(GsonUtil.toJson(templateInfosVO.getPreview()));//文本的展示
|
|
|
|
- templateInfo.setDataJson(templateInfosVO.getDataJson());//页面json
|
|
|
|
- templateInfo.setName(templateInfosVO.getModeName());//模板名称
|
|
|
|
- templateInfo.setType(templateInfosVO.getModeType());//模板类型
|
|
|
|
- boolean res = save(templateInfo);
|
|
|
|
- if (!res) {
|
|
|
|
- throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return res;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 根据模板id批量删除模板
|
|
|
|
- *
|
|
|
|
- * @param templateInfosIdVO
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public boolean cancelTemplateInfo(TemplateInfosIdVO templateInfosIdVO) {
|
|
|
|
- //1.获取传入的ids数据
|
|
|
|
- String ids = templateInfosIdVO.getIds();
|
|
|
|
- //2.截取到最后一个
|
|
|
|
- String substring = ids.substring(0, ids.length());
|
|
|
|
- //System.out.println(substring);
|
|
|
|
- //3.以逗号分割
|
|
|
|
- String[] splitIds = substring.split(",");
|
|
|
|
- //验证转化好的参数
|
|
|
|
- if (ListUtil.isEmpty(ListUtil.arrayToList(splitIds))) {
|
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入模板id");
|
|
|
|
- }
|
|
|
|
- //把分割的id数据传入对象中,在表中批量删除
|
|
|
|
- UpdateWrapper<TemplateInfo> templateInfoNew = new UpdateWrapper<>();
|
|
|
|
- templateInfoNew
|
|
|
|
- .in("id", ListUtil.arrayToList(splitIds))
|
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
- .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
|
- //.set("modifier",UserUtils.getCurrentPrincipleID())
|
|
|
|
- .set("gmt_modified", DateUtil.now());
|
|
|
|
- boolean res = update(new TemplateInfo(), templateInfoNew);
|
|
|
|
-
|
|
|
|
- return res;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param page
|
|
|
|
- * @param templateInfoPageVO
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public IPage<TemplateInfoPageDTO> getTemplatePageAlls(Page page, TemplateInfoPageVO templateInfoPageVO) {
|
|
|
|
- IPage<TemplateInfoPageDTO> TemplateInfoData = getTemplatePages(templateInfoPageVO);
|
|
|
|
- return TemplateInfoData;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param templateIdVO
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public TemplateInfoDTO getTemplateIdAlls(TemplateIdVO templateIdVO) {
|
|
|
|
- //根据传入的医生id和部门id还有医院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);
|
|
|
|
- //过滤
|
|
|
|
- BeanUtil.copyProperties(datas, data);
|
|
|
|
- return data;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+package com.diagbot.facade;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.diagbot.client.TranServiceClient;
|
|
|
|
+import com.diagbot.dto.HospitalDeptInfoAllDTO;
|
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
|
+import com.diagbot.dto.TemplateInfoDTO;
|
|
|
|
+import com.diagbot.dto.TemplateInfoPageAllDTO;
|
|
|
|
+import com.diagbot.dto.TemplateInfoPageDTO;
|
|
|
|
+import com.diagbot.entity.TemplateInfo;
|
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
|
+import com.diagbot.enums.TemplateTypeEnum;
|
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
|
+import com.diagbot.service.impl.TemplateInfoServiceImpl;
|
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
|
+import com.diagbot.util.GsonUtil;
|
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
|
+import com.diagbot.vo.HospitalCodeVo;
|
|
|
|
+import com.diagbot.vo.TemplateIdVO;
|
|
|
|
+import com.diagbot.vo.TemplateInfoAdminPageVO;
|
|
|
|
+import com.diagbot.vo.TemplateInfoPageVO;
|
|
|
|
+import com.diagbot.vo.TemplateInfoRevampVO;
|
|
|
|
+import com.diagbot.vo.TemplateInfoTypeVO;
|
|
|
|
+import com.diagbot.vo.TemplateInfoVO;
|
|
|
|
+import com.diagbot.vo.TemplateInfosIdVO;
|
|
|
|
+import com.diagbot.vo.TemplateInfosVO;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @author wangfeng
|
|
|
|
+ * @Description: 病历模板
|
|
|
|
+ * @date 2018年11月16日 上午11:24:36
|
|
|
|
+ */
|
|
|
|
+@Component
|
|
|
|
+public class TemplateInfoFacade extends TemplateInfoServiceImpl {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ TranServiceClient tranServiceClient;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param templateInfoVO
|
|
|
|
+ * @return 医生病历模板信息
|
|
|
|
+ */
|
|
|
|
+ public Map<Integer, List<TemplateInfoDTO>> findByDoctorIdTemplates(TemplateInfoVO templateInfoVO) {
|
|
|
|
+ //根据传入的医生id和部门id还有医院id在数据表中查出相应的模板数据
|
|
|
|
+
|
|
|
|
+ QueryWrapper<TemplateInfo> templateInfoQuery = new QueryWrapper<>();
|
|
|
|
+ Map<String, Object> mapAll = new HashMap<>();
|
|
|
|
+ mapAll.put("hospital_dept_id", templateInfoVO.getHospitalDeptId());
|
|
|
|
+ mapAll.put("doctor_id", templateInfoVO.getDoctorId());
|
|
|
|
+ mapAll.put("hospital_id", templateInfoVO.getHospitalId());
|
|
|
|
+ mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ mapAll.put("type", templateInfoVO.getType());
|
|
|
|
+ if (templateInfoVO.getSex() != null) {
|
|
|
|
+ templateInfoQuery.allEq(mapAll).in("sex", 3, templateInfoVO.getSex()).orderByDesc("gmt_create");
|
|
|
|
+ } else {
|
|
|
|
+ templateInfoQuery.allEq(mapAll).orderByDesc("gmt_create");
|
|
|
|
+ }
|
|
|
|
+ List<TemplateInfoDTO> data = new ArrayList<TemplateInfoDTO>();
|
|
|
|
+ List<TemplateInfo> datas = list(templateInfoQuery);
|
|
|
|
+ //过滤
|
|
|
|
+ data = BeanUtil.listCopyTo(datas, TemplateInfoDTO.class);
|
|
|
|
+ Map<Integer, List<TemplateInfoDTO>> lixExMap = data.stream()
|
|
|
|
+ .collect(Collectors.groupingBy(TemplateInfoDTO::getTemplateInfoType));
|
|
|
|
+ return lixExMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据模板id 修改模板名
|
|
|
|
+ *
|
|
|
|
+ * @param templateInfoRevampVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public boolean updateByIdUsName(TemplateInfoRevampVO templateInfoRevampVO) {
|
|
|
|
+ //1.先判断数据是否存在有效
|
|
|
|
+ QueryWrapper<TemplateInfo> templateInfoFand = new QueryWrapper<>();
|
|
|
|
+ templateInfoFand
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("id", templateInfoRevampVO.getId());
|
|
|
|
+ int sum = count(templateInfoFand);
|
|
|
|
+ if (sum == 0) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板不存在");
|
|
|
|
+ }
|
|
|
|
+ //2.先判断数据是否有权限修改
|
|
|
|
+ QueryWrapper<TemplateInfo> templateInfoAmind = new QueryWrapper<>();
|
|
|
|
+ templateInfoAmind
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("id", templateInfoRevampVO.getId())
|
|
|
|
+ .eq("template_type", TemplateTypeEnum.PersonalTemplate.getKey());
|
|
|
|
+ int sumA = count(templateInfoAmind);
|
|
|
|
+ if (sumA == 0) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "标准模板无权修改");
|
|
|
|
+ }
|
|
|
|
+ //2.再判断该医生下模板名是否重复重在
|
|
|
|
+ QueryWrapper<TemplateInfo> templates = new QueryWrapper<>();
|
|
|
|
+ Map<String, Object> mapAll = new HashMap<>();
|
|
|
|
+ mapAll.put("hospital_dept_id", templateInfoRevampVO.getHospitalDeptId());
|
|
|
|
+ mapAll.put("doctor_id", templateInfoRevampVO.getDoctorId());
|
|
|
|
+ mapAll.put("hospital_id", templateInfoRevampVO.getHospitalId());
|
|
|
|
+ mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ mapAll.put("template_type", TemplateTypeEnum.PersonalTemplate.getKey());
|
|
|
|
+ mapAll.put("name", templateInfoRevampVO.getModeName());
|
|
|
|
+ //mapAll.put("type", templateInfoRevampVO.getType());
|
|
|
|
+ templates.allEq(mapAll);
|
|
|
|
+ TemplateInfo datas = getOne(templates, false);
|
|
|
|
+ if (datas != null) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板名已存在");
|
|
|
|
+ }
|
|
|
|
+ //3.修改表数据的模板名字
|
|
|
|
+ TemplateInfo templateInfo = new TemplateInfo();
|
|
|
|
+ templateInfo.setId(templateInfoRevampVO.getId());//模板id
|
|
|
|
+ templateInfo.setName(templateInfoRevampVO.getModeName());//模板名称
|
|
|
|
+ templateInfo.setGmtModified(DateUtil.now());//修改时间
|
|
|
|
+ boolean res = updateById(templateInfo);
|
|
|
|
+ if (!res) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存模板
|
|
|
|
+ *
|
|
|
|
+ * @param templateInfosVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public boolean saveTemplateInfo(TemplateInfosVO templateInfosVO) {
|
|
|
|
+ //1.判断该医生下是否存在模板名相同的数据
|
|
|
|
+ TemplateInfo templateInfo = new TemplateInfo();
|
|
|
|
+ QueryWrapper<TemplateInfo> templateInfoFand = new QueryWrapper<>();
|
|
|
|
+ Map<String, Object> mapAll = new HashMap<>();
|
|
|
|
+ mapAll.put("hospital_dept_id", templateInfosVO.getHospitalDeptId());
|
|
|
|
+ mapAll.put("doctor_id", templateInfosVO.getDoctorId());
|
|
|
|
+ mapAll.put("hospital_id", templateInfosVO.getHospitalId());
|
|
|
|
+ mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ mapAll.put("template_type", TemplateTypeEnum.PersonalTemplate.getKey());
|
|
|
|
+ mapAll.put("name", templateInfosVO.getModeName());
|
|
|
|
+ //mapAll.put("type", templateInfosVO.getModeType());
|
|
|
|
+
|
|
|
|
+ templateInfoFand.allEq(mapAll);
|
|
|
|
+ int sum = count(templateInfoFand);
|
|
|
|
+ if (sum != 0) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板名存在");
|
|
|
|
+ }
|
|
|
|
+ //2.获取传入的数据,保存到数据表中。
|
|
|
|
+ templateInfo.setCreator(templateInfosVO.getDoctorId().toString());//创建人id
|
|
|
|
+ templateInfo.setDoctorId(templateInfosVO.getDoctorId());//医生id
|
|
|
|
+ templateInfo.setGmtCreate(DateUtil.now());//创建时间
|
|
|
|
+ templateInfo.setHospitalDeptId(templateInfosVO.getHospitalDeptId());//部门id
|
|
|
|
+ templateInfo.setHospitalId(templateInfosVO.getHospitalId());//医院id
|
|
|
|
+ templateInfo.setSex(templateInfosVO.getSex());
|
|
|
|
+ templateInfo.setPreview(GsonUtil.toJson(templateInfosVO.getPreview()));//文本的展示
|
|
|
|
+ templateInfo.setDataJson(templateInfosVO.getDataJson());//页面json
|
|
|
|
+ templateInfo.setName(templateInfosVO.getModeName());//模板名称
|
|
|
|
+ templateInfo.setType(templateInfosVO.getModeType());//类型
|
|
|
|
+ templateInfo.setTemplateType(TemplateTypeEnum.PersonalTemplate.getKey());//模板类型
|
|
|
|
+ boolean res = save(templateInfo);
|
|
|
|
+ if (!res) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据模板id批量删除模板
|
|
|
|
+ *
|
|
|
|
+ * @param templateInfosIdVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public boolean cancelTemplateInfo(TemplateInfosIdVO templateInfosIdVO) {
|
|
|
|
+ //1.获取传入的ids数据
|
|
|
|
+ String ids = templateInfosIdVO.getIds();
|
|
|
|
+ //2.截取到最后一个
|
|
|
|
+ String substring = ids.substring(0, ids.length());
|
|
|
|
+ //System.out.println(substring);
|
|
|
|
+ //3.以逗号分割
|
|
|
|
+ String[] splitIds = substring.split(",");
|
|
|
|
+ //验证转化好的参数
|
|
|
|
+ if (ListUtil.isEmpty(ListUtil.arrayToList(splitIds))) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入模板id");
|
|
|
|
+ }
|
|
|
|
+ //把分割的id数据传入对象中,在表中批量删除
|
|
|
|
+ UpdateWrapper<TemplateInfo> templateInfoNew = new UpdateWrapper<>();
|
|
|
|
+ templateInfoNew
|
|
|
|
+ .in("id", ListUtil.arrayToList(splitIds))
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("template_type", TemplateTypeEnum.PersonalTemplate.getKey())
|
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
|
+ //.set("modifier",UserUtils.getCurrentPrincipleID())
|
|
|
|
+ .set("gmt_modified", DateUtil.now());
|
|
|
|
+ boolean res = update(new TemplateInfo(), templateInfoNew);
|
|
|
|
+
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param page
|
|
|
|
+ * @param templateInfoPageVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public TemplateInfoPageAllDTO getTemplatePageAlls(TemplateInfoAdminPageVO templateInfoPageVO) {
|
|
|
|
+ //取出所有科室
|
|
|
|
+ HospitalCodeVo hospitalCodeVo =new HospitalCodeVo();
|
|
|
|
+ hospitalCodeVo.setHospitalCode(templateInfoPageVO.getHospitalCode());
|
|
|
|
+ hospitalCodeVo.setDeptInfoName("");
|
|
|
|
+ hospitalCodeVo.setThirdpartyName("");
|
|
|
|
+ RespDTO<List<HospitalDeptInfoAllDTO>> deptInfoDTO = tranServiceClient.getHospitalDeptInfoAll(hospitalCodeVo);
|
|
|
|
+ RespDTOUtil.respNGDeal(deptInfoDTO, deptInfoDTO.msg);
|
|
|
|
+ List<HospitalDeptInfoAllDTO> deptInfo = deptInfoDTO.data;
|
|
|
|
+ Map<Long,HospitalDeptInfoAllDTO> deptMap =deptInfo.stream().collect(Collectors.toMap(HospitalDeptInfoAllDTO::getId,i->i));
|
|
|
|
+ TemplateInfoPageAllDTO data = new TemplateInfoPageAllDTO();
|
|
|
|
+ //取出个人模板
|
|
|
|
+ TemplateInfoTypeVO personalVO = new TemplateInfoTypeVO();
|
|
|
|
+ BeanUtil.copyProperties(templateInfoPageVO, personalVO);
|
|
|
|
+ personalVO.setTemplateType(TemplateTypeEnum.PersonalTemplate.getKey());
|
|
|
|
+ personalVO.setHospitalDeptId(null);
|
|
|
|
+ IPage<TemplateInfoPageDTO> personalTemplate = getTemplatePages(personalVO);
|
|
|
|
+ if(personalTemplate.getRecords().size()>0){
|
|
|
|
+ personalTemplate.getRecords().forEach(i->{
|
|
|
|
+ HospitalDeptInfoAllDTO datas = deptMap.get(i.getHospitalDeptId());
|
|
|
|
+ if(datas!=null){
|
|
|
|
+ i.setConceptDeptName(datas.getConceptDeptName());
|
|
|
|
+ i.setThirdpartyName(datas.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ data.setPersonalTemplate(personalTemplate);
|
|
|
|
+ //取出标准模板
|
|
|
|
+ TemplateInfoTypeVO adminVO = new TemplateInfoTypeVO();
|
|
|
|
+ BeanUtil.copyProperties(templateInfoPageVO, adminVO);
|
|
|
|
+ adminVO.setDoctorId(null);
|
|
|
|
+ adminVO.setTemplateType(TemplateTypeEnum.AdminTemplate.getKey());
|
|
|
|
+ IPage<TemplateInfoPageDTO> adminTemplate = getTemplatePages(adminVO);
|
|
|
|
+ if(adminTemplate.getRecords().size()>0){
|
|
|
|
+ adminTemplate.getRecords().forEach(i->{
|
|
|
|
+ HospitalDeptInfoAllDTO datas = deptMap.get(i.getHospitalDeptId());
|
|
|
|
+ if(datas!=null){
|
|
|
|
+ i.setConceptDeptName(datas.getConceptDeptName());
|
|
|
|
+ i.setThirdpartyName(datas.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ data.setAdminTemplate(adminTemplate);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param templateIdVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public TemplateInfoDTO getTemplateIdAlls(TemplateIdVO templateIdVO) {
|
|
|
|
+ //根据传入的医生id和部门id还有医院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);
|
|
|
|
+ //过滤
|
|
|
|
+ BeanUtil.copyProperties(datas, data);
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|