|
@ -4,11 +4,13 @@ package com.yihu.jw.base.service.a3service;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.base.dao.a2dao.MediicineDeviceDao;
|
|
|
import com.yihu.jw.base.dao.a2dao.MediicinedrugsDao;
|
|
|
import com.yihu.jw.base.dao.role.RoleDao;
|
|
|
import com.yihu.jw.base.dao.user.UserDao;
|
|
|
import com.yihu.jw.base.util.ConstantUtils;
|
|
|
import com.yihu.jw.base.util.JavaBeanUtils;
|
|
|
import com.yihu.jw.entity.a1entity.Mediicinedevice;
|
|
|
import com.yihu.jw.entity.a1entity.Mediicinedrugs;
|
|
|
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
@ -44,6 +46,9 @@ public class MedicineDrugsService extends BaseJpaService<Mediicinedrugs, Mediici
|
|
|
@Autowired
|
|
|
private MediicinedrugsDao drugsDao;
|
|
|
|
|
|
@Autowired
|
|
|
private MediicineDeviceDao deviceDao;
|
|
|
|
|
|
@Autowired
|
|
|
private UserDao userDao;
|
|
|
|
|
@ -351,6 +356,70 @@ public class MedicineDrugsService extends BaseJpaService<Mediicinedrugs, Mediici
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject getDrugListByDevice(String content, String deviceId) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
if (deviceId == null || StringUtils.isEmpty(deviceId)) {
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
result.put("msg", "deviceId is null or empty");
|
|
|
return result;
|
|
|
}
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId);
|
|
|
String sql = "SELECT\n" +
|
|
|
" t.id as id,\n" +
|
|
|
" t.approval_num as approvalNum,\n" +
|
|
|
" t.barcode as barcode,\n" +
|
|
|
" t.brand as brand,\n" +
|
|
|
" t.dos_form as dosForm,\n" +
|
|
|
" t.state as state,\n" +
|
|
|
" t.drug_bar_code as drugBarCode,\n" +
|
|
|
" t.drug_class as drugClass,\n" +
|
|
|
" t.drug_class_code as drugClassCode,\n" +
|
|
|
" t.drug_code as drugCode,\n" +
|
|
|
" t.drug_name as drugName,\n" +
|
|
|
" t.drug_name_alies as drugNameAlies,\n" +
|
|
|
" t.drug_short_code as drugShortCode,\n" +
|
|
|
" t.drug_type_code as drugTypeCode,\n" +
|
|
|
" t.earlywarningcate as earlywarningcate,\n" +
|
|
|
" t.inventory as inventory,\n" +
|
|
|
" t.manufactor as manufactor,\n" +
|
|
|
" t.med_cabinet as medCabinet,\n" +
|
|
|
" t.pic as pic,\n" +
|
|
|
" t.price as price,\n" +
|
|
|
" t.sale_volume as saleVolume,\n" +
|
|
|
" t.self_code as selfCode,\n" +
|
|
|
" t.specif as specif,\n" +
|
|
|
" t.unit as unit,\n" +
|
|
|
" t.create_time as createTime,\n" +
|
|
|
" t.create_user as createUser,\n" +
|
|
|
" t.create_user_name as createUserName,\n" +
|
|
|
" t.update_time as updateTime,\n" +
|
|
|
" t.update_user as updateUser,\n" +
|
|
|
" t.update_user_name as updateUserName,\n" +
|
|
|
" t.drug_sku as drugSku,\n" +
|
|
|
" t.drug_num as drugNum,\n" +
|
|
|
" t.use_num as useNum,\n" +
|
|
|
" t.use_way as useWay,\n" +
|
|
|
" t.use_rate as useRate,\n" +
|
|
|
" t.use_dose as useDose,\n" +
|
|
|
" t.use_way_add as useWayAdd,\n" +
|
|
|
" t.org_code as orgCode,\n" +
|
|
|
" t.org_name as orgName,\n" +
|
|
|
" t.quantity_unit as quantityUnit,\n" +
|
|
|
" t.pack_unit as packUnit\n" +
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_drugs AS t\n";
|
|
|
|
|
|
String conditionSql = " WHERE t.org_code = '" + mediicinedevice.getBelongCommunity() + "'\n";
|
|
|
if (!StringUtils.isEmpty(content)) {
|
|
|
conditionSql += " AND CONCAT(IFNULL(t.`drug_name`,''),IFNULL(t.`drug_code`,''),IFNULL(t.`drug_name_alies`,'')) LIKE '%" + content + "%'";
|
|
|
}
|
|
|
// List<Mediicinedrugs> mediicinedrugs = drugsDao.findMediicinedrugsByOrgCode(mediicinedevice.getBelongCommunity());
|
|
|
result.put("msg", hibenateUtils.createSQLQuery(sql + conditionSql));
|
|
|
result.put("response", ConstantUtils.SUCCESS);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public void pushListWrite(OutputStream os, List<Map<String, Object>> ls) throws Exception {
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|