|
@ -3,8 +3,14 @@ package com.yihu.jw.base.service.a3service;
|
|
|
|
|
|
|
|
|
import com.yihu.jw.base.dao.a2dao.*;
|
|
|
import com.yihu.jw.base.dao.equipment.WlyyUserAreaDao;
|
|
|
import com.yihu.jw.base.dao.role.RoleDao;
|
|
|
import com.yihu.jw.base.dao.user.UserDao;
|
|
|
import com.yihu.jw.entity.a1entity.*;
|
|
|
|
|
|
import com.yihu.jw.entity.base.role.RoleDO;
|
|
|
import com.yihu.jw.entity.base.user.UserDO;
|
|
|
import com.yihu.jw.entity.equipment.WlyyUserAreaDO;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -29,6 +35,10 @@ public class MedicinedevicePrintMessageService extends BaseJpaService<Medicinede
|
|
|
|
|
|
@Autowired
|
|
|
private HibenateUtils hibenateUtils;
|
|
|
@Autowired
|
|
|
private UserDao userDao;
|
|
|
@Autowired
|
|
|
private RoleDao roleDao;
|
|
|
|
|
|
//{"community":"社区名称","phone":"客服电话","equName":"设备名称","equNum":"设备编号","saleTime":"销售日期","shipTime":"取药时间","public":"公共信息","coding":"自编码","specifications":"规格","batchNo":"批次号","manufacturer":"生产厂家","validTime":"有效期","sourceCode":"溯源码","publicName":"药品通用名称","dosage":"剂型","holder":"上市许可持有人","approvalNumber":"批准文号"}
|
|
|
|
|
@ -53,7 +63,12 @@ public class MedicinedevicePrintMessageService extends BaseJpaService<Medicinede
|
|
|
}
|
|
|
return printMessage;
|
|
|
}else {
|
|
|
return printMessageDao.save(printMessage);
|
|
|
if (printMessageDao.findDeviceId(printMessage.getDeviceId())==null){
|
|
|
return printMessageDao.save(printMessage);
|
|
|
}else {
|
|
|
throw new Exception("该设备打印设置已存在!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -74,10 +89,48 @@ public class MedicinedevicePrintMessageService extends BaseJpaService<Medicinede
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> selectByCondition(String condition,Integer page,Integer size){
|
|
|
String sql = " SELECT d.equ_name as equName,d.equ_num as equNum,pm.picture,pm.remark_end as remarkEnd,pm.id as id from t_mediicine_device_print_message pm LEFT JOIN t_mediicine_device d ON pm.device_id = d.equ_num ";
|
|
|
public List<Map<String,Object>> selectByCondition(String condition,Integer page,Integer size,String uuid) throws Exception {
|
|
|
|
|
|
UserDO user = userDao.findOne(uuid);
|
|
|
RoleDO role = roleDao.findOne(user.getRoleId());
|
|
|
if (role==null){
|
|
|
throw new Exception("角色为空");
|
|
|
}
|
|
|
String conditionSql = "";
|
|
|
//市管理员
|
|
|
if ("saasAdmin".equals(role.getCode())) {
|
|
|
conditionSql = "SELECT\n" +
|
|
|
"\t`code`\tas community\n" +
|
|
|
"FROM\n" +
|
|
|
"\tdm_hospital\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tdel = 1";
|
|
|
}
|
|
|
//区域管理员
|
|
|
if ("regionAdmin".equals(role.getCode())) {
|
|
|
conditionSql = "SELECT\n" +
|
|
|
"\tdh.`code` AS community\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_user_area t\n" +
|
|
|
"LEFT JOIN dm_hospital dh ON t.town = dh.town\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt.user_id = '" + uuid + "'\n" +
|
|
|
"AND t.del = 1\n" +
|
|
|
"AND dh.del = 1";
|
|
|
}
|
|
|
//社区管理员
|
|
|
if ("communityAdmin".equals(role.getCode())) {
|
|
|
conditionSql = "SELECT\n" +
|
|
|
"t.hospital AS community\n" +
|
|
|
"FROM\n" +
|
|
|
"wlyy_user_area AS t\n" +
|
|
|
"WHERE\n" +
|
|
|
"t.user_id = '" + uuid + "'\n" +
|
|
|
"AND t.del = 1";
|
|
|
}
|
|
|
String sql = " SELECT d.equ_name as equName,d.equ_num as equNum,pm.picture,pm.remark_end as remarkEnd,pm.id as id from t_mediicine_device_print_message pm LEFT JOIN t_mediicine_device d ON pm.device_id = d.equ_num where 1=1 and d.belong_community IN ("+conditionSql+") ";
|
|
|
if (StringUtils.isNoneBlank(condition)){
|
|
|
sql += " where (d.equ_name LIKE '%"+condition+"%' OR d.equ_num LIKE '%"+condition+"%')";
|
|
|
sql += " (d.equ_name LIKE '%"+condition+"%' OR d.equ_num LIKE '%"+condition+"%')";
|
|
|
}
|
|
|
sql+=" order by pm.create_time desc ";
|
|
|
List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,size);
|