|
@ -38,8 +38,6 @@ public class TemplateManageService {
|
|
|
@Autowired
|
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
|
@Autowired
|
|
|
private SaasDao saasDao;
|
|
|
@Autowired
|
|
|
private BaseOrgDao baseOrgDao;
|
|
|
|
|
|
|
|
@ -91,33 +89,38 @@ public class TemplateManageService {
|
|
|
mixEnvelop.setTotalCount(count);
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
public void addOrRemoveChildrenDict(String templateId,String dictId,String isDel){
|
|
|
BaseTemplateDictDO baseTemplateDictDO = baseTemplateDictDao.findByDictIdAndTemplateId(dictId,templateId);
|
|
|
if ("1".equalsIgnoreCase(isDel)){
|
|
|
if (baseTemplateDictDO!=null){
|
|
|
baseTemplateDictDO.setIsDel("1");
|
|
|
}else {
|
|
|
baseTemplateDictDO = new BaseTemplateDictDO();
|
|
|
baseTemplateDictDO.setTemplateId(templateId);
|
|
|
baseTemplateDictDO.setDictId(dictId);
|
|
|
baseTemplateDictDO.setCreateTime(new Date());
|
|
|
baseTemplateDictDO.setIsDel("1");
|
|
|
}
|
|
|
public void addOrRemoveChildrenDict(String templateId,String dictIds,String isDel){
|
|
|
String[] dictArr=dictIds.split(",");
|
|
|
for (int i=0;i<dictArr.length;i++){
|
|
|
String dictId=dictArr[i];
|
|
|
BaseTemplateDictDO baseTemplateDictDO = baseTemplateDictDao.findByDictIdAndTemplateId(dictId,templateId);
|
|
|
if ("1".equalsIgnoreCase(isDel)){
|
|
|
if (baseTemplateDictDO!=null){
|
|
|
baseTemplateDictDO.setIsDel("1");
|
|
|
}else {
|
|
|
baseTemplateDictDO = new BaseTemplateDictDO();
|
|
|
baseTemplateDictDO.setTemplateId(templateId);
|
|
|
baseTemplateDictDO.setDictId(dictId);
|
|
|
baseTemplateDictDO.setCreateTime(new Date());
|
|
|
baseTemplateDictDO.setIsDel("1");
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
if (baseTemplateDictDO!=null){
|
|
|
baseTemplateDictDO.setIsDel("0");
|
|
|
}else {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
baseTemplateDictDao.save(baseTemplateDictDO);
|
|
|
BaseTemplateDO baseTemplateDO = baseTemplateDao.findOne(templateId);
|
|
|
Integer chuildrenCount = baseTemplateDictDao.getCountByTemplateId(templateId);
|
|
|
if (baseTemplateDO !=null ){
|
|
|
baseTemplateDO.setChildrenCount(chuildrenCount.toString());
|
|
|
}
|
|
|
baseTemplateDao.save(baseTemplateDO);
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
if (baseTemplateDictDO!=null){
|
|
|
baseTemplateDictDO.setIsDel("0");
|
|
|
}else {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
baseTemplateDictDao.save(baseTemplateDictDO);
|
|
|
BaseTemplateDO baseTemplateDO = baseTemplateDao.findOne(templateId);
|
|
|
Integer chuildrenCount = baseTemplateDictDao.getCountByTemplateId(templateId);
|
|
|
if (baseTemplateDO !=null ){
|
|
|
baseTemplateDO.setChildrenCount(chuildrenCount.toString());
|
|
|
}
|
|
|
baseTemplateDao.save(baseTemplateDO);
|
|
|
}
|
|
|
public void saveOrUpdateTemplate(String templateId,String code,String name,String user,String userName,String templateType){
|
|
|
BaseTemplateDO baseTemplateDO = baseTemplateDao.findOne(templateId);
|
|
@ -143,7 +146,7 @@ public class TemplateManageService {
|
|
|
baseTemplateDao.save(baseTemplateDO);
|
|
|
}
|
|
|
|
|
|
public MixEnvelop findTemlateChildList(String templateId,String name,Integer page,Integer pageSize){
|
|
|
public MixEnvelop findTemlateChildList(String templateId,String name,String code,Integer page,Integer pageSize){
|
|
|
BaseTemplateDO baseTemplateDictDO = baseTemplateDao.findOne(templateId);
|
|
|
PageRequest pageRequest = new PageRequest(page-1, pageSize);
|
|
|
List<Map<String,Object>> returnList= new ArrayList<>();
|
|
@ -154,7 +157,7 @@ public class TemplateManageService {
|
|
|
if ("frequencyDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
|
|
|
List<BaseFrequencyDictDO> list= new ArrayList<>();
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
list= baseFrequencyDictDao.findByNameDel(name,pageRequest);
|
|
|
list= baseFrequencyDictDao.findByNameDel(name,code,pageRequest);
|
|
|
}else {
|
|
|
list= baseFrequencyDictDao.findByDel(pageRequest);
|
|
|
}
|
|
@ -182,7 +185,7 @@ public class TemplateManageService {
|
|
|
}else if ("drugUseDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
|
|
|
List<BaseDrugUseDictDO> list= new ArrayList<>();
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
list= baseDrugUseDictDao.findByNameDel(name,pageRequest);
|
|
|
list= baseDrugUseDictDao.findByNameDel(name,code,pageRequest);
|
|
|
}else {
|
|
|
list= baseDrugUseDictDao.findByDel(pageRequest);
|
|
|
}
|
|
@ -208,7 +211,7 @@ public class TemplateManageService {
|
|
|
}else if ("drugListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
|
|
|
List<BaseDrugDictDO> list= new ArrayList<>();
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
list= baseDrugDictDao.findByNameDel(name,pageRequest);
|
|
|
list= baseDrugDictDao.findByNameDel(name,code,pageRequest);
|
|
|
}else {
|
|
|
list= baseDrugDictDao.findByDel(pageRequest);
|
|
|
}
|
|
@ -237,7 +240,7 @@ public class TemplateManageService {
|
|
|
}else if ("icd10ListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
|
|
|
List<DictIcd10DO> list= new ArrayList<>();
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
list= baseDictIcd10Dao.findByNameDel(name,pageRequest);
|
|
|
list= baseDictIcd10Dao.findByNameDel(name,code,pageRequest);
|
|
|
}else {
|
|
|
list= baseDictIcd10Dao.findByDel(pageRequest);
|
|
|
}
|
|
@ -331,7 +334,7 @@ public class TemplateManageService {
|
|
|
|
|
|
|
|
|
|
|
|
public MixEnvelop findTemlateAddChildList(String templateId,Integer page,Integer pageSize){
|
|
|
public MixEnvelop findTemlateAddChildList(String templateId,String name,String code,Integer page,Integer pageSize){
|
|
|
BaseTemplateDO baseTemplateDictDO = baseTemplateDao.findOne(templateId);
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
mixEnvelop.setPageSize(pageSize);
|
|
@ -350,9 +353,17 @@ public class TemplateManageService {
|
|
|
" t.status as \"status\"," +
|
|
|
" t.create_time as \"create_time\"" +
|
|
|
"from base_template_dict b left join base_frequency_dict t on b.dict_id=t.id" +
|
|
|
" where t.is_del='1' and b.is_del='1' ";
|
|
|
" where t.is_del='1' and b.is_del='1' and t.status ='1' ";
|
|
|
String sqlCount =" select count(1) as \"count\" from base_template_dict b left join base_frequency_dict t on b.dict_id=t.id" +
|
|
|
" where t.is_del='1 and b.is_del='1'";
|
|
|
" where t.is_del='1' and b.is_del='1' and t.status ='1' ";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.freq_code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.freq_code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.freq_name like '%"+name+"%'";
|
|
|
sqlCount+=" and t.freq_name like '%"+name+"%'";
|
|
|
}
|
|
|
sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
@ -386,9 +397,17 @@ public class TemplateManageService {
|
|
|
" t.status as \"status\"," +
|
|
|
" t.create_time as \"create_time\" " +
|
|
|
"from base_template_dict b left join base_drug_use_dict t on b.dict_id=t.id" +
|
|
|
" where t.del_flag='1' and b.is_del='1'";
|
|
|
" where t.del_flag='1' and b.is_del='1' and t.status ='1' ";
|
|
|
String sqlCount =" select count(1) as \"count\" from base_template_dict b left join base_drug_use_dict t on b.dict_id=t.id" +
|
|
|
" where t.del_flag='1 and b.is_del='1'";
|
|
|
" where t.del_flag='1' and b.is_del='1' and t.status ='1' ";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.supply_code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.supply_code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.supply_name like '%"+name+"%'";
|
|
|
sqlCount+=" and t.supply_name like '%"+name+"%'";
|
|
|
}
|
|
|
sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
@ -441,9 +460,17 @@ public class TemplateManageService {
|
|
|
" t.pack_unit as \"pack_unit\"," +
|
|
|
" t.is_del as \"is_del\"" +
|
|
|
" from base_template_dict b left join base_drug_dict t on b.dict_id = t.id " +
|
|
|
" where t.is_del='1' and b.is_del='1'";
|
|
|
" where t.is_del='1' and b.is_del='1' and t.status ='1' ";
|
|
|
String sqlCount = "select count(1) as \"count\" from base_template_dict b left join base_drug_dict t on b.dict_id = t.id " +
|
|
|
" where t.is_del='1'and b.is_del='1' ";
|
|
|
" where t.is_del='1' and b.is_del='1' and t.status ='1' ";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.charge_code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.charge_code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.drugname like '%"+name+"%'";
|
|
|
sqlCount+=" and t.drugname like '%"+name+"%'";
|
|
|
}
|
|
|
sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
@ -476,9 +503,17 @@ public class TemplateManageService {
|
|
|
" t.is_del as \"is_del\"," +
|
|
|
" t.status as \"status\" " +
|
|
|
" from base_template_dict b left join dict_icd10 t on b.dict_id=t.id" +
|
|
|
" where t.is_del='1' and b.is_del='1'";
|
|
|
" where t.is_del='1' and b.is_del='1' and t.status ='1' ";
|
|
|
String sqlCount =" select count(1) as \"count\" from base_template_dict b left join dict_icd10 t on b.dict_id=t.id" +
|
|
|
" where t.is_del='1' and b.is_del='1'";
|
|
|
" where t.is_del='1' and b.is_del='1' and t.status ='1' ";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.name like '%"+name+"%'";
|
|
|
sqlCount+=" and t.name like '%"+name+"%'";
|
|
|
}
|
|
|
sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
@ -506,7 +541,7 @@ public class TemplateManageService {
|
|
|
}
|
|
|
|
|
|
|
|
|
public MixEnvelop findTemlateNotAddChildList(String templateId,Integer page,Integer pageSize){
|
|
|
public MixEnvelop findTemlateNotAddChildList(String templateId,String name,String code,Integer page,Integer pageSize){
|
|
|
BaseTemplateDO baseTemplateDictDO = baseTemplateDao.findOne(templateId);
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
mixEnvelop.setPageSize(pageSize);
|
|
@ -526,10 +561,18 @@ public class TemplateManageService {
|
|
|
" t.create_time as \"create_time\"" +
|
|
|
" from base_frequency_dict t where t.id not in ( SELECT DISTINCT g.id from base_frequency_dict g left join base_template_dict " +
|
|
|
"m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1' ";
|
|
|
String sqlCount =" select count(1) as \"count\" from base_frequency_dict t where t.id not in ( SELECT DISTINCT g.id from base_frequency_dict g left join base_template_dict " +
|
|
|
"m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1' ";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.freq_code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.freq_code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.freq_name like '%"+name+"%'";
|
|
|
sqlCount+=" and t.freq_name like '%"+name+"%'";
|
|
|
}
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
for (Map<String,Object> map:list){
|
|
|
if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
|
|
@ -562,10 +605,18 @@ public class TemplateManageService {
|
|
|
" t.create_time as \"create_time\" " +
|
|
|
" from base_drug_use_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_use_dict g left join base_template_dict " +
|
|
|
"m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.del_flag='1' and t.status='1'";
|
|
|
String sqlCount =" select count(1) as \"count\" from base_drug_use_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_use_dict g left join base_template_dict " +
|
|
|
"m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.del_flag='1' and t.status='1'";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.supply_code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.supply_code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.supply_name like '%"+name+"%'";
|
|
|
sqlCount+=" and t.supply_name like '%"+name+"%'";
|
|
|
}
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
for (Map<String,Object> map:list){
|
|
|
if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
|
|
@ -617,10 +668,18 @@ public class TemplateManageService {
|
|
|
" t.is_del as \"is_del\"" +
|
|
|
" from base_drug_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_dict g left join base_template_dict " +
|
|
|
" m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
|
|
|
String sqlCount = "select count(1) as \"count\" from base_drug_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_dict g left join base_template_dict " +
|
|
|
"m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.charge_code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.charge_code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.drugname like '%"+name+"%'";
|
|
|
sqlCount+=" and t.drugname like '%"+name+"%'";
|
|
|
}
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
for (Map<String,Object> map:list){
|
|
|
if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
|
|
@ -652,10 +711,18 @@ public class TemplateManageService {
|
|
|
" t.status as \"status\" " +
|
|
|
" from dict_icd10 t where t.id not in ( SELECT DISTINCT g.id from dict_icd10 g left join base_template_dict " +
|
|
|
"m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
|
|
|
String sqlCount =" select count(1) as \"count\" from dict_icd10 t where t.id not in ( SELECT DISTINCT g.id from dict_icd10 g left join base_template_dict " +
|
|
|
"m on g.id = m.dict_id " +
|
|
|
"where m.template_id ='"+templateId+"')";
|
|
|
"where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
|
|
|
if (StringUtils.isNoneBlank(code)){
|
|
|
sql+=" and t.code like '%"+code+"%'";
|
|
|
sqlCount+=" and t.code like '%"+code+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.name like '%"+name+"%'";
|
|
|
sqlCount+=" and t.name like '%"+name+"%'";
|
|
|
}
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
for (Map<String,Object> map:list){
|
|
|
if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
|