Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/ExpensiveGoodsAuthorization.java =================================================================== diff -u -r21862 -r21990 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/ExpensiveGoodsAuthorization.java (.../ExpensiveGoodsAuthorization.java) (revision 21862) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/ExpensiveGoodsAuthorization.java (.../ExpensiveGoodsAuthorization.java) (revision 21990) @@ -46,11 +46,11 @@ */ private Long id; /** - * 一次性物品定义的id + * 高值耗材物品定义的id */ private Long expensiveGoodsId ; /** - * 一次性物品定义的名称 + * 高值耗材物品定义的名称 */ private String expensiveGoodsName; /** Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/AuthorizationCertification.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/AuthorizationCertification.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/AuthorizationCertification.java (revision 21990) @@ -0,0 +1,110 @@ +package com.forgon.disinfectsystem.entity.expensivegoods; + +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * 授权证 + * @author Liuliben 2018-1-11 下午03:55:28 + */ + +@Entity +@Table(name = "AuthorizationCertification",indexes = { +@Index(columnList = "relevancyGoodsAuthorization_id", name = "rc_authorization_index") +}) +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class AuthorizationCertification { + + /** + * id + */ + private Long id; + + /** + * 授权证号码 + */ + private String authorizationNumber; + + /** + * 有效期 + */ + private Date validityTime; + + /** + * 类型 + */ + private String type; + /** + * 是否已上传图片 + */ + public String isUploadImage; + + @JsonIgnore + private RelevancyGoodsAuthorization relevancyGoodsAuthorization; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAuthorizationNumber() { + return authorizationNumber; + } + + public void setAuthorizationNumber(String authorizationNumber) { + this.authorizationNumber = authorizationNumber; + } + + public Date getValidityTime() { + return validityTime; + } + + public void setValidityTime(Date validityTime) { + this.validityTime = validityTime; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getIsUploadImage() { + return isUploadImage; + } + + public void setIsUploadImage(String isUploadImage) { + this.isUploadImage = isUploadImage; + } + + @ManyToOne + @JoinColumn(name = "relevancyGoodsAuthorization_id") + public RelevancyGoodsAuthorization getRelevancyGoodsAuthorization() { + return relevancyGoodsAuthorization; + } + + public void setRelevancyGoodsAuthorization(RelevancyGoodsAuthorization relevancyGoodsAuthorization) { + this.relevancyGoodsAuthorization = relevancyGoodsAuthorization; + } + +} Index: ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/action/ExpensiveGoodsAuthorizationAction.java =================================================================== diff -u -r21904 -r21990 --- ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/action/ExpensiveGoodsAuthorizationAction.java (.../ExpensiveGoodsAuthorizationAction.java) (revision 21904) +++ ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/action/ExpensiveGoodsAuthorizationAction.java (.../ExpensiveGoodsAuthorizationAction.java) (revision 21990) @@ -1,40 +1,40 @@ package com.forgon.disinfectsystem.expensiveGoods.action; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; +import java.io.OutputStream; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import net.sf.json.JSONObject; -import net.sf.json.JsonConfig; -import net.sf.json.util.CycleDetectionStrategy; -import net.sf.json.util.PropertyFilter; import org.apache.commons.lang.StringUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; -import com.forgon.directory.acegi.tools.AcegiHelper; -import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoods; +import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile; +import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; import com.forgon.disinfectsystem.entity.expensivegoods.ExpensiveGoodsAuthorization; -import com.forgon.disinfectsystem.entity.satisfactionsurvey.SatisfactionSurveyTemplateItem; +import com.forgon.disinfectsystem.entity.expensivegoods.RelevancyGoodsAuthorization; import com.forgon.disinfectsystem.expensiveGoods.service.ExpensiveGoodsAuthorizationManager; import com.forgon.disinfectsystem.expensiveGoods.service.ExpensiveGoodsManager; import com.forgon.entity.PageEntity; -import com.forgon.log.model.Log; -import com.forgon.log.service.LogManager; -import com.forgon.tools.GB2Alpha; -import com.forgon.tools.GB2WB; -import com.forgon.tools.SpringBeanManger; +import com.forgon.tools.FileSystemHelper; +import com.forgon.tools.ImageUtils; import com.forgon.tools.StrutsParamUtils; import com.forgon.tools.StrutsResponseUtils; import com.forgon.tools.db.DatabaseUtil; -import com.forgon.tools.json.JsonPropertyFilter; +import com.forgon.tools.hibernate.ObjectDao; import com.forgon.tools.util.PageUtil; import com.opensymphony.xwork2.ModelDriven; import com.opensymphony.xwork2.Preparable; @@ -55,8 +55,14 @@ private ExpensiveGoodsManager expensiveGoodsManager; + private RelevancyGoodsAuthorization relevancyGoodsAuthorization; + private ExpensiveGoodsAuthorizationManager expensiveGoodsAuthorizationManager; + private SupplyRoomConfigManager supplyRoomConfigManager; + + private ObjectDao objectDao; + private String spell; private Map resultMap = new HashMap(); @@ -78,17 +84,42 @@ this.expensiveGoodsManager = expensiveGoodsManager; } - @Override + public void setExpensiveGoodsAuthorization( + ExpensiveGoodsAuthorization expensiveGoodsAuthorization) { + this.expensiveGoodsAuthorization = expensiveGoodsAuthorization; + } + + public RelevancyGoodsAuthorization getRelevancyGoodsAuthorization() { + return relevancyGoodsAuthorization; + } + + public void setRelevancyGoodsAuthorization( + RelevancyGoodsAuthorization relevancyGoodsAuthorization) { + this.relevancyGoodsAuthorization = relevancyGoodsAuthorization; + } + + public void setSupplyRoomConfigManager( + SupplyRoomConfigManager supplyRoomConfigManager) { + this.supplyRoomConfigManager = supplyRoomConfigManager; + } + + public void setObjectDao(ObjectDao objectDao) { + this.objectDao = objectDao; + } + + public ExpensiveGoodsAuthorization getExpensiveGoodsAuthorization() { + return expensiveGoodsAuthorization; + } + public ExpensiveGoodsAuthorization getModel() { return expensiveGoodsAuthorization; } - @Override public void prepare() throws Exception { - if(expensiveGoodsAuthorization != null && DatabaseUtil.isPoIdValid(expensiveGoodsAuthorization.getId())){ - expensiveGoodsAuthorization = - expensiveGoodsAuthorizationManager.get(expensiveGoodsAuthorization.getId()); - }else{ + String id = StrutsParamUtils.getPraramValue("id", ""); + if (StringUtils.isNotBlank(id) && !id.equals("0")) { + expensiveGoodsAuthorization = expensiveGoodsAuthorizationManager.getExpensiveGoodsAuthorizationById(id); + } else { expensiveGoodsAuthorization = new ExpensiveGoodsAuthorization(); } } @@ -118,15 +149,16 @@ JSONObject result = new JSONObject(); result.put("success", true); try{ - String authorizedCompanyId = StrutsParamUtils.getPraramValue("authorizedCompanyId", ""); + String authorizedCompanyId = StrutsParamUtils.getPraramValue("authorizedCompanyId", ""); String authorizerCompanyId = StrutsParamUtils.getPraramValue("authorizerCompanyId", ""); + String authorizationCertificationResult = StrutsParamUtils.getPraramValue("authorizationCertificationResult", ""); //授权证集合 if(StringUtils.isNotBlank(authorizedCompanyId)){ expensiveGoodsAuthorization.setAuthorizedCompanyId(Long.parseLong(authorizedCompanyId)); } if(StringUtils.isNotBlank(authorizerCompanyId)){ expensiveGoodsAuthorization.setAuthorizerCompanyId(Long.parseLong(authorizerCompanyId)); } - String expensiveGoodsName = StrutsParamUtils.getPraramValue("expensiveGoodsName", ""); + String expensiveGoodsNames = StrutsParamUtils.getPraramValue("expensiveGoodsName", ""); String expensiveGoodsIds = StrutsParamUtils.getPraramValue("expensiveGoodsIds", ""); if (StringUtils.isNotBlank(StrutsParamUtils.getPraramValue("validityTime", null))) { SimpleDateFormat dateFormat = new SimpleDateFormat( @@ -135,7 +167,7 @@ .parse(StrutsParamUtils.getPraramValue("validityTime", null))); } - expensiveGoodsAuthorizationManager.saveOrUpdaExpensiveGoodsAuthorization(expensiveGoodsAuthorization,expensiveGoodsName,expensiveGoodsIds); + expensiveGoodsAuthorizationManager.saveOrUpdaExpensiveGoodsAuthorization(expensiveGoodsAuthorization,expensiveGoodsNames,expensiveGoodsIds,authorizationCertificationResult); }catch(Exception e){ e.printStackTrace(); result.put("success", false); @@ -181,4 +213,97 @@ e.printStackTrace(); } } + + + /** + * 获取授权上传图片总数 + */ + public void getAuthorizationUploadPicTotalPage() { + int count = 0; + if(expensiveGoodsAuthorization.getRelevancyGoodsAuthorization() != null){ + count = expensiveGoodsAuthorization.getRelevancyGoodsAuthorization().getImagesCount(objectDao); + } + HttpServletResponse httpServletResponse = StrutsParamUtils + .getResponse(); + httpServletResponse.setCharacterEncoding("UTF-8"); + try { + httpServletResponse.getWriter().print(count); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 授权图片 + */ + public void getAuthorization() { + String page = StrutsParamUtils.getPraramValue("page", "1"); + byte[] img = null; + long imageId = 0; + ImageFile picture = null; + SupplyRoomConfig systemParamsObj = supplyRoomConfigManager + .getSystemParamsObj(); + String saveImagePath = systemParamsObj.getSaveImagePath(); + if (StringUtils.isNumeric(page) && expensiveGoodsAuthorization.getRelevancyGoodsAuthorization() != null && DatabaseUtil.isPoIdValid(expensiveGoodsAuthorization.getRelevancyGoodsAuthorization().getId())) { + int index = Integer.parseInt(page); + int count = expensiveGoodsAuthorization.getRelevancyGoodsAuthorization().getImagesCount(objectDao); + if (index <= count) { + picture = expensiveGoodsAuthorization.getRelevancyGoodsAuthorization().getImageAt(objectDao, index - 1); + imageId = picture.getId(); + if (picture.getImage() != null) { + img = picture.getImage(); + } else { + img = new byte[4096 * 1024]; + + String thumbnailImagePath = picture.getThumbnailImagePath(); + String uuidImageName = picture.getUUIDAndImageName(); + String Directory = saveImagePath + thumbnailImagePath + + "\\" + uuidImageName; + FileInputStream fis = null; + try { + fis = new FileInputStream(new File(Directory)); + fis.read(img); + } catch (FileNotFoundException e) { + img = FileSystemHelper.readBlankImageBytes(StrutsParamUtils + .getServletContext().getRealPath("/")); + } catch (IOException e) { + img = FileSystemHelper.readBlankImageBytes(StrutsParamUtils + .getServletContext().getRealPath("/")); + } + finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + } + } + OutputStream outputStream = null; + img = ImageUtils.defaultIfEmpty(img); + try { + HttpServletResponse response = StrutsParamUtils.getResponse(); + response.setContentType("image/jpeg"); + outputStream = response.getOutputStream(); + outputStream.write(img, 0, img.length); + + HttpSession session = StrutsParamUtils.getRequest().getSession(); + session.setAttribute("delImageID", "" + imageId); + } catch (IOException e) { + e.printStackTrace(); + } + finally { + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } } Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsAuthorizationView.jsp =================================================================== diff -u -r21862 -r21990 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsAuthorizationView.jsp (.../expensiveGoodsAuthorizationView.jsp) (revision 21862) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsAuthorizationView.jsp (.../expensiveGoodsAuthorizationView.jsp) (revision 21990) @@ -3,6 +3,7 @@ <%@ page import="com.forgon.disinfectsystem.entity.customform.formdefinition.FormDefinitionItem" %> <%@ page import="com.forgon.disinfectsystem.entity.qualitymonitoringmanager.qualitymonitoringconfig.QualityMonitoringDefinition" %> <%@ page import="com.forgon.disinfectsystem.entity.customform.formdefinition.FormDefinition" %> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile"%> <%@ page contentType="text/html; charset=UTF-8"%> <%@ include file="/common/taglibs.jsp"%> @@ -11,12 +12,18 @@ 高值耗材授权管理 <%@ include file="/common/includeExtJsAndCss.jsp"%> + + + + + + <% LoginUserData userData = AcegiHelper.getLoginUser(); String userName = userData.getUserFullName(); @@ -50,6 +57,8 @@ var action_deploy = '<%=FormDefinition.ACTION_DEPLOY%>'; var madeCompany = '<%=ExpensiveGoodsSupplier.SUPPLIER_TYPE_MADECOMPANY%>';//生产厂家 var expensivegoodssupplier = '<%=ExpensiveGoodsSupplier.SUPPLIER_TYPE_EXPENSIVEGOODSSUPPLIER%>';//高值耗材供应商 + var imageTypeAuthorized = '<%=ImageFile.IMAGE_TYPE_AUTHORIZEDSUPPLIER%>';//授权高值耗材供应商图片 + var imageTypeTousse = '<%=ImageFile.IMAGE_TYPE_AUTHORIZEDSUPPLIER%>'; //用于删除授权类型的图片 Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/RelevancyGoodsAuthorization.java =================================================================== diff -u -r21862 -r21990 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/RelevancyGoodsAuthorization.java (.../RelevancyGoodsAuthorization.java) (revision 21862) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoods/RelevancyGoodsAuthorization.java (.../RelevancyGoodsAuthorization.java) (revision 21990) @@ -15,12 +15,17 @@ import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; +import javax.persistence.Transient; +import org.hibernate.Query; +import org.hibernate.Session; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.RegistrationCertification; +import com.forgon.tools.hibernate.ObjectDao; /** * @author LiuLiBen 2018年1月6日 下午2:11:15 @@ -40,7 +45,7 @@ */ private Long id; /** - * 一次性物品定义的id(多个物品时Id用逗号分开) + * 高值耗材物品定义的id(多个物品时Id用逗号分开) */ private String expensiveGoodsIds = ""; @@ -55,6 +60,12 @@ @JsonIgnore private List expensiveGoodsAuthorization = new ArrayList(); + /** + * 包含的授权证 + */ + @JsonIgnore + private List authorizationCertificationList = new ArrayList(); + @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { @@ -90,5 +101,44 @@ List expensiveGoodsAuthorization) { this.expensiveGoodsAuthorization = expensiveGoodsAuthorization; } + + @OneToMany(mappedBy = "relevancyGoodsAuthorization", fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) + public List getAuthorizationCertificationList() { + return authorizationCertificationList; + } + + public void setAuthorizationCertificationList( + List authorizationCertificationList) { + this.authorizationCertificationList = authorizationCertificationList; + } + /** + * 查询某授权记录上传的图片的数量 + * @param objectDao + * @return + */ + @Transient + public int getImagesCount(ObjectDao objectDao) { + String sql = " where po.imageType='" + ImageFile.IMAGE_TYPE_AUTHORIZEDSUPPLIER + + "' and po.objectId in (select id from "+ AuthorizationCertification.class.getSimpleName() +" where relevancyGoodsAuthorization.id=" + id +")" ; + int count = objectDao.countObjectBySql(ImageFile.class.getSimpleName(), sql); + return count; + } + + /** + * 查询某授权记录上传的图片 + * @param objectDao + * @param index + * @return + */ + public ImageFile getImageAt(ObjectDao objectDao, int index) { + Session session = objectDao.getHibernateSession(); + Query query = session.createQuery("from ImageFile where objectId in (select id from "+ AuthorizationCertification.class.getSimpleName() +" where relevancyGoodsAuthorization.id=" + id + ") and imageType= '"+ ImageFile.IMAGE_TYPE_AUTHORIZEDSUPPLIER +"'order by serialNum asc"); +// query.setLong("id", id); + query.setMaxResults(1); //最大一条数据 + query.setFirstResult(index); //根据页数找第几张图片 + ImageFile image = (ImageFile)query.uniqueResult(); + return image; + } + } Index: ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsAuthorizationManagerImpl.java =================================================================== diff -u -r21907 -r21990 --- ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsAuthorizationManagerImpl.java (.../ExpensiveGoodsAuthorizationManagerImpl.java) (revision 21907) +++ ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsAuthorizationManagerImpl.java (.../ExpensiveGoodsAuthorizationManagerImpl.java) (revision 21990) @@ -1,5 +1,8 @@ package com.forgon.disinfectsystem.expensiveGoods.service; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -12,6 +15,8 @@ import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoods; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.RegistrationCertification; +import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; +import com.forgon.disinfectsystem.entity.expensivegoods.AuthorizationCertification; import com.forgon.disinfectsystem.entity.expensivegoods.ExpensiveGoodsAuthorization; import com.forgon.disinfectsystem.entity.expensivegoods.RelevancyGoodsAuthorization; import com.forgon.disinfectsystem.entity.satisfactionsurvey.SatisfactionSurveyTemplate; @@ -68,9 +73,9 @@ } @Override - public void saveOrUpdaExpensiveGoodsAuthorization(ExpensiveGoodsAuthorization expensiveGoodsAuthorization,String expensiveGoodsName,String expensiveGoodsIds){ + public void saveOrUpdaExpensiveGoodsAuthorization(ExpensiveGoodsAuthorization expensiveGoodsAuthorization,String expensiveGoodsNames,String expensiveGoodsIds,String authorizationCertificationResult){ String[] strs = expensiveGoodsIds.split(";"); - String[] names = expensiveGoodsName.split(";"); + String[] names = expensiveGoodsNames.split(";"); for(int i=0,len=strs.length;i egaz = objectDao.findBySql(ExpensiveGoodsAuthorization.class.getSimpleName(), sql2); @@ -144,26 +149,91 @@ ExpensiveGoodsAuthorization eg = (ExpensiveGoodsAuthorization) objectDao.getByID_ForUpdate(ExpensiveGoodsAuthorization.class.getSimpleName(), expensiveGoodsAuthorization.getId()); if(eg != null && eg.getRelevancyGoodsAuthorization() != null){ relevancyGoodsAuthorization = eg.getRelevancyGoodsAuthorization(); - relevancyGoodsAuthorization.setExpensiveGoodsIds(expensiveGoodsIds); - relevancyGoodsAuthorization.setExpensiveGoodsName(expensiveGoodsName); - relevancyGoodsAuthorization.setExpensiveGoodsAuthorization(expensiveGoodsManager.getExpensiveGoodsAuthorization(expensiveGoodsAuthorization, relevancyGoodsAuthorization, expensiveGoodsIds,expensiveGoodsName)); - objectDao.saveOrUpdate(relevancyGoodsAuthorization); + saveOrUpdateRelevancyGoodsAuthorization(relevancyGoodsAuthorization,expensiveGoodsAuthorization,expensiveGoodsNames,expensiveGoodsIds,authorizationCertificationResult); }else{ relevancyGoodsAuthorization = new RelevancyGoodsAuthorization(); - relevancyGoodsAuthorization.setExpensiveGoodsIds(expensiveGoodsIds); - relevancyGoodsAuthorization.setExpensiveGoodsName(expensiveGoodsName); - relevancyGoodsAuthorization.setExpensiveGoodsAuthorization(expensiveGoodsManager.getExpensiveGoodsAuthorization(expensiveGoodsAuthorization, relevancyGoodsAuthorization, expensiveGoodsIds,expensiveGoodsName)); - objectDao.saveOrUpdate(relevancyGoodsAuthorization); + saveOrUpdateRelevancyGoodsAuthorization(relevancyGoodsAuthorization,expensiveGoodsAuthorization,expensiveGoodsNames,expensiveGoodsIds,authorizationCertificationResult); } }else{ relevancyGoodsAuthorization = new RelevancyGoodsAuthorization(); - relevancyGoodsAuthorization.setExpensiveGoodsIds(expensiveGoodsIds); - relevancyGoodsAuthorization.setExpensiveGoodsName(expensiveGoodsName); - relevancyGoodsAuthorization.setExpensiveGoodsAuthorization(expensiveGoodsManager.getExpensiveGoodsAuthorization(expensiveGoodsAuthorization, relevancyGoodsAuthorization, expensiveGoodsIds,expensiveGoodsName)); - objectDao.saveOrUpdate(relevancyGoodsAuthorization); + saveOrUpdateRelevancyGoodsAuthorization(relevancyGoodsAuthorization,expensiveGoodsAuthorization,expensiveGoodsNames,expensiveGoodsIds,authorizationCertificationResult); } } + /** + * 保存关联授权表 + * @param relevancyGoodsAuthorization 关联表 + * @param expensiveGoodsAuthorization 授权明细表 + * @param expensiveGoodsName 前台传的高值耗材名称集合 + * @param expensiveGoodsIds 前台传的高值耗材Id集合 + * @param authorizationCertificationResult 授权证集合 + */ + public void saveOrUpdateRelevancyGoodsAuthorization(RelevancyGoodsAuthorization relevancyGoodsAuthorization,ExpensiveGoodsAuthorization expensiveGoodsAuthorization, + String expensiveGoodsName,String expensiveGoodsIds,String authorizationCertificationResult){ + relevancyGoodsAuthorization.setExpensiveGoodsIds(expensiveGoodsIds); + relevancyGoodsAuthorization.setExpensiveGoodsName(expensiveGoodsName); + relevancyGoodsAuthorization.setExpensiveGoodsAuthorization(expensiveGoodsManager.getExpensiveGoodsAuthorization(expensiveGoodsAuthorization, relevancyGoodsAuthorization, expensiveGoodsIds,expensiveGoodsName)); + relevancyGoodsAuthorization.setAuthorizationCertificationList(getAuthorizationCertificationList(authorizationCertificationResult,expensiveGoodsAuthorization,relevancyGoodsAuthorization)); + objectDao.saveOrUpdate(relevancyGoodsAuthorization); + } + /** + * 保存授权表 + * @param authorizationCertificationResult 授权证集合 + * @param expensiveGoodsAuthorization 授权明细表 + * @return + */ + public List getAuthorizationCertificationList(String authorizationCertificationResult,ExpensiveGoodsAuthorization expensiveGoodsAuthorization,RelevancyGoodsAuthorization relevancyGoodsAuthorization){ + if (authorizationCertificationResult.startsWith("\"")){ + authorizationCertificationResult = authorizationCertificationResult.substring(1,authorizationCertificationResult.length() - 1); + authorizationCertificationResult = authorizationCertificationResult.replace("\\\\", "\\"); + authorizationCertificationResult = authorizationCertificationResult.replace("\\\"", "\""); + } + List aCertificates = new ArrayList(); + List authorizationCertifications = new ArrayList(); + if(DatabaseUtil.isPoIdValid(expensiveGoodsAuthorization.getId())){ + ExpensiveGoodsAuthorization authorization = getById(expensiveGoodsAuthorization.getId().toString()); + authorizationCertifications = authorization.getRelevancyGoodsAuthorization().getAuthorizationCertificationList(); + } + JSONArray jsonArray = JSONArray.fromObject(authorizationCertificationResult); + List list = new ArrayList(); //判断前台有没有进行删除授权证设的List集合 + String id = null ; + Date date = null ; //初始化date + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject obj = jsonArray.getJSONObject(i); + String certification = obj.optString("certification"); + String validityTime = obj.optString("validityTime"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String type = obj.optString("type"); + //失效期转换成date类型 + try { + date = sdf.parse(validityTime); + } catch (Exception e) { + e.printStackTrace(); + } + id = obj.optString("id"); + list.add(Long.parseLong(id)); + AuthorizationCertification authorizationCertification; + if(Long.parseLong(id) == 0){ //为0是新添加的授权证件 + authorizationCertification = new AuthorizationCertification(); + }else{ + authorizationCertification = (AuthorizationCertification) objectDao.getByProperty(AuthorizationCertification.class + .getSimpleName(), "id", Long.valueOf(id)); + } + authorizationCertification.setAuthorizationNumber(certification); //授权证号 + authorizationCertification.setValidityTime(date); //失效期 + authorizationCertification.setType(type); //证件类型 + authorizationCertification.setRelevancyGoodsAuthorization(relevancyGoodsAuthorization); + objectDao.saveOrUpdate(authorizationCertification); + aCertificates.add(authorizationCertification); + } + for(AuthorizationCertification authorizationCertification : authorizationCertifications){ + //原有的授权证和JS传过来的值比较少了就执行删除操作 + if(!list.contains(authorizationCertification.getId()) && Long.parseLong(id) != 0 ){ + objectDao.deleteById(AuthorizationCertification.class.getSimpleName(), authorizationCertification.getId().toString());; + } + } + return aCertificates; + } @Override public ExpensiveGoodsAuthorization getExpensiveGoodsAuthorization( ExpensiveGoodsAuthorization expensiveGoodsAuthorization) { @@ -205,10 +275,30 @@ obj.put("expensiveGoodsNames", expensiveGoodsName); obj.put("expensiveGoodsIds", ega.getRelevancyGoodsAuthorization().getExpensiveGoodsIds()); + //获取授权证记录返回前台 + List authorizationCertificationList = new ArrayList(); + for(AuthorizationCertification acl : ega.getRelevancyGoodsAuthorization().getAuthorizationCertificationList()){ + AuthorizationCertification authorizationCertification = new AuthorizationCertification(); + authorizationCertification.setId(acl.getId()); + authorizationCertification.setAuthorizationNumber(acl.getAuthorizationNumber()); + authorizationCertification.setValidityTime(acl.getValidityTime()); + authorizationCertification.setType(acl.getType()); + authorizationCertificationList.add(authorizationCertification); + } + JSONArray authorizationCertifications =JSONArray.fromObject(authorizationCertificationList); JSONObject result = new JSONObject(); result.put("success", true); result.put("data", obj); + result.put("authorizationCertificationList", authorizationCertifications); return result; } + @Override + public ExpensiveGoodsAuthorization getExpensiveGoodsAuthorizationById( + String id) { + return (ExpensiveGoodsAuthorization) objectDao.getByProperty( + ExpensiveGoodsAuthorization.class.getSimpleName(), "id", + Long.valueOf(id)); + } + } Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsAuthorizationForm.js =================================================================== diff -u -r21906 -r21990 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsAuthorizationForm.js (.../expensiveGoodsAuthorizationForm.js) (revision 21906) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsAuthorizationForm.js (.../expensiveGoodsAuthorizationForm.js) (revision 21990) @@ -1,4 +1,4 @@ - +var registrationPanel; function addExpensiveGoodsAuthorization(id,ishidden,isclear){ var supplierStore = new top.Ext.data.Store({ pageSize : 100, @@ -15,6 +15,29 @@ ]) }); + configStore = new top.Ext.data.Store({ + }); + + var registrationCertificateConfig = Ext.data.Record.create([ + {name : 'id'}, + {name : 'certification'}, + {name : 'certificationTime'}, + {name : 'type'} + ]); + + function newRow(){ + var n = top.Ext.getCmp('configGrid').getStore().getCount();// 获得总行数 + var p = new registrationCertificateConfig({ + id : 0, + certification : '', + certificationTime : '', + type : '授权证' + }); + top.Ext.getCmp('configGrid').stopEditing();// 停止编辑 + configStore.add(p);// 插入到最后一行 + top.Ext.getCmp('configGrid').startEditing(n, 0);// 开始编辑0单元格 + } + var expensiveGoodsSupplierStore = new top.Ext.data.Store({ pageSize : 100, proxy : new top.Ext.data.HttpProxy({ @@ -30,142 +53,397 @@ ]) }); + var registrationCm = new top.Ext.grid.ColumnModel([{ + id : 'certification', + header : "证件号", + dataIndex : 'certification', + width : 70 , + editor : new top.Ext.form.NumberField({ + allowBlank : false, + minValue:1, + listeners : { + change : function(numberField, newValue, oldValue) { + var rowIndex = top.Ext.getCmp('configGrid').getStore().getCount();//grid的行数 + var configStore = top.Ext.getCmp('configGrid').getStore(); + var judge = []; + for(var i =0 ;i < rowIndex ; i++ ){ + var electRecord = configStore.getAt(i); + var a = configStore.getAt(i).data.certification; + if(judge.contains(newValue)){ + showResult('已包含授权证:'+ newValue +',不可重复添加!'); + judge.splice(0,judge.length); //数组清空 + numberField.setValue(oldValue); + return false; + }else{ + judge.push(electRecord.get('certification')); + } + } + } + } + }) + }, { + id : 'certificationTime', + header : "失效期", + width : 80, + dataIndex : 'certificationTime', + renderer: function(v,p,record){ + v = v||{}; + if(v.format){ + return v.format('Y-m-d'); + }else if(v.year && v.month && v.date){ + return (v.year + 1900) + "-" + (v.month+1) + "-" + v.date; + } + return ""; + }, + editor : new top.Ext.form.DateExtensiableField( { + readOnly : false, + minWidth:177, + altFormats : 'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + format : 'Y-m-d', + editable : false, + allowBlank : false + }) + }, { + id:'type', + header:"类别", + width : 10, + dataIndex:'type', + editor : new top.Ext.form.ComboBox({ + xtype : 'combo', + valueField : 'type', + displayField : 'type', + store : new Ext.data.SimpleStore({ + data:[['授权证']], + fields:['type'] + }), + mode : 'local', + forceSelection : true, + editable : false, + triggerAction : 'all', + listeners : { + specialKey : function(field,event){ + if(event.getKey()==13 ){ + if(isLastRow){//是最后一行,新增空白行 + newRow(); + } + } + } + } + }) + }, { + id:'operation', + header:"操作", + width : 70, + dataIndex:'operation', + hidden:id == 0?true:false, + renderer: function(v,p,record){ + var str = " "; + return str; + } + }]); + + registrationPanel = new top.Ext.grid.EditorGridPanel({ + id : 'configGrid', + name : 'configGrid', + store : configStore, + cm : registrationCm, + height:280, + frame : false, + bodyStyle : 'border:1px solid #afd7af', + autoExpandColumn : 'count', + viewConfig: {forceFit:true}, + clicksToEdit : 1,//设置点击几次才可编辑 + selModel : new top.Ext.grid.RowSelectionModel({ + singleSelect : false + }), + tbar : [{ + text : '新增授权证件', + width : 70 , + iconCls : 'btn_ext_add', + handler : function() { + if(sstsConfig.enableExpensiveGoods){ //高值耗材启用并且厂商类型为生产厂家商才可以添加注册证 + newRow(); + }else{ + showResult("高值耗材未启用不能添加授权证件!"); + } + } + }, { + text : '删除授权证件', + iconCls : 'btn_remove', + handler : function() { + var rows = top.Ext.getCmp('configGrid').getSelectionModel().getSelections();// 返回值为 Record 数组 + if (rows.length == 0) { + showResult('最少选择一条信息,进行删除!'); + } else { + top.Ext.MessageBox.confirm('提示框', '您确定要进行该操作?', function(btn) { + if (btn == 'yes') { + if (rows) { + for ( var i = 0; i < rows.length; i++) { + configStore.remove(rows[i]); + } + } + } + }); + } + } + }], + listeners: { + beforeedit: function(obj){ + eventEdit = obj; + }, + afteredit:function(grid){ + eventEdit = null; + } + } + }); + + var page = 1; + var totalPage = 0; + var toolbarPage = new top.Ext.Toolbar.TextItem({ + text : '第1页' + }); + var toolbarTotalPage = new top.Ext.Toolbar.TextItem({ + text : '共0页' + }); + + + + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/expensiveGoods/expensiveGoodsAuthorizationAction!getAuthorizationUploadPicTotalPage.do', + params : { + id : id + }, + success : function(result){ + var pageStr = result.responseText; + totalPage = parseInt(pageStr); + var element = top.Ext.get(toolbarTotalPage.el); + element.update('共' + totalPage + '页'); + }, + failure : function(){ + + } + }); + + var imagePanel = new top.Ext.Panel({ + id : 'imagePanel', + layout : 'fit', + height : 270, + items : [{ + xtype : 'box', + id : 'browseImage', + fieldLabel : "预览图片", + autoEl : { + id : 'imageBrowse', + tag : 'img', + autoHeight:true, + src : Ext.BLANK_IMAGE_URL, + style : 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);', + complete : 'off' + } + }] + }); + + var browseImage = imagePanel.findById('browseImage'); + var url = WWWROOT + '/disinfectSystem/expensiveGoods/expensiveGoodsAuthorizationAction!getAuthorization.do?id=' + id + '&page=' + page +'&time='+new Date();; + browseImage.autoEl.src=url; + + var showCertificateImage = new top.Ext.Panel({ + items : [{ + xtype : 'panel', + id : 'pageToolbar', + bbar : ['->',{ + xtype : 'button', + text : '<<', + tooltip :"上一页", + handler : function(){ + if (page - 1 <= 0) { + showResult('已是第一页'); + return; + } + page = page - 1; + var url = WWWROOT + '//disinfectSystem/expensiveGoods/expensiveGoodsAuthorizationAction!getAuthorization.do?id=' + id + '&page=' + page +'&time='+new Date();; + var imageBrowse = top.Ext.get('imageBrowse'); + var image = imageBrowse.dom; + image.src = url;// 覆盖原来的图片 + var element = top.Ext.get(toolbarPage.el); + element.update('第' + page + '页'); + } + }, + toolbarPage, + toolbarTotalPage,{ + xtype : 'button', + text : '>>', + tooltip :"下一页", + handler : function() { + if (page + 1 > totalPage) { + showResult('已是最后一页'); + return; + } + page = page + 1; + var url = WWWROOT + '//disinfectSystem/expensiveGoods/expensiveGoodsAuthorizationAction!getAuthorization.do?id=' + id + '&page=' + page +'&time='+new Date(); + var imageBrowse = top.Ext.get('imageBrowse'); + var image = imageBrowse.dom; + image.src = url;// 覆盖原来的图片 + var element = top.Ext.get(toolbarPage.el); + element.update('第' + page + '页'); + } + }] + },imagePanel] + }); var form = new top.Ext.FormPanel( { id : 'statisfactionSurveyForm', frame : true, border : 0, + labelAlign:'right', labelSeparator : ':', bodyStyle : 'padding:5px 5px 0px 5px', - width : 200, - labelAlign:'right', - autoScroll:true, + labelWidth : 100, + autoHeight : true, + autoScroll : true, items : [{ layout:'column', items:[{ - layout : 'column', + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'expensiveGoodsIds', + id : 'expensiveGoodsIds' + },{ + xtype : 'hidden', + name : 'printData', + id : 'printData' + },{ + xtype : 'hidden', + name : 'authorizerCompanyId', + id : 'authorizerCompanyId' + },{ + xtype : 'hidden', + name : 'authorizerCompanyId', + id : 'authorizerCompanyId' + },{ + xtype : 'hidden', + name : 'treeItemData', + id : 'treeItemData' + },{ + columnWidth : 0.85, + layout : 'form', + labelWidth : 80, items : [{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'expensiveGoodsIds', - id : 'expensiveGoodsIds' - },{ - xtype : 'hidden', - name : 'printData', - id : 'printData' - },{ - xtype : 'hidden', - name : 'authorizerCompanyId', - id : 'authorizerCompanyId' - },{ - xtype : 'hidden', - name : 'authorizerCompanyId', - id : 'authorizerCompanyId' - },{ - xtype : 'hidden', - name : 'treeItemData', - id : 'treeItemData' - },{ - columnWidth : 0.85, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textfield', - fieldLabel : '高值耗材', - id : 'expensiveGoodsName', - name : 'expensiveGoodsName', - allowBlank : false, - readOnly:true, - anchor : '98%' - }] - },{ - columnWidth : 0.15, - layout : 'form', - items : [{ - xtype : 'button', - text : '选择高值耗材', - listeners:{ - click : function(){ - var departNames = top.Ext.getCmp('expensiveGoodsName').getValue(); - var departcodes = top.Ext.getCmp('expensiveGoodsIds').getValue(); - openSelectReceiverOrganization(departNames,departcodes); - } - } - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'combo', - id : 'authorizerCompanyName', - name : 'authorizerCompanyName', - fieldLabel : '授权代理商', - queryParam : 'supplierName', - minChars : 0, - valueField : 'id', - displayField : 'name', - width : 350, - pageSize : 100, - listConfig: {width: 300}, - store : supplierStore, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - allowBlank : false, - emptyText : '', - typeAhead : false, - anchor : '97%', - listeners : { + xtype : 'textfield', + fieldLabel : '高值耗材', + id : 'expensiveGoodsName', + name : 'expensiveGoodsName', + allowBlank : false, + readOnly:true, + width : 400, + anchor : '98%' + }] + },{ + columnWidth : 0.15, + labelWidth : 80, + layout : 'form', + items : [{ + xtype : 'button', + text : '选择高值耗材', + width : 400, + listeners:{ + click : function(){ + var departNames = top.Ext.getCmp('expensiveGoodsName').getValue(); + var departcodes = top.Ext.getCmp('expensiveGoodsIds').getValue(); + openSelectReceiverOrganization(departNames,departcodes); } - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'combo', - id : 'authorizedCompanyName', - name : 'authorizedCompanyName', - fieldLabel : '被授权代理商', - queryParam : 'supplierName', - minChars : 0, - valueField : 'id', - displayField : 'name', - width : 350, - pageSize : 100, - listConfig: {width: 300}, - store : expensiveGoodsSupplierStore, - lazyInit : true, - allowBlank : false, - triggerAction : 'all', - hideTrigger : true, - emptyText : '', - typeAhead : false, - anchor : '97%', - listeners : { - } - }] - },{ - columnWidth : 0.5, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '授权失效日期', - id : 'validityTime', - name : 'validityTime', - readOnly : true, - allowBlank : false, - format : 'Y-m-d H:i', - anchor : '95%' - }] + } }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 80, + items : [{ + xtype : 'combo', + id : 'authorizerCompanyName', + name : 'authorizerCompanyName', + fieldLabel : '授权代理商', + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + width : 400, + pageSize : 100, + listConfig: {width: 300}, + store : supplierStore, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + allowBlank : false, + emptyText : '', + typeAhead : false, + anchor : '97%', + listeners : { + } + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 80, + items : [{ + xtype : 'combo', + id : 'authorizedCompanyName', + name : 'authorizedCompanyName', + fieldLabel : '被授权代理商', + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + width : 400, + pageSize : 100, + listConfig: {width: 300}, + store : expensiveGoodsSupplierStore, + lazyInit : true, + allowBlank : false, + triggerAction : 'all', + hideTrigger : true, + emptyText : '', + typeAhead : false, + anchor : '97%', + listeners : { + } + }] + },{ + columnWidth : 0.6, + layout : 'form', + labelWidth : 80, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '授权失效日期', + id : 'validityTime', + name : 'validityTime', + width : 400, + readOnly : true, + allowBlank : false, + format : 'Y-m-d H:i', + anchor : '97%' + }] + }, { + layout : 'form', + columnWidth : 0.5, + labelWidth : 70, + items : [ + registrationPanel + ] + }, { + layout : 'form', + columnWidth : 0.5, + bodyStyle : 'border:1px solid #afd7af', + height:280, + labelWidth : 60, + items : [ + showCertificateImage + ] }] - }], + }], buttonAlign :'center', buttons : [{ text : '保存', @@ -183,6 +461,30 @@ showResult('所选耗材太多,请重新选择!'); return false; } + if(sstsConfig.enableExpensiveGoods){ //高值耗材启用才验证 + var certificationCount = configStore.getCount(); + if (certificationCount <= 0 ){ + showResult('证不能为空!'); + this.enable(); + return false; + } + + for(var i = 0 ;i < certificationCount;i++){ + var certification = top.Ext.getCmp('configGrid').getView().getCell(i,0).firstChild.innerText; + if(certification == '' || certification == null || certification == ' '){ + showResult('请填写证号!'); + this.enable(); + return false; + } + + var validityTime = top.Ext.getCmp('configGrid').getView().getCell(i,1).firstChild.innerText; + if(validityTime == '' || validityTime == null || validityTime == ' '){ + showResult("请填写失效日期!"); + this.enable(); + return false; + } + } + } submitForm(form,wwindow,this); } },{ @@ -200,13 +502,13 @@ width : 720, // width : 650, // height : 600, - height : 200, + height : 450, border : false, plain : true, modal :true, items : [{ region:'center', - width : 200, + width : 400, layout :'fit', items:[form] }] @@ -218,15 +520,28 @@ method : 'POST', waitMsg : '正在加载数据,请稍候', success : function(form, action) { - top.Ext.getCmp('validityTime').setValue(Ext.util.Format.date(new Date(action.result.data.validityTime.time),'Y-m-d H:i')); - top.Ext.getCmp('id').setValue(action.result.data.id); - top.Ext.getCmp('authorizedCompanyName').setValue(action.result.data.authorizedCompanyId); - top.Ext.getCmp('authorizedCompanyName').setRawValue(action.result.data.authorizedCompanyName); - top.Ext.getCmp('authorizerCompanyName').setValue(action.result.data.authorizerCompanyId); - top.Ext.getCmp('authorizerCompanyName').setRawValue(action.result.data.authorizerCompanyName); - top.Ext.getCmp('expensiveGoodsName').setValue(action.result.data.expensiveGoodsNames); - top.Ext.getCmp('expensiveGoodsIds').setValue(action.result.data.expensiveGoodsIds); + top.Ext.getCmp('validityTime').setValue(Ext.util.Format.date(new Date(action.result.data.validityTime.time),'Y-m-d H:i')); + top.Ext.getCmp('id').setValue(action.result.data.id); + top.Ext.getCmp('authorizedCompanyName').setValue(action.result.data.authorizedCompanyId); + top.Ext.getCmp('authorizedCompanyName').setRawValue(action.result.data.authorizedCompanyName); + top.Ext.getCmp('authorizerCompanyName').setValue(action.result.data.authorizerCompanyId); + top.Ext.getCmp('authorizerCompanyName').setRawValue(action.result.data.authorizerCompanyName); + top.Ext.getCmp('expensiveGoodsName').setValue(action.result.data.expensiveGoodsNames); + top.Ext.getCmp('expensiveGoodsIds').setValue(action.result.data.expensiveGoodsIds); var result = Ext.decode(action.response.responseText); + + //初始化授权记录包含的授权证件 + for(var i = 0 ;i < action.result.authorizationCertificationList.length;i++){ + var authorizationCertification = action.result.authorizationCertificationList[i]; + var authorizationCertifications = new registrationCertificateConfig({ + id : authorizationCertification.id, + certification : authorizationCertification.authorizationNumber, + certificationTime :new Date(authorizationCertification.validityTime.time), + type : authorizationCertification.type + }); + configStore.add(authorizationCertifications); + } + var formDefinition_id = result.data['formDefinition_id']; customForm.getCustomFormData(formDefinition_id); }, @@ -249,6 +564,32 @@ } +//图片上下操作 +function moveUp2(id){ + ImageFileTableManager.moveUpImageFile(id, function(){ + toussePackingTearchingStore.reload(); + }); +} +function moveDown2(id){ + ImageFileTableManager.moveDownImageFile(id, function(){ + toussePackingTearchingStore.reload(); + }); +} + +function loadImag() { + var rows = top.Ext.getCmp('configGrid').getSelectionModel().getSelections();// 返回值为所点击的行 + var configStore = top.Ext.getCmp('configGrid').getStore(); + if (rows) { + for ( var i = 0; i < rows.length; i++) { + var index = configStore.indexOf(rows[i]); //获取本行数据下标 + var record = configStore.getAt(index); //用本行数据下标获取点击行的证件信息 + var id = record.data.id; //获取证ID + var type = record.data.type; //获取证件类型 + uploadToussePackingImageFile(imageTypeAuthorized,id); //类型为高值耗材供应商证授权图片 + } + } +} + function openSelectReceiverOrganization(departNames,departCodes){ var param = null; var temp; @@ -360,11 +701,30 @@ function submitForm(form,wwindow,btnSave){ var authorizerCompanyId = top.Ext.getCmp('authorizerCompanyName').getValue(); var authorizedCompanyId = top.Ext.getCmp('authorizedCompanyName').getValue(); + //供应商相关授权证信息 + var authorizationCertifications = []; + var configStore = top.Ext.getCmp('configGrid').getStore(); + var rowIndex = top.Ext.getCmp('configGrid').getStore().getCount();//grid的行数 + for(var i =0 ;i < rowIndex ; i++ ){ + var record = configStore.getAt(i); + var id = configStore.getAt(i).data.id; + var certification = record.get('certification'); + var validityTime = record.data.certificationTime.format('Y-m-d'); + var type = record.get('type'); + var authorizationCertification = { + id : id, + certification: certification, + validityTime: validityTime, + type: type + } + authorizationCertifications.push(authorizationCertification); + } + form.form.submit({ url : WWWROOT + '/disinfectSystem/expensiveGoods/expensiveGoodsAuthorizationAction!saveExpensiveGoodsAuthorization.do?time=' + new Date(), method : 'POST', waitMsg : '正在保存数据,请稍候', - params : {authorizerCompanyId : authorizerCompanyId , authorizedCompanyId : authorizedCompanyId}, + params : {authorizerCompanyId : authorizerCompanyId , authorizedCompanyId : authorizedCompanyId , authorizationCertificationResult : JSON.stringify(authorizationCertifications)}, waitTitle : '提交表单', success : function(form, action) { showResult('保存成功'); Index: ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsAuthorizationManager.java =================================================================== diff -u -r21904 -r21990 --- ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsAuthorizationManager.java (.../ExpensiveGoodsAuthorizationManager.java) (revision 21904) +++ ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsAuthorizationManager.java (.../ExpensiveGoodsAuthorizationManager.java) (revision 21990) @@ -2,6 +2,7 @@ import net.sf.json.JSONObject; +import com.forgon.disinfectsystem.entity.basedatamanager.supplier.ExpensiveGoodsSupplier; import com.forgon.disinfectsystem.entity.expensivegoods.ExpensiveGoodsAuthorization; import com.forgon.tools.hibernate.BasePoManager; @@ -16,12 +17,15 @@ /** * 保存或修改高值耗材授权 - * @param expensiveGoodsAuthorization + * @param expensiveGoodsAuthorization 授权明细表 + * @param authorizationCertificationResult 授权证集合 + * @param expensiveGoodsIds 高值耗材Id集合 + * @param expensiveGoodsNames 高值耗材名称集合 */ - public void saveOrUpdaExpensiveGoodsAuthorization(ExpensiveGoodsAuthorization expensiveGoodsAuthorization,String expensiveGoodsName ,String expensiveGoodsIds); + public void saveOrUpdaExpensiveGoodsAuthorization(ExpensiveGoodsAuthorization expensiveGoodsAuthorization,String expensiveGoodsNames ,String expensiveGoodsIds, String authorizationCertificationResult); /** - * 根据授权Id查询对应授权记录 + * 根据授权对象查询对应授权记录 */ public ExpensiveGoodsAuthorization getExpensiveGoodsAuthorization(ExpensiveGoodsAuthorization expensiveGoodsAuthorization); @@ -34,4 +38,11 @@ * 获取授权记录 */ public JSONObject getExpensiveGoodsAuthorizationMap(ExpensiveGoodsAuthorization expensiveGoodsAuthorization); + + /** + * 根据授权记录Id查询出对应的记录 + * @param id + * @return + */ + public ExpensiveGoodsAuthorization getExpensiveGoodsAuthorizationById(String id); } Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/supplier/ExpensiveGoodsSupplier.java =================================================================== diff -u -r21650 -r21990 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/supplier/ExpensiveGoodsSupplier.java (.../ExpensiveGoodsSupplier.java) (revision 21650) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/supplier/ExpensiveGoodsSupplier.java (.../ExpensiveGoodsSupplier.java) (revision 21990) @@ -1,6 +1,7 @@ package com.forgon.disinfectsystem.entity.basedatamanager.supplier; import java.util.ArrayList; +import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -81,6 +82,56 @@ private String externalCode; /** + * 经营许可证号码 + */ + private String businessCertificate; + + /** + * 经营许可证有效期 + */ + private Date businessValidityTime; + + /** + * 经营许可证类别 + */ + private String businessType; + + /** + * 生产许可证号码 + */ + private String productionCertificate; + + /** + * 生产许可证有效期 + */ + private Date productionValidityTime; + + /** + * 生产许可证类别 + */ + private String productionType; + + /** + * 营业执照号码 + */ + private String businessLicense; + + /** + * 营业执照有效期 + */ + private Date licenseValidityTime; + + /** + * 营业证类别 + */ + private String licenseType; + + /** + * 是否已上传图片 + */ + public String isUploadImage; + + /** * 租用器械包-----公司类型(生产厂家或者高值耗材供应商) */ private String rentTousse = ExpensiveGoodsSupplier.SUPPLIER_TYPE_MADECOMPANY; @@ -204,6 +255,86 @@ this.externalCode = externalCode; } + public String getBusinessCertificate() { + return businessCertificate; + } + + public void setBusinessCertificate(String businessCertificate) { + this.businessCertificate = businessCertificate; + } + + public Date getBusinessValidityTime() { + return businessValidityTime; + } + + public void setBusinessValidityTime(Date businessValidityTime) { + this.businessValidityTime = businessValidityTime; + } + + public String getBusinessType() { + return businessType; + } + + public void setBusinessType(String businessType) { + this.businessType = businessType; + } + + public String getProductionCertificate() { + return productionCertificate; + } + + public void setProductionCertificate(String productionCertificate) { + this.productionCertificate = productionCertificate; + } + + public Date getProductionValidityTime() { + return productionValidityTime; + } + + public void setProductionValidityTime(Date productionValidityTime) { + this.productionValidityTime = productionValidityTime; + } + + public String getProductionType() { + return productionType; + } + + public void setProductionType(String productionType) { + this.productionType = productionType; + } + + public String getBusinessLicense() { + return businessLicense; + } + + public void setBusinessLicense(String businessLicense) { + this.businessLicense = businessLicense; + } + + public Date getLicenseValidityTime() { + return licenseValidityTime; + } + + public void setLicenseValidityTime(Date licenseValidityTime) { + this.licenseValidityTime = licenseValidityTime; + } + + public String getLicenseType() { + return licenseType; + } + + public void setLicenseType(String licenseType) { + this.licenseType = licenseType; + } + + public String getIsUploadImage() { + return isUploadImage; + } + + public void setIsUploadImage(String isUploadImage) { + this.isUploadImage = isUploadImage; + } + @OneToMany(mappedBy = "expensiveGoodsSupplier", fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) public List getRegistrationCertificate() { return registrationCertificate; @@ -214,28 +345,30 @@ this.registrationCertificate = registrationCertificate; } + /** - * 查询某供应商下所有注册证上传的图片的数量 + * 查询某供应商下所有注册证和其他证件上传的图片的数量 * @param objectDao * @return */ @Transient public int getImagesCount(ObjectDao objectDao) { String sql = " where po.imageType='" + ImageFile.IMAGE_TYPE_CERTIFICATION + - "' and po.objectId in (select id from "+ RegistrationCertification.class.getSimpleName() +" where expensiveGoodsSupplier.id=" + id + ")"; + "' and po.objectId in (select id from "+ RegistrationCertification.class.getSimpleName() +" where expensiveGoodsSupplier.id=" + id + + ") or po.objectId =" + id; int count = objectDao.countObjectBySql(ImageFile.class.getSimpleName(), sql); return count; } /** - * 查询某供应商下所有注册证上传的图片 + * 查询某供应商下所有注册证和其他证件上传的图片 * @param objectDao * @param index * @return */ public ImageFile getImageAt(ObjectDao objectDao, int index) { Session session = objectDao.getHibernateSession(); - Query query = session.createQuery("from ImageFile where objectId in (select id from "+ RegistrationCertification.class.getSimpleName() +" where expensiveGoodsSupplier.id=" + id + ") and imageType='注册证图片' order by serialNum asc"); + Query query = session.createQuery("from ImageFile where objectId in (select id from "+ RegistrationCertification.class.getSimpleName() +" where expensiveGoodsSupplier.id=" + id + ") or objectId =" + id + " order by serialNum asc"); // query.setLong("id", id); query.setMaxResults(1); //最大一条数据 query.setFirstResult(index); //根据页数找第几张图片