| 
															
																@ -9,6 +9,8 @@ import com.yihu.mysql.query.BaseJpaService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.apache.commons.lang.StringUtils; 
															 | 
															
															 | 
															
																import org.apache.commons.lang.StringUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.beans.BeanUtils; 
															 | 
															
															 | 
															
																import org.springframework.beans.BeanUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
															
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import org.springframework.jdbc.core.BeanPropertyRowMapper; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import org.springframework.jdbc.core.JdbcTemplate; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
															
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.transaction.annotation.Transactional; 
															 | 
															
															 | 
															
																import org.springframework.transaction.annotation.Transactional; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -23,12 +25,14 @@ import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																public class NationalDrugDictService extends BaseJpaService<BaseNationalDrugDictDO, BaseNationalDrugDictDao> { 
															 | 
															
															 | 
															
																public class NationalDrugDictService extends BaseJpaService<BaseNationalDrugDictDO, BaseNationalDrugDictDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private BaseNationalDrugDictDao nationalDrugDictDao; 
															 | 
															
															 | 
															
																    private BaseNationalDrugDictDao nationalDrugDictDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private JdbcTemplate jdbcTemplate; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public BaseNationalDrugDictDO saveNationalDrug(BaseNationalDrugDictDO nationalDrugDictDO) { 
															 | 
															
															 | 
															
																    public BaseNationalDrugDictDO saveNationalDrug(BaseNationalDrugDictDO nationalDrugDictDO) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        nationalDrugDictDO.setPyName(ConvertToSpellUtils.changeToTonePinYin(nationalDrugDictDO.getName())); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        nationalDrugDictDO.setPyCommonName(ConvertToSpellUtils.changeToTonePinYin(nationalDrugDictDO.getCommonName())); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //判断新增或编辑 
															 | 
															
															 | 
															
																        //判断新增或编辑 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (nationalDrugDictDO.getId() == null) { 
															 | 
															
															 | 
															
																        if (nationalDrugDictDO.getId() == null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            nationalDrugDictDO.setPyName(ConvertToSpellUtils.changeToTonePinYin(nationalDrugDictDO.getName())); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            nationalDrugDictDO.setPyCommonName(ConvertToSpellUtils.changeToTonePinYin(nationalDrugDictDO.getCommonName())); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            nationalDrugDictDO.setCreateTime(new Date()); 
															 | 
															
															 | 
															
																            nationalDrugDictDO.setCreateTime(new Date()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            nationalDrugDictDO.setStatus(1); 
															 | 
															
															 | 
															
																            nationalDrugDictDO.setStatus(1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            nationalDrugDictDO.setUpdateTime(new Date()); 
															 | 
															
															 | 
															
																            nationalDrugDictDO.setUpdateTime(new Date()); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -56,21 +60,27 @@ public class NationalDrugDictService extends BaseJpaService<BaseNationalDrugDict 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public MixEnvelop getNationalDrugList(String name, String number, String hospital, Integer status, Integer page, Integer pageSize) throws ParseException { 
															 | 
															
															 | 
															
																    public MixEnvelop getNationalDrugList(String name, String number, String hospital, Integer status, Integer page, Integer pageSize) throws ParseException { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        MixEnvelop mixEnvelop = new MixEnvelop(); 
															 | 
															
															 | 
															
																        MixEnvelop mixEnvelop = new MixEnvelop(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String filters = ""; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String sql = "SELECT id,number,name,subject_class,subject_class_name,drug_code,drug_name,hospital,hospital_name,relation_code,`status` " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "FROM `base_national_drug_dict` WHERE 1=1 "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (StringUtils.isNotBlank(name)) { 
															 | 
															
															 | 
															
																        if (StringUtils.isNotBlank(name)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            filters += "name?" + name + ";"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += "and name like '%" + name + "%' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (StringUtils.isNotBlank(number)) { 
															 | 
															
															 | 
															
																        if (StringUtils.isNotBlank(number)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            filters += "number?" + number + ";"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += "and number like '%" + number + "%' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (StringUtils.isNotBlank(hospital)) { 
															 | 
															
															 | 
															
																        if (StringUtils.isNotBlank(hospital)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            filters += "hospital=" + hospital + ";"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += "and hospital = '" + hospital + "' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += "and hospital is null "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (status != null) { 
															 | 
															
															 | 
															
																        if (status != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            filters += "status=" + status + ";"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += "status = " + status + " "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Integer count = jdbcTemplate.queryForList(sql).size(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if (page != null && pageSize != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += "order by create_time desc limit " + (page - 1) * pageSize + "," + pageSize; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Integer count = this.search(null, filters, null).size(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<BaseNationalDrugDictDO> list = this.search(null, filters, null, page, pageSize); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<BaseNationalDrugDictDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(BaseNationalDrugDictDO.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        mixEnvelop.setMessage("获取成功!"); 
															 | 
															
															 | 
															
																        mixEnvelop.setMessage("获取成功!"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        mixEnvelop.setCurrPage(page); 
															 | 
															
															 | 
															
																        mixEnvelop.setCurrPage(page); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        mixEnvelop.setPageSize(pageSize); 
															 | 
															
															 | 
															
																        mixEnvelop.setPageSize(pageSize); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -80,6 +90,10 @@ public class NationalDrugDictService extends BaseJpaService<BaseNationalDrugDict 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public void updateNationalDrugStatus(Integer id, Integer status) { 
															 | 
															
															 | 
															
																    public void updateNationalDrugStatus(Integer id, Integer status) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         nationalDrugDictDao.updateStatusById(id, status); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        nationalDrugDictDao.updateStatusById(id, status); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public BaseNationalDrugDictDO getNationalDrugById(Integer id) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return nationalDrugDictDao.findOne(id); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																} 
															 | 
															
															 | 
															
																} 
															 |