|
|
@@ -0,0 +1,147 @@
|
|
|
+package com.lc.ibps.business.service.impl;
|
|
|
+
|
|
|
+import com.lc.ibps.api.form.sql.util.BeanUtils;
|
|
|
+import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
+import com.lc.ibps.business.service.AuditService;
|
|
|
+import com.lc.ibps.common.api.INewsMgrService;
|
|
|
+import com.lc.ibps.common.system.persistence.entity.NewsPo;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Administrator
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class AuditServiceImpl implements AuditService {
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ICommonDao<?> commonDao;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private INewsMgrService newsMgrService;
|
|
|
+
|
|
|
+ // 管理评审通知
|
|
|
+ @Override
|
|
|
+ public void NoticeByOneMonth(){
|
|
|
+
|
|
|
+ String sql = "select ri_qi_,bian_zhi_bu_men_,di_dian_,date_format(date_sub(ri_qi_, interval 5 day),'%y-%m-%d') as advance,now() as current_date_ from t_gglpsjhx " +
|
|
|
+ " where shi_fou_guo_shen_='已完成' and (date_format(ri_qi_,'%y-%m-%d')<=date_format(date_add(now(), interval 1 month),'%y-%m-%d')" +
|
|
|
+ " and date_format(ri_qi_,'%y-%m-%d')>=CURRENT_DATE ) ";
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
+
|
|
|
+ if (BeanUtils.isNotEmpty(list)){
|
|
|
+ for (Map<String, Object> glps : list) {
|
|
|
+ String name = getJykzr(glps.get("di_dian_").toString());
|
|
|
+ String content = "<p>检验科管理层及各专业组</p><p>经检验科管理层商议决定,计划于:"+glps.get("ri_qi_")+
|
|
|
+ "召开质量管理体系运行的管理评审会议,请各职能组别和专业组负责人按照日程计划表,编制管理评审输入汇报材料,并提前5个工作日," +
|
|
|
+ "于"+glps.get("advance")+" 00:00 前发送给质量负责人核实整理后提交检验科主任,如有异议,可在3个工作日内提出。</p>" +
|
|
|
+ "<p>特此通知</p><p>检验科主任"+name+"</p><p>"+glps.get("current_date_")+"</p>";
|
|
|
+
|
|
|
+ NewsPo newsPo = new NewsPo();
|
|
|
+ newsPo.setAuthor("系统管理员");
|
|
|
+ newsPo.setContent(content);
|
|
|
+ newsPo.setPublicDate(new Date());
|
|
|
+ newsPo.setPublicItem("notices");
|
|
|
+ newsPo.setPublic0("Y");
|
|
|
+ newsPo.setStatus("publish");
|
|
|
+ newsPo.setTitle("管理评审通知");
|
|
|
+ newsPo.setUserId("1");
|
|
|
+ newsPo.setUserName("系统用户");
|
|
|
+ newsPo.setDepId(glps.get("bian_zhi_bu_men_").toString());
|
|
|
+ if (BeanUtils.isNotEmpty(glps.get("di_dian_"))){
|
|
|
+ newsPo.setType(glps.get("di_dian_").toString());
|
|
|
+ }
|
|
|
+ newsMgrService.save(newsPo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 内审通知
|
|
|
+ @Override
|
|
|
+ public void internalAudit(){
|
|
|
+ String sql = "SELECT nei_shen_kai_shi_,nei_shen_jie_shu_,bian_zhi_bu_men_,di_dian_,nei_shen_zu_cheng,nei_shen_zu_zu_ch,nei_shen_ren_yuan from t_nbss WHERE shi_fou_guo_shen_='已完成' " +
|
|
|
+ "and (date_format(nei_shen_kai_shi_,'%y-%m-%d')<=date_format(date_add(now(), interval 1 month),'%y-%m-%d') and date_format(nei_shen_kai_shi_,'%y-%m-%d')>=CURRENT_DATE ) ";
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
+
|
|
|
+ if (BeanUtils.isNotEmpty(list)){
|
|
|
+ for (Map<String, Object> nbps : list) {
|
|
|
+ String group = getUserName(nbps.get("nei_shen_ren_yuan").toString());//组员
|
|
|
+ String leaders = getUserName(nbps.get("nei_shen_zu_zu_ch").toString());// 组长
|
|
|
+ String director = getUserName(nbps.get("nei_shen_zu_cheng").toString());// 检验科主任
|
|
|
+ String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
|
+ String content = "内部审核通知:检验科管理层及各专业组经检验科管理层商议决定,如期" + nbps.get("nei_shen_kai_shi_")+" 至"+ nbps.get("nei_shen_jie_shu_") +
|
|
|
+ "开展质量管理体系运行的内部审核,内部审核组(组长:"+leaders+
|
|
|
+ "组员:"+ group +")>对检验科管理管理体系覆盖的所有场所、" +
|
|
|
+ "区域,包括检验前、检验、检验后及支持性管理过程进行现场审核,请按计划时间做好准备,如有异议,可在3个工作日内提出。附:《内审实施计划》。" +
|
|
|
+ "特此通知内部审核组长:"+ leaders +"检验科主任:"+ director + time + "抄送:医务处、各临床科室、信息科、设备科、护理部";
|
|
|
+
|
|
|
+ NewsPo newsPo = new NewsPo();
|
|
|
+ newsPo.setAuthor("系统管理员");
|
|
|
+ newsPo.setContent(content);
|
|
|
+ newsPo.setPublicDate(new Date());
|
|
|
+ newsPo.setPublicItem("notices");
|
|
|
+ newsPo.setPublic0("Y");
|
|
|
+ newsPo.setStatus("publish");
|
|
|
+ newsPo.setTitle("内审实施计划通知");
|
|
|
+ newsPo.setUserId("1");
|
|
|
+ newsPo.setUserName("系统用户");
|
|
|
+ newsPo.setDepId(nbps.get("bian_zhi_bu_men_").toString());
|
|
|
+ if (BeanUtils.isNotEmpty(nbps.get("di_dian_"))){
|
|
|
+ newsPo.setType(nbps.get("di_dian_").toString());
|
|
|
+ }
|
|
|
+ newsMgrService.save(newsPo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询检验科主任
|
|
|
+ * @param diDian
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getJykzr(String diDian){
|
|
|
+ String sql2 = " select *from ibps_party_employee where id_ in (select user_id_ from ibps_party_user_role " +
|
|
|
+ " where role_id_ in (select id_ from ibps_party_role where role_alias_='syszr')) and positions_ like '%"+diDian+"%' ";
|
|
|
+ List<Map<String, Object>> jykzr = (List<Map<String, Object>>) commonDao.query(sql2);
|
|
|
+ StringBuilder namesBuilder = new StringBuilder();
|
|
|
+ for (Map<String, Object> map : jykzr) {
|
|
|
+ Object name = map.get("NAME_");
|
|
|
+ if (name != null) {
|
|
|
+ namesBuilder.append(name.toString());
|
|
|
+ namesBuilder.append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (namesBuilder.length() > 0) {
|
|
|
+ namesBuilder.setLength(namesBuilder.length() - 1);
|
|
|
+ }
|
|
|
+ return namesBuilder.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public String getUserName(String userId){
|
|
|
+ String sql2 = " select *from ibps_party_employee where id_ in ("+userId+") ";
|
|
|
+ List<Map<String, Object>> userList = (List<Map<String, Object>>) commonDao.query(sql2);
|
|
|
+ StringBuilder namesBuilder = new StringBuilder();
|
|
|
+ for (Map<String, Object> map : userList) {
|
|
|
+ Object name = map.get("NAME_");
|
|
|
+ if (name != null) {
|
|
|
+ namesBuilder.append(name.toString());
|
|
|
+ namesBuilder.append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (namesBuilder.length() > 0) {
|
|
|
+ namesBuilder.setLength(namesBuilder.length() - 1);
|
|
|
+ }
|
|
|
+ return namesBuilder.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|