Index: ssts-web/src/main/webapp/homepage/menuconfigure.js =================================================================== diff -u -r16824 -r16856 --- ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 16824) +++ ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 16856) @@ -356,7 +356,8 @@ {hidden :SSTS_ForeignTousse_Recyc_Menu,text:"外来器械包管理",href:WWWROOT+'/disinfectsystem/basedatamanager/tousse/foreignTousseView.jsp?editMode=true',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_TousseInstanceManager_ViewMenu,text:"器械包信息",href:WWWROOT+'/disinfectsystem/toussemanager/tousseinstancemanager/tousseInstanceView.jsp',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_TousseInstanceManager_ViewMenu,text:"器械包库存",href:WWWROOT+'/disinfectsystem/toussemanager/toussegoodsstock/tousseGoodsStockView.jsp',hrefTarget:linkTarget,leaf:true}, - {hidden :(!sstsConfig.hasOwnProperty('disabeleTousseMaintain')) || sstsConfig.disabeleTousseMaintain,text:"器械包保养",href:WWWROOT+'/disinfectsystem/toussemanager/toussemaintain/tousseMaintainView.jsp',hrefTarget:linkTarget,leaf:true} + {hidden :(!sstsConfig.hasOwnProperty('disabeleTousseMaintain')) || sstsConfig.disabeleTousseMaintain,text:"器械包保养",href:WWWROOT+'/disinfectsystem/toussemanager/toussemaintain/tousseMaintainView.jsp',hrefTarget:linkTarget,leaf:true}, + {hidden :SSTS_ComboTousseManager,text:"聚合包定义管理",href:WWWROOT+'/disinfectsystem/basedatamanager/tousse/comboTousse.jsp?editMode=true',hrefTarget:linkTarget,leaf:true} ] },{ text:"干预管理", Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/ComboTousseComposite.java =================================================================== diff -u -r16806 -r16856 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/ComboTousseComposite.java (.../ComboTousseComposite.java) (revision 16806) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/ComboTousseComposite.java (.../ComboTousseComposite.java) (revision 16856) @@ -40,6 +40,11 @@ */ private Long tousseDefinitionId; + /** + * 序列,用来保存聚合包下的器械包顺序 + */ + private Integer sequence; + @Id @GeneratedValue(strategy=GenerationType.AUTO) public Long getId() { @@ -65,5 +70,12 @@ public void setTousseDefinitionId(Long tousseDefinitionId) { this.tousseDefinitionId = tousseDefinitionId; } - + + public Integer getSequence() { + return sequence; + } + + public void setSequence(Integer sequence) { + this.sequence = sequence; + } } Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousse.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousse.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousse.js (revision 16856) @@ -0,0 +1,318 @@ +var entityName = "器械包管理"; +var grid; +var toussePackingTearchingStore; + +function moveUp2(id) { + ImageFileTableManager.moveUpImageFile(id, function () { + toussePackingTearchingStore.reload(); + }); +} +function moveDown2(id) { + ImageFileTableManager.moveDownImageFile(id, function () { + toussePackingTearchingStore.reload(); + }); +} + +function updateVideoUploadStatus(videoType, objectId) { + TousseDefinitionTableManager.updateVideoUploadStatus(objectId, videoType); +} + +// 删除 +function deleteTousse(grid) { + + var records = grid.getSelectionModel().getSelections(); + + if (records.length == 0) { + showResult("请选择要删除的器械包!"); + return false; + } + var ids = null; + for (var i = 0, len = records.length; i < len; i++) { + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + } + top.Ext.MessageBox.confirm("请确认", "是否确定要删除选中的器械包信息?", + function (button, text) { + if ("yes" == button) + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!deleteTousseDefinition.do', + params: {ids: ids}, + success: function (response, options) { + var result = Ext.decode(response.responseText); + var success = result.success; + if (true != success) { + showResult(result.cause); + return; + } else { + showResult('删除成功'); + grid.dwrReload(); + } + }, + failure: function (response, options) { + var result = Ext.decode(response.responseText); + showResult(result.cause); + } + }); + }); + +} + +function printTousseDefinitionMaterial(ids) { + TousseDefinitionTableManager.getTousseDefinition(ids, function (jsonStr) { + var result = JSON.parse(jsonStr); + if (result.success) { + var tousses = result.tousseDefinitions; + if (tousses != null && tousses.length > 0) { + top.Ext.Msg.show({ + title: '输入打印份数', + msg: '打印份数:', + width: 100, + buttons: Ext.MessageBox.OKCANCEL, + prompt: true, + fn: function (bu, txt) { + if (bu == 'ok') { + if (isNaN(txt) == false) { + Ext.MessageBox.progress('打印中', '请稍候...'); + var curNumber = 0; + var count = Number(txt) * tousses.length; + for (var j = 0; j < Number(txt); j++) { + for (var i = 0; i < tousses.length; i++) { + var toussedef = tousses[i]; + ++curNumber; + Ext.MessageBox.updateProgress((curNumber) / count, '第' + (curNumber) + '个,共' + count + '个'); + printTousseDefinitionMaterialsInTousseView(toussedef, 0); + } + } + hideMessageBox(false); + } else { + showResult("打印份数必须是数字,请重新输入!"); + } + } + }, + animEl: 'addAddressBtn', + value: '1' + }); + } + } + }); +} + +var refresh = function () { + grid.dwrReload(); + grid.store.reload(); +}; + +var loadFormData = function (grid) { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要修改的器械包!"); + return false; + } + if (records.length > 1) { + showResult("一次只能修改一个器械包!"); + return false; + } + id = records[0].data['id']; + var type = records[0].data['tousseType']; + if (type == PACKAGE_TYPE_FOREIGN) { + addAndEditForeignTousseDefinition(id); + } else if (type == PACKAGE_TYPE_CUSTOM) { + addAndEditCustomTousse(null, id, "00", refresh); + } else { + addAndEditTousse(id, records[0].data['isUploadVideo']); + } + +}; + +/** + * 修改记录 + * modifyRecord函数 触发modify函数调用,并传入当前列的值以及record.data对象 + * 页面中需要定义 modify(v,data) 函数 + */ +function modify(v, data) { + loadFormData(grid); +} + +function str_no(v, data) { + if (v == "否") { + return "

" + v + "

"; + } else { + return v; + } +} + +function isDisable(v, data) { + if (v == "是") { + return "

" + v + "

"; + } else { + return v; + } +} + +Ext.onReady(function () { + Ext.QuickTips.init(); + // 记录cookie(3步) + $Id('parm_s_onlyShowDisable').value = onlyShowDisable; + var columns = [ + {header: "器械包名称", width: 180, dataIndex: 'name', renderer: modifyRecord}, + {header: "器械包类别", width: 90, dataIndex: 'tousseType'}, + { + header: "装配类型", + width: 100, + dataIndex: 'packageType', + hidden: !sstsConfig.showTaskGroupAndPackageTypeAndSterilingMethod + }, + { + header: "灭菌程序", + width: 80, + dataIndex: 'sterilingMethod', + hidden: !sstsConfig.showTaskGroupAndPackageTypeAndSterilingMethod + }, + { + header: "所属任务组", + width: 100, + dataIndex: 'taskGroup', + hidden: !sstsConfig.showTaskGroupAndPackageTypeAndSterilingMethod + }, + {header: "价格(元)", width: 65, dataIndex: 'price'}, + {header: "借出单价(元/天)", width: 100, dataIndex: 'borrowPrice'}, + {header: "大小", width: 60, dataIndex: 'packageSize'}, + {header: "外部编码", width: 60, dataIndex: 'externalCode'}, + {header: "已上传图片", width: 80, dataIndex: 'isUploadImage', renderer: str_no}, + {header: "已上传视频", width: 80, dataIndex: 'isUploadVideo', renderer: str_no}, + {header: "是否回收", width: 80, dataIndex: 'isRecycling', renderer: str_no}, + {header: "是否装配", width: 80, dataIndex: 'isPacking', renderer: str_no}, + {header: "是否打印", width: 80, dataIndex: 'isPrint', renderer: str_no}, + {header: "是否追溯", width: 80, dataIndex: 'isTraceable', renderer: str_no}, + {header: "是否审核", width: 80, dataIndex: 'isReview', renderer: str_no}, + {header: "是否停用", width: 80, dataIndex: 'isDisable', renderer: isDisable}, + {header: "拼音码", width: 80, dataIndex: 'spelling'}, + {id: 'wbCode', header: "五笔码", width: 80, dataIndex: 'wbCode'} + ]; + + var readerDetail = [ + {name: 'id'}, + {name: 'name'}, + {name: 'tousseType'}, + {name: 'packageType'}, + {name: 'sterilingMethod'}, + {name: 'taskGroup'}, + {name: 'price'}, + {name: 'isPacking'}, + {name: 'isRecycling'}, + {name: 'isPrint'}, + {name: 'isTraceable'}, + {name: 'isReview'}, + {name: 'borrowPrice'}, + {name: 'packageSize'}, + {name: 'externalCode'}, + {name: 'isUploadImage'}, + {name: 'isUploadVideo'}, + {name: 'spelling'}, + {name: 'isDisable'}, + {name: 'wbCode'} + ]; + + var filters = new Ext.grid.GridFilters({ + filters: [ + {type: 'string', dataIndex: 'name'}, + {type: 'string', dataIndex: 'tousseType'}, + {type: 'string', dataIndex: 'isUploadImage'}, + {type: 'numeric', dataIndex: 'price'}, + {type: 'string', dataIndex: 'size'}, + {type: 'string', dataIndex: 'spelling'}, + {type: 'string', dataIndex: 'wbCode'}, + {type: 'string', dataIndex: 'isPacking'}, + {type: 'string', dataIndex: 'isRecycling'}, + {type: 'string', dataIndex: 'isPrint'}, + {type: 'string', dataIndex: 'isTraceable'}, + {type: 'string', dataIndex: 'isReview'}, + {type: 'numeric', dataIndex: 'borrowPrice'}, + {type: 'string', dataIndex: 'packageSize'} + ] + }); + + + var sign = true; + var tbar = [{ + text: '添加', + hidden: SSTS_ComboTousse_add, + iconCls: 'btn_ext_application_add', + handler: function () { + addAndEditTousse(0, '否'); + } + }, '-', { + text: '添加外来器械包', + hidden: true, + iconCls: 'btn_ext_add_foreignTousse', + handler: function () { + addAndEditForeignTousseDefinition(0); + } + }, '-', { + text: '修改', + hidden: SSTS_ComboTousse_update, + iconCls: 'btn_ext_application_edit', + id: 'editTbar', + handler: function () { + loadFormData(grid); + } + }, '-', { + text: '删除', + hidden: SSTS_ComboTousse_delete, + iconCls: 'btn_ext_application_del', + handler: function () { + deleteTousse(grid); + } + }/*,'-'*/, { + text: '打印器械包明细单', + hidden: SSTS_ComboTousse_delete, + iconCls: 'icon_print', + handler: function () { + var rows = grid.getSelectionModel().getSelections(); + if (rows.length == 0) { + showResult('请选择需要打印的器械包!'); + return; + } + var ids = []; + for (var i = 0; i < rows.length; ++i) { + ids.push(rows[i].get("id")); + } + printTousseDefinitionMaterial(ids.join(';')); + } + }]; + var dwrCallParams = null; + + Ext.ux.ForgonPageGrid.prototype.getGridParameterMap = function () { + }; + + grid = new Ext.ux.ForgonPageGrid({ + title: '器械包列表', + tbar: tbar, + pageSize: 20, + defaultSortField: 'id', + defaultSortDirection: 'ASC', + isCheckboxSelectionModel: true, + rememberSelected: false, + isShowSearchField: true, + columns: columns, + plugins: filters, + autoExpandColumn: 'wbCode', + searchDisableIndexes: ['isUploadImage', 'isUploadVideo'], + renderTo: 'gridDiv', + frame: false + }, readerDetail, TousseDefinitionTableManager.findTousseDefinitionTableList, dwrCallParams // 这个参数只是占位作用 + ); + + var viewport = new Ext.Viewport({ + layout: 'border', + items: [{ + region: 'center', + margins: '0 0 0 0', + layout: 'fit', + items: grid + }] + }); +}); \ No newline at end of file Index: ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml =================================================================== diff -u -r16820 -r16856 --- ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 16820) +++ ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 16856) @@ -176,6 +176,8 @@ + + Index: forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDao.java =================================================================== diff -u -r16654 -r16856 --- forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDao.java (.../ObjectDao.java) (revision 16654) +++ forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDao.java (.../ObjectDao.java) (revision 16856) @@ -3,6 +3,7 @@ import java.sql.ResultSet; import java.util.Collection; import java.util.List; +import java.util.Map; import org.hibernate.Session; import org.hibernate.SessionFactory; @@ -165,4 +166,22 @@ * @return */ public List getCollection_ForUpdate(String objectPOName,String propertyName,Collection values); + + + /** + * 使用预编译的本地sql查询 + * @param sql 要查询的sql + * @param condition 预编译的条件(list类型) + * @return + */ + List> findSqlByParam(String sql, List condition); + + /** + * 使用预编译的本地sql查询 + * @param sql 要查询的sql + * @param condition 预编译的条件(数组类型) + * @return + */ + List> findSqlByParam(String sql, Object[] condition); + } Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/comboTousse/service/ComboTousseManagerImpl.java =================================================================== diff -u --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/comboTousse/service/ComboTousseManagerImpl.java (revision 0) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/comboTousse/service/ComboTousseManagerImpl.java (revision 16856) @@ -0,0 +1,184 @@ +package com.forgon.disinfectsystem.tousse.comboTousse.service; + +import com.beust.jcommander.ParameterException; +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.ComboTousseComposite; +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; +import com.forgon.tools.hibernate.ObjectDao; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.springframework.orm.hibernate4.HibernateTemplate; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * @author zhonghaowen + * @apiNote + * @since 2017-01-18 + */ +public class ComboTousseManagerImpl implements ComboTousseManager { + + protected Logger logger = Logger.getLogger(this.getClass()); + + private ObjectDao objectDao; + + public void setObjectDao(ObjectDao objectDao) { + this.objectDao = objectDao; + } + + @Override + public void saveOrUpdate(ComboTousseComposite comboTousseComposite) { + objectDao.saveOrUpdate(comboTousseComposite); + } + + @Override + public List> getComboTousseMsg(TousseDefinition tousseDefinition) { + try { + if (tousseDefinition == null) { + throw new ParameterException("器械包定义不能为空!"); + } + String sql = "select td.id as tousseDefinitionId,td.name as tousseDefinitionName,ctc.id as id from TousseDefinition td join ComboTousseComposite ctc on td.id = ctc.tousseDefinitionId" + + " where ctc.comboTousseDefinitionId = ? order by ctc.sequence "; + return objectDao.findSqlByParam(sql, new Object[]{tousseDefinition.getId()}); + } + catch (Exception e) { + logger.error(e); + throw new RuntimeException(e); + } + } + + @Override + public List> getTousse(String spell) { + try { + StringBuilder builder = new StringBuilder(); + builder.append(" select td.id as tousseDefinitionId,td.name as tousseDefinitionName from TousseDefinition td where td.tousseType <> ? "); + builder.append(" and not exists (select ctc.id from ComboTousseComposite ctc where td.id = ctc.comboTousseDefinitionId)"); + List condition = new LinkedList<>(); + condition.add("聚合包"); + if (StringUtils.isNotBlank(spell)) { + builder.append(" and (td.spelling like ? or td.wbCode like ? or td.externalCode like ? or td.name like ?)"); + for (int i = 0; i < 4; i++) { + condition.add("%" + spell + "%"); + } + } + return objectDao.findSqlByParam(builder.toString(), condition); + } + catch (Exception e) { + logger.error(e); + throw new RuntimeException(e); + } + } + + /** + * 另存为新的聚合包 + * + * @param comboTousseComposites 要保存的聚合包信息 + * @param tousseDefinition {@link TousseDefinition} + */ + private void saveOrUpdateNewComboTousses(List comboTousseComposites, TousseDefinition tousseDefinition) { + List list = new LinkedList<>(); + for (ComboTousseComposite comboTousseComposite : comboTousseComposites) { + ComboTousseComposite combo = new ComboTousseComposite(); + combo.setComboTousseDefinitionId(tousseDefinition.getId()); + combo.setTousseDefinitionId(comboTousseComposite.getTousseDefinitionId()); + combo.setSequence(comboTousseComposite.getSequence()); + list.add(combo); + } + objectDao.batchSaveOrUpdate(list); + } + + @Override + @Transactional(propagation = Propagation.REQUIRED) + public void saveOrUpdateComboTousses(String comboTousseArray, TousseDefinition tousseDefinition, boolean newTousse) { + try { + if (StringUtils.isBlank(comboTousseArray)) return; + logger.debug(comboTousseArray); + List comboTousseComposites = (List) JSONArray.toCollection(JSONArray.fromObject(comboTousseArray), ComboTousseComposite.class); + //如果是另存为新的聚合包 + if (newTousse == true) { + this.saveOrUpdateNewComboTousses(comboTousseComposites, tousseDefinition); + return; + } + Long id = tousseDefinition.getId(); + List lists = this.getCtcByCtdId(id); + List addList = new LinkedList<>(); + List updateList = new LinkedList<>(); + List deleteList = new LinkedList<>(); + for (ComboTousseComposite composite : comboTousseComposites) { + //如果id是空的,则表示需要新增 + if (composite.getId() == null) { + composite.setComboTousseDefinitionId(id); + addList.add(composite); + continue; + } + updateList.add(composite); + } + for (ComboTousseComposite list : lists) { + boolean updateFlag = false; + for (ComboTousseComposite update : updateList) { + //如果id一样,则表示要更新 + if (list.getId().equals(update.getId())) { + list.setTousseDefinitionId(update.getTousseDefinitionId()); + list.setSequence(update.getSequence()); + updateFlag = true; + break; + } + } + //如果没有进行过更新操作,则添加的要删除的列表里 + if (!updateFlag) deleteList.add(list); + } + this.handleAdd(addList); + this.handleDelete(deleteList); + } + catch (Exception e) { + logger.error(e); + throw new RuntimeException(e); + } + } + + /** + * 处理要添加 + * + * @param addList 要添加的列表 + */ + private void handleAdd(List addList) { + for (ComboTousseComposite comboTousseComposite : addList) { + objectDao.saveOrUpdate(comboTousseComposite); + } + + } + + /** + * 处理要删除的 + * + * @param deleteList 要删除的列表 + */ + private void handleDelete(List deleteList) { + for (ComboTousseComposite comboTousseComposite : deleteList) { + objectDao.delete(comboTousseComposite); + } + } + + + /** + * 根据comboTousseDefinitionId来查找聚合包下的器械包信息 + * + * @param id comboTousseDefinitionId + * @return + */ + private List getCtcByCtdId(Long id) { + String hql = " from ComboTousseComposite ctc where ctc.comboTousseDefinitionId = ? "; + Query query = objectDao.getHibernateSession().createQuery(hql); + query.setParameter(0, id); + return query.list(); + } + +} Index: ssts-web/src/main/resources/systemset/operationDefine.xml =================================================================== diff -u -r16823 -r16856 --- ssts-web/src/main/resources/systemset/operationDefine.xml (.../operationDefine.xml) (revision 16823) +++ ssts-web/src/main/resources/systemset/operationDefine.xml (.../operationDefine.xml) (revision 16856) @@ -232,6 +232,10 @@ + + + + Index: ssts-web/src/main/webapp/homepage/menu.jsp =================================================================== diff -u -r16820 -r16856 --- ssts-web/src/main/webapp/homepage/menu.jsp (.../menu.jsp) (revision 16820) +++ ssts-web/src/main/webapp/homepage/menu.jsp (.../menu.jsp) (revision 16856) @@ -1036,7 +1036,12 @@ SSTS_GoodFilter = false; +var SSTS_ComboTousseManager = true; + +SSTS_ComboTousseManager = false; + + var SSTS_BaseData_Manager = SSTS_ImportBaseData&&SSTS_QualityItem &&SSTS_SerialNumber && SSTS_SupplyRoomType&&SSTS_Expiration && SSTS_Sterilizer && SSTS_Sterilisation &&SSTS_Rinser && SSTS_CleanMethod&&SSTS_Supplier &&SSTS_TaskGroup && SSTS_DiposableGoodsType && SSTS_PackType&& SSTS_ProjectName && SSTS_Operation && SSTS_Container &&SSTS_Material; Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/comboTousse/service/ComboTousseManager.java =================================================================== diff -u --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/comboTousse/service/ComboTousseManager.java (revision 0) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/comboTousse/service/ComboTousseManager.java (revision 16856) @@ -0,0 +1,37 @@ +package com.forgon.disinfectsystem.tousse.comboTousse.service; + +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.ComboTousseComposite; +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; +import net.sf.json.JSONArray; + +import java.util.List; +import java.util.Map; + +/** + * @author zhonghaowen + * @apiNote + * @since 2017-01-18 + */ +public interface ComboTousseManager { + + void saveOrUpdate(ComboTousseComposite comboTousseComposite); + + /** + * 获取聚合包下的器械包相关信息 + * + * @param tousseDefinition {@link TousseDefinition} + * @return + */ + List> getComboTousseMsg(TousseDefinition tousseDefinition); + + /** + * 获取下拉选择框的器械包信息(不包含聚合包) + * + * @param spell 拼音或者五笔或者外部编码 + * @return + */ + List> getTousse(String spell); + + void saveOrUpdateComboTousses(String comboTousseArray, TousseDefinition tousseDefinition, boolean newTousse); + +} Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousseForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousseForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousseForm.js (revision 16856) @@ -0,0 +1,1196 @@ +var id; +var formObj; +var tousseWin; +var eventEdit = null; +var configStore; +var materialsPanel; +var materialConfig; +//器械包修改缓存,用于保存修改聚合包下的器械包用 +var modifyRecord; +//定义首篮筐的label变量 +var beginBarcodeLabel = '扫描条码:'; +var hiddenEndBarcode = true;//隐藏尾篮筐 +var useRecordOperationRoomAllowBlank = false; + +if (sstsConfig.disableLoadToVirtualBasket == false) { + beginBarcodeLabel = '条码/篮筐(首):'; + hiddenEndBarcode = false;//显示尾篮筐 +} + +//大小属性的下拉选项 +var packageSizeArray = [['超大包'], ['大包'], ['中包'], ['小包']]; +if (sstsConfig.pageSizeArrayConfig && sstsConfig.pageSizeArrayConfig.length > 0) { + packageSizeArray = sstsConfig.pageSizeArrayConfig; +} +//默认的大小选项 +var defaultPackageSize = '大包'; +if (sstsConfig.defaultPackageSize) { + defaultPackageSize = sstsConfig.defaultPackageSize; +} + +var isLastRow = false;//记录当前编辑的行是否是最后一行 +//删除视频 +function deleteVideo(id, uuid_vedioNames) { + top.Ext.MessageBox.confirm("请确认", "是否确定要删除配包教学视频?", + function (button, text) { + if ("yes" == button) { + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/videoFileAction!deleteVideo.do', + params: { + videoName: uuid_vedioNames, + objectId: id + }, + success: function (result) { + var resultObj = Ext.decode(result.responseText); + if (resultObj != null && resultObj.success) { + if (resultObj.msg == "") { + showResult("删除成功!"); + top.Ext.getCmp('uuid_vedioNames').setValue(); + top.Ext.getCmp('vedioNamesForDisplay').setValue(); + top.Ext.getCmp('videoPanel').hide(); + top.Ext.getCmp('watchPanel').hide(); + top.Ext.getCmp('downloadPanel').hide(); + top.Ext.getCmp('deletePanel').hide(); + top.Ext.getCmp('uploadVedio').show(); + + updateVideoUploadStatus(videoType, id); + grid.dwrReload(); + + } else { + if (resultObj.msg == "fileNotFound") { + showResult("文件不存在,请确认文件是否已被删除!"); + } else if (resultObj.msg == "deleteFail") { + showResult("文件删除失败,请手动删除或稍后再试!"); + } + } + } + grid.dwrReload(); + }, + failure: function () { + + } + }); + } + }); +} +//下载视频 +function downloadVideo(objectId, uuid_vedioNames) { + location.href = WWWROOT + "/disinfectsystem/basedatamanager/tousse/downloadVideo.jsp?objectId=" + id + "&videoName=" + uuid_vedioNames; +} +//观看视频 +function watchVideo(uuid_vedioNames) { + var url = Ext.urlEncode({ + videoName: uuid_vedioNames + }); + var tousseName = top.Ext.getCmp('name').getValue(); + if (tousseName != null && tousseName != "") { + url = Ext.urlEncode({ + videoName: uuid_vedioNames, + tousseName: tousseName + }); + } + + openModalWindow(WWWROOT + "/disinfectsystem/basedatamanager/tousse/watchVideo.jsp?" + url, "观看配包教学视频", "600", "400"); +} +function newRow() { + var n = top.Ext.getCmp('configGrid').getStore().getCount();// 获得总行数 + var p = new materialDefinitionConfig({ + tousseDefinitionId: '', + tousseDefinitionName: '', + id: '' + }); + top.Ext.getCmp('configGrid').stopEditing();// 停止编辑 + configStore.add(p);// 插入到最后一行 + top.Ext.getCmp('configGrid').startEditing(n, 0);// 开始编辑0单元格 +} +function setMaterialSequence() { + var configStore = top.Ext.getCmp('configGrid').getStore(); + for (var i = 0; i < configStore.getCount(); ++i) { + var record = configStore.getAt(i); + record.set('sequence', i + 1); + } +} +function moveTopMaterial() { + 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]); + if (index != 0) { + configStore.remove(rows[i]); + configStore.insert(0, rows[i]); + } + } + } +} + +function moveUpMaterial() { + 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]); + if (index != 0) { + configStore.remove(rows[i]); + configStore.insert(index - 1, rows[i]); + } + } + } +} + +function moveDownMaterial() { + 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 total = configStore.getCount(); + if (index != total - 1) { + configStore.remove(rows[i]); + configStore.insert(index + 1, rows[i]); + } + } + } +} + +function moveBottomMaterial() { + 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 total = configStore.getCount(); + if (index != total - 1) { + configStore.remove(rows[i]); + configStore.insert(total - 1, rows[i]); + } + } + } +} + + +function addAndEditTousse(id, isUploadVideo) { + this.id = id; + tousseDefinitionID = id; + var hasVideo = false; + DWREngine.setAsync(false); + TousseDefinitionTableManager.getUploadVideoCount(id, function (count) { + if (count != 0) { + hasVideo = true; + } + }); + DWREngine.setAsync(true); + var taskGroupJsonStore = new Ext.data.SimpleStore({ + fields: ['taskGroupName'], + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getTaskGroupName.do', + listeners: { + load: function (store, records) { + if (records.length > 0) { + if (top.Ext.getCmp('taskGroup')) { + top.Ext.getCmp('taskGroup').setValue(records[0].data.taskGroupName); + } + } + } + } + }); + var tousseGroupStore = new Ext.data.JsonStore({ + fields: ['tousseGroupName', 'id'], + url: WWWROOT + '/disinfectSystem/baseData/tousseGroupAction!getAllTousseGroup.do', + listeners: { + load: function (store, records) { + if (records.length > 0 && id == 0) { + if (top.Ext.getCmp('tousseGroupName') && top.Ext.getCmp('tousseGroupName').getValue() == '') { + top.Ext.getCmp('tousseGroupName').setValue(records[0].data.id); + } + } + } + } + }); + var barcodePaperTypeStore = new Ext.data.JsonStore({ + fields: ['name'], + url: WWWROOT + '/disinfectSystem/labelTemplateAction!getAllBarcodePaperType.do', + listeners: { + load: function (store, records) { + } + } + }); + + /////////////////////////////////////////图片预览 + var page = 1; + var totalPage = 0; + var toolbarPage = new top.Ext.Toolbar.TextItem({ + text: '第1页' + }); + var toolbarTotalPage = new top.Ext.Toolbar.TextItem({ + text: '共0页' + }); + + 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/baseData/tousseDefinitionAction!getToussePic.do?id=' + id + '&page=' + page + '&time=' + new Date(); + ; + browseImage.autoEl.src = url; + + var showTousseImage = 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/baseData/tousseDefinitionAction!getToussePic.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/baseData/tousseDefinitionAction!getToussePic.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] + }); + + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getTousseUploadPicTotalPage.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 sterilisationStore = new Ext.data.SimpleStore({ + fields: ['id', 'value'], + url: WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getSterilizerType.do', + listeners: { + load: function (store, records) { + if (records.length > 0 && id == 0) { + if (top.Ext.getCmp('sterilingMethod') && top.Ext.getCmp('sterilingMethod').getValue() == '') { + top.Ext.getCmp('sterilingMethod').setValue(records[0].data.taskGroupName); + } + } + } + } + }); + + //清洗程序 + var cleanMethodStore = new Ext.data.SimpleStore({ + fields: ['id', 'cleaningMethod'], + url: WWWROOT + '/disinfectSystem/baseData/cleanMethodAction!findCleanMethodArrClone.do', + listeners: { + load: function (store, records) { + if (records.length > 0 && id == 0) { + if (top.Ext.getCmp('cleanMethod') && top.Ext.getCmp('cleanMethod').getValue() == '') { + top.Ext.getCmp('cleanMethod').setValue(records[0].data.cleaningMethod); + } + } + } + } + }); + + var packTypeStore = new Ext.data.SimpleStore({ + fields: ['typeName'], + url: WWWROOT + '/disinfectSystem/baseData/expirationDateInfoAction!getPackageType.do', + listeners: { + load: function (store, records) { + if (records.length > 0 && id == 0) { + if (top.Ext.getCmp('packageType') && top.Ext.getCmp('packageType').getValue() == '') { + top.Ext.getCmp('packageType').setValue(records[0].data.typeName); + } + } + } + } + }); + + + configStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!loadComboTousseByTousseId.do', + method: 'POST' + }), + reader: new Ext.data.JsonReader({ + root: 'data' + }, [ + {name: 'id', mapping: 'id'}, + {name: 'tousseDefinitionId', mapping: 'tousseDefinitionId'}, + {name: 'tousseDefinitionName', mapping: 'tousseDefinitionName'} + ]) + }); + + var comboTousseCm = new top.Ext.grid.ColumnModel([ + { + id: 'id', + header: "聚合包表主键", + dataIndex: 'id', + width: 140 + }, + { + id: 'tousseDefinitionId', + header: "器械包id", + dataIndex: 'tousseDefinitionId', + width: 140 + }, + { + id: 'tousseDefinitionName', + header: "器械包名称", + dataIndex: 'tousseDefinitionName', + width: 140, + editor: new top.Ext.form.ComboBox({ + xtype: 'combo', + id: 'package1', + name: 'package1', + minChars: 0, + queryParam: 'spell', + valueField: 'tousseDefinitionId', + displayField: 'tousseDefinitionName', + listWidth: 350, + store: new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getTousse.do', + method: 'POST' + }), + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data' + }, [ + {name: 'tousseDefinitionId', mapping: 'tousseDefinitionId'}, + {name: 'tousseDefinitionName', mapping: 'tousseDefinitionName'} + ]) + }), + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + allowBlank: false, + anchor: '97%', + listeners: { + select: function (combo, record, index) { + var result = configStore.find('tousseDefinitionId', record.get('tousseDefinitionId')); + if (result == 0) { + combo.setValue(''); + return false; + } + //先把选中的数据缓存到modifyRecord,然后在afteredit从这个缓存中读取出来,设置对应的器械包id + modifyRecord = record.data; + combo.setValue(record.get('tousseDefinitionName')); + // configStore.set(result, record.get('tousseDefinitionId')); + }, + specialKey: function (field, event) { + if (event.getKey() == 13) { + if (isLastRow) {//是最后一行,新增空白行 + newRow(); + } + } + } + } + }) + }, { + id: 'moveItem', + header: '移动', + width: 100, + renderer: function (v, p, record) { + var str = "" + + "  " + + "  " + + "  "; + return str; + }, + menuDisabled: true, + dataIndex: 'sequence' + }]); + + var materialDefinitionConfig = Ext.data.Record.create([ + {name: 'id'}, + {name: 'tousseDefinitionId'}, + {name: 'tousseDefinitionName'} + ]); + + // materialConfig = Ext.data.Record.create([ + // {name: 'id'}, + // {name: 'count'}, + // {name: 'materileName'}, + // {name: 'name'}, + // {name: 'specification'}, + // {name: 'snumber'} + // + // ]); + + // var groupNumRecord = Ext.data.Record.create([ + // {name: 'groupNum'} + // ]); + + materialsPanel = new top.Ext.grid.EditorGridPanel({ + id: 'configGrid', + name: 'configGrid', + store: configStore, + cm: comboTousseCm, + height: 400, + // width : 358, + frame: false, + bodyStyle: 'border:1px solid #afd7af', + autoExpandColumn: 'count', + viewConfig: {forceFit: true}, + clicksToEdit: 1,//设置点击几次才可编辑 + selModel: new top.Ext.grid.RowSelectionModel({ + singleSelect: false + }), + tbar: [{ + text: '新增器械包', + iconCls: 'btn_ext_add', + handler: function () { + newRow(); + } + }, { + 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]); + } + } + } + }); + } + } + }, { + text: '器械包总件数:', + id: 'materialCount' + }, { + text: '器械包种类:', + id: 'materialType' + }], + listeners: { + beforeedit: function (obj) { + eventEdit = obj; + }, + afteredit: function (e, test) { +// if(isLastRow){//是最后一行,新增空白行 +// newRow(); +// } + configStore.getAt(e.row).set('tousseDefinitionId', modifyRecord['tousseDefinitionId']); + eventEdit = null; + } + } + }); + formObj = new top.Ext.FormPanel({ + id: 'tousseDefinitionForm', + frame: true, + labelSeparator: ':', + labelAlign: 'right', + fileUpload: true, + bodyStyle: 'padding:5px 5px 0px 5px;', + width: 900, + labelWidth: 90, + autoScroll: true, + height: 600, + items: [{ + xtype: 'hidden', + name: 'id', + id: 'id' + }, { + xtype: 'hidden', + name: 'priceHidden', + id: 'priceHidden' + }, { + xtype: 'hidden', + name: 'borrowPriceHidden', + id: 'borrowPriceHidden' + }, { + xtype: 'hidden', + name: 'proxyPriceHidden', + id: 'proxyPriceHidden' + }, { + xtype: 'hidden', + name: 'handlerDepartCode', + id: 'handlerDepartCode' + }, { + xtype: 'hidden', + name: 'uuid_vedioNames', + id: 'uuid_vedioNames' + }, { + xtype: 'hidden', + name: 'tousseGroupID', + id: 'tousseGroupID' + }, { + xtype: 'hidden', + name: 'orginalName', + id: 'orginalName' + }, { + xtype: 'hidden', + name: 'maintainIntervalTimeHidden', + id: 'maintainIntervalTimeHidden' + }, { + xtype: 'hidden', + name: 'maintainIntervalCountHidden', + id: 'maintainIntervalCountHidden' + }, { + layout: 'column', + labelWidth: 90, + items: [{ + columnWidth: 1, + xtype: "fieldset", + title: '聚合包基础数据定义', + bodyStyle: 'padding:1px;', + layout: 'column', + autoHeight: true, + items: [{ + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: "聚合包名称", + allowBlank: false, + blankText: '请输入名称!', + name: "name", + id: "name", + anchor: '100%', + listeners: { + change: function (field, nV, oV) { + var value = nV.trim(); + field.setValue(value); + } + } + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'combo', + fieldLabel: '器械包类型', + //width:180, + listWidth: 200, + id: 'tousseType', + name: 'tousseType', + valueField: 'value', + displayField: 'value', + allowBlank: false, + editable: false, + value: '聚合包', + store: new Ext.data.SimpleStore({ + fields: ['value'], + data: [['聚合包']] + } + ), + forceSelection: true, + mode: 'local', + triggerAction: 'all', + listeners: { + select: function (combo, record, index) { + } + }, + anchor: '100%' + }] + }, + { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'combo', + fieldLabel: '所属科室', + id: 'handlerDepartName', + name: 'handlerDepartName', + queryParam: 'spell', + // editable: false, + valueField: 'departName', + displayField: 'departName', + listWidth: 180, + lazyInit: true, + typeAhead: false, + store: new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getAllOrgUnitName.do', + method: 'POST' + }), + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data' + }, [ + {name: 'departCode', mapping: 'id'}, + {name: 'departName', mapping: 'name'} + ]) + }), + forceSelection: true, + allowBlank: false, + triggerAction: 'all', + anchor: '100%', + listeners: { + select: function (combo, record, index) { + combo.setValue(record.data.departName); + top.Ext.getCmp("handlerDepartCode").setValue(record.data.departCode); + taskGroupJsonStore.baseParams["handlerDepartCode"] = record.data.departCode; + taskGroupJsonStore.load(); + top.Ext.getCmp("taskGroup").enable(); + } + } + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'combo', + fieldLabel: '默认包装类型', + id: 'packageType', + name: 'packageType', + valueField: 'typeName', + displayField: 'typeName', + store: packTypeStore, + forceSelection: true, + editable: false, + triggerAction: 'all', + anchor: '100%', + allowBlank: false + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: "拼音码", + allowBlank: true, + blankText: '请输入拼音简码!', + name: "spelling", + id: "spelling", + anchor: '100%', + readOnly: true + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: "五笔码", + allowBlank: true, + blankText: '请输入五笔简码!', + name: "wbCode", + id: "wbCode", + readOnly: true, + anchor: '100%' + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'combo', + fieldLabel: '默认灭菌程序', + id: 'sterilingMethod', + name: 'sterilingMethod', + valueField: 'value', + displayField: 'value', + editable: false, + store: sterilisationStore, + forceSelection: true, + allowBlank: true, + triggerAction: 'all', + anchor: '100%' + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'combo', + fieldLabel: '标签纸类型', + id: 'barcodePaperType', + name: 'barcodePaperType', + editable: false, + valueField: 'name', + displayField: 'name', + store: barcodePaperTypeStore, + value: '小标签', + allowBlank: false, + forceSelection: true, + triggerAction: 'all', + anchor: '100%' + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'combo', + fieldLabel: '是否审核', + id: 'isReview', + name: 'isReview', + valueField: 'value', + displayField: 'value', + store: new Ext.data.SimpleStore({ + fields: ['value'], + data: [['是'], ['否']] + }), + editable: false, + forceSelection: true, + mode: 'local', + value: '是', + allowBlank: false, + triggerAction: 'all', + anchor: '100%', + listeners: { + select: function (combo, record, index) { + + } + } + }] + }, { + columnWidth: .25, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: "外部编码", + allowBlank: true, + allowNegative: false, + name: 'externalCode', + id: 'externalCode', + anchor: '100%' + }] + }, { + columnWidth: .7, + layout: 'form', + id: 'videoPanel', + hidden: !hasVideo, + items: [{ + xtype: 'textfield', + fieldLabel: "配包视频", + disabled: true, + name: "vedioNamesForDisplay", + id: "vedioNamesForDisplay", +// width:300, + anchor: '100%', + cls: 'fieldReadOnlyNoRemove' + }] + }, { + columnWidth: .1, + layout: 'form', + id: 'watchPanel', + hidden: !hasVideo, + items: [{ + xtype: 'button', + text: "观看视频", + id: "watch", + handler: function () { + var uuid_vedioNames = top.Ext.getCmp('uuid_vedioNames').getValue(); + watchVideo(uuid_vedioNames); + } + + }] + }, { + columnWidth: .1, + layout: 'form', + id: 'downloadPanel', + hidden: !hasVideo, + items: [{ + xtype: 'button', + text: "下载视频", + id: "downloadBtn", + handler: function () { + var uuid_vedioNames = top.Ext.getCmp('uuid_vedioNames').getValue(); + downloadVideo(id, uuid_vedioNames); + } + + }] + }, { + columnWidth: .1, + layout: 'form', + id: 'deletePanel', + hidden: !hasVideo, + items: [{ + xtype: 'button', + text: "删除视频", + id: "watch", + handler: function () { + var uuid_vedioNames = top.Ext.getCmp('uuid_vedioNames').getValue(); + deleteVideo(id, uuid_vedioNames); + } + + }] + } + ] + }, { + columnWidth: 0.5, + layout: 'form', + // height : 300, + items: [materialsPanel] + }, { + columnWidth: 0.5, + layout: 'form', + bodyStyle: 'border:1px solid #afd7af', + height: 400, + //width : 475, + labelWidth: 60, + items: [ + showTousseImage + ] + }] + }], + buttons: [{ + id: 'saveBtn', + text: '保存', + handler: function () { + save2(null, this); + } + }, { + xtype: 'button', + text: "另存为新的聚合包", + id: "saveAsTousse", + listeners: { + click: function (thiz) { + top.Ext.MessageBox.prompt("提示", "请输入器械包名称", function (bu, txt) { + if (bu == 'ok') { + save2(txt, thiz); + } else { + return false; + } + }); + } + } + }, { + text: '取消', + id: 'saveAndNewBtn', + handler: function () { + tousseWin.close(); + grid.dwrReload(); + } + }, { + text: '打印条码', + id: 'printTDBarcode', + handler: function () { + printTDBarcode(id); + } + }, { + text: '器械包图片管理', + id: 'uploadFile', + hidden: id == 0 ? true : false, + handler: function () { + uploadToussePackingImageFile(imageTypeTousse, id); + } + }, { + text: '装配教学图片管理', + id: 'uploadToussePackingImageFile', + hidden: id == 0 ? true : false, + handler: function () { + uploadToussePackingImageFile(imageTypeToussePacking, id); + } + }, { + text: '配包教学视频上传', + id: 'uploadVedio', + hidden: hasVideo || id == 0, + handler: function () { + uploadVideoWindow(videoType); + } + }] + }); + + tousseWin = new top.Ext.Window({ + id: 'tousseWin', + layout: 'fit', + title: '聚合包信息', + width: 900, + border: false, + modal: true, + height: 660, + plain: true, + items: [formObj], + listeners: { + 'activate': function (f) { + if (id == 0) { + //taskGroupJsonStore.load();//新增器械包时任务组不加载 + packTypeStore.load(); + //大小及是否整包清洗之前未选择过时,才赋初始值 + if (top.Ext.getCmp('packageSize') && top.Ext.getCmp('packageSize').getValue() == '') { + top.Ext.getCmp('packageSize').setValue(defaultPackageSize); + } + if (top.Ext.getCmp('isCleanedEntirely') && top.Ext.getCmp('isCleanedEntirely').getValue() == '') { + top.Ext.getCmp('isCleanedEntirely').setValue('是'); + } + } + } + } + }); + tousseWin.show(); + if (id != 0) { + formObj.form.load({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!loadComboTousse.do', + // url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!loadTousseDefinition.do', + method: 'GET', + waitMsg: '正在加载数据,请稍候', + params: {id: id}, + success: function (form, action) { + var tousseDefinition = action.result.data; + top.Ext.getCmp("orginalName").setValue(tousseDefinition.name); + if (hasVideo) { + var videoName = tousseDefinition.uuid_vedioNames; + if (videoName != null) { + videoName = videoName.split(';')[0]; + top.Ext.getCmp('uuid_vedioNames').setValue(videoName); + var index = videoName.indexOf('_'); + videoName = videoName.substring(index + 1, videoName.length); + top.Ext.getCmp('vedioNamesForDisplay').setValue(videoName); + } + } + configStore.load({params: {id: tousseDefinition.id}}); + }, + failure: function (form, action) { + } + }); + } + + + function uploadVideoWindow(videoType) { + var dialog = new top.Ext.ux.UploadDialog.Dialog({ + title: "上传" + videoType + '(注意:最大上传文件大小为500M)', + //这里我用struts2做后台处理 + url: WWWROOT + '/disinfectSystem/baseData/videoFileAction!uploadVideo.do?videoType=' + videoType + '&objectId=' + id, + post_var_name: 'uploadFiles',//这里是自己定义的,默认的名字叫file + width: 450, + height: 300, + minWidth: 450, + minHeight: 300, + draggable: true, + resizable: true, + constraintoviewport: true, + permitted_extensions: ['f4v', 'mp4', 'flv'], + modal: true, + reset_on_hide: false, + allow_close_on_upload: false, //关闭上传窗口是否仍然上传文件 + upload_autostart: false + }); + //定义文件添加事件 + dialog.on('fileadd', function () { + if (this.grid_panel.getStore().getCount() > 1) { + showResult('每次只能上传一个视频!'); + this.grid_panel.getSelectionModel().selectLastRow(); + var selections = this.grid_panel.getSelectionModel().getSelections(); + this.fsa.postEvent('remove-files', selections); + } + }); + + //定义上传完成回调函数 + dialog.on('uploadsuccess', function (dialog, filename, resp_data) { + if (resp_data != null && resp_data.success) { + if (resp_data.msg == "") { + showResult("文件上传成功!"); + dialog.hide(); + top.Ext.getCmp('uploadVedio').hide();//上传视频的按钮隐藏 + top.Ext.getCmp('uuid_vedioNames').setValue(resp_data.fileName); + top.Ext.getCmp('vedioNamesForDisplay').setValue(resp_data.fileNameForDisplay); + top.Ext.getCmp('videoPanel').show(); + top.Ext.getCmp('watchPanel').show(); + top.Ext.getCmp('downloadPanel').show(); + top.Ext.getCmp('deletePanel').show(); + + updateVideoUploadStatus(videoType, id); + grid.dwrReload(); + + } else { + showResult("文件上传失败!"); + } + } + }); + dialog.show(); + } + + function uploadWindow(imageType) { + var dialog = new top.Ext.ux.UploadDialog.Dialog({ + title: "上传" + imageType, + url: WWWROOT + '/disinfectSystem/baseData/uploadImageFileAction!uploadImage.do?imageType=' + imageType + '&objectId=' + id, //这里我用struts2做后台处理 + post_var_name: 'uploadFiles',//这里是自己定义的,默认的名字叫file + width: 450, + height: 300, + minWidth: 450, + minHeight: 300, + draggable: true, + resizable: true, + constraintoviewport: true, + permitted_extensions: ['JPG', 'jpg', 'jpeg', 'JPEG', 'GIF', 'gif', 'png', 'PNG'], + modal: true, + reset_on_hide: false, + allow_close_on_upload: false, //关闭上传窗口是否仍然上传文件 + upload_autostart: false + }); + dialog.show(); + dialog.on('uploadcomplete', onUploadComplete); //定义上传完成回调函数 + } + + +} + +function validateAndSubmit2(TousseName) { + var rowIndex = top.Ext.getCmp('configGrid').getStore().getCount();//grid的行数 + // var materials = []; + var comboTousse = []; + var configStore = top.Ext.getCmp('configGrid').getStore(); + // 设置序号 + setMaterialSequence(); + configStore.each(function (item) { + comboTousse.push({ + id: item.get('id'), + tousseDefinitionId: item.get('tousseDefinitionId'), + // name : item.get('tousseDefinitionName'), + sequence: item.get('sequence') + }); + }); + var validateId = (TousseName == null ? top.Ext.getCmp('id').getValue() : null); + var validateName = (TousseName == null ? top.Ext.getCmp('name').getValue() : TousseName); + var tousseType = top.Ext.getCmp('tousseType').getValue(); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!validate.do', + params: {validateId: validateId, valifateName: validateName, tousseType: tousseType}, + success: function (response, options) { + var result = Ext.decode(response.responseText); + if (result.stauts == 1) { + if (TousseName != null) { + top.Ext.getCmp('id').setValue(null); + top.Ext.getCmp('name').setValue(TousseName); + } + formObj.form.submit({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!saveTousseDefinition.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + params: {comboTousseArray: JSON.stringify(comboTousse), motion: 'comboTousse'}, + // params: {materialDefinitionConfigResult: JSON.stringify(comboTousse), comboTousse: 'comboTousse'}, + success: function (form, action) { + tousseWin.close(); + showResult('保存成功'); + grid.dwrReload(); + }, + failure: function (form, action) { + showResult(action.result.message); + top.Ext.getCmp('saveBtn').enable(); + } + }); + } else { + showResult(result.message); + top.Ext.getCmp('saveBtn').enable(); + } + }, + failure: function (response, options) { + var result = Ext.decode(response.responseText); + showResult(result.cause); + } + }); + +} + +function save2(TousseName, thiz) { + top.Ext.getCmp('saveBtn').disable(); + if (!formObj.form.isValid()) { + showResult('请正确填写表单各值!'); + thiz.enable(); + return false; + } + + // TODO: 2017/1/18 校验聚合包下的器械包非空 + // var materialsCount = configStore.getCount(); + // if (materialsCount <= 0) { + // showResult('材料不能为空!'); + // thiz.enable(); + // return false; + // } + + // for (var i = 0; i < materialsCount; i++) { + // var materialName = top.Ext.getCmp('configGrid').getView().getCell(i, 0).firstChild.innerText; + // if (materialName == '' || materialName == null || materialName == ' ') { + // showResult('请填写材料名称!'); + // thiz.enable(); + // return false; + // } + // } + top.Ext.MessageBox.confirm("请确认", "是否确定要保存聚合包?", + function (button, text) { + if ("yes" == button) { + validateAndSubmit2(TousseName); + } else { + thiz.enable(); + } + }); +} + +function printTDBarcode(id) { + if (id != null && id > 0) { + var records = grid.getSelectionModel().getSelections(); + var tousseType = records[0].data['tousseType']; + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!printTDBarcode.do', + params: {toussedefinitionID: id}, + success: function (response, options) { + var result = Ext.decode(response.responseText); + var barcode = result.barcode; + if (barcode) { + var name = top.Ext.getCmp("name").getValue(); + var unitName2 = ""; + DWREngine.setAsync(false); + SupplyRoomConfigTableManager.getUnitName(function (unitName) { + if (unitName != null && unitName != "") { + unitName2 = unitName; + } + }); + DWREngine.setAsync(true); + preview(barcode, name, unitName2); + } + }, + failure: function (response, options) { + var result = Ext.decode(response.responseText); + showResult(result.cause); + } + }); + } +} + Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java =================================================================== diff -u -r16854 -r16856 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java (.../TousseDefinitionAction.java) (revision 16854) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java (.../TousseDefinitionAction.java) (revision 16856) @@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import com.forgon.disinfectsystem.goodFilterConfig.enums.ListType; import com.forgon.disinfectsystem.goodFilterConfig.service.GoodFilterConfigManager; import com.forgon.disinfectsystem.tousse.comboTousse.service.ComboTousseManager; import net.sf.json.JSONArray; @@ -1567,7 +1566,7 @@ String borrowIsUseBwList = CssdUtils.getSystemSetConfigByName("borrowIsUseBwList"); if (StringUtils.isNotBlank(borrowIsUseBwList) && "true".equals(borrowIsUseBwList)){ logger.debug("黑白名单过滤前大小:" + mapList.size()); - mapList = goodFilterConfigManagerImpl.handleBWList(mapList); + // mapList = goodFilterConfigManagerImpl.handleBWList(mapList); logger.debug("黑白名单过滤后大小:" + mapList.size()); } PageUtil.outPutResult(PageUtil.getPagePara(), mapList); Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/goodFilterConfig/service/GoodFilterConfigManagerImpl.java =================================================================== diff -u -r16854 -r16856 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/goodFilterConfig/service/GoodFilterConfigManagerImpl.java (.../GoodFilterConfigManagerImpl.java) (revision 16854) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/goodFilterConfig/service/GoodFilterConfigManagerImpl.java (.../GoodFilterConfigManagerImpl.java) (revision 16856) @@ -155,9 +155,9 @@ @Override - public List> handleBWList(List> needToFilter) { - List whiteList = this.findFilterGoodByType(ListType.WHITE, AcegiHelper.getCurrentOrgUnitCode()); - List blackList = this.findFilterGoodByType(ListType.BLACK, AcegiHelper.getCurrentOrgUnitCode()); + public List> handleBWList(List> needToFilter, String orgUnitCode) { + List whiteList = this.findFilterGoodByType(ListType.WHITE, orgUnitCode); + List blackList = this.findFilterGoodByType(ListType.BLACK, orgUnitCode); if (CollectionUtils.isNotEmpty(whiteList)) { if (CollectionUtils.isNotEmpty(blackList)) { //如果黑白名单不为空,则用白名单减去黑名单 Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/goodFilterConfig/service/GoodFilterConfigManager.java =================================================================== diff -u -r16854 -r16856 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/goodFilterConfig/service/GoodFilterConfigManager.java (.../GoodFilterConfigManager.java) (revision 16854) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/goodFilterConfig/service/GoodFilterConfigManager.java (.../GoodFilterConfigManager.java) (revision 16856) @@ -67,9 +67,10 @@ * 处理黑白名单 * * @param needToFilter 需要过滤的列表 + * @param orgUnitCode 申请科室编码 * @return 处理好的列表 */ - List> handleBWList(List> needToFilter); + List> handleBWList(List> needToFilter, String orgUnitCode); /** * 拼接黑白名单的条件sql Index: forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDaoImpl.java =================================================================== diff -u -r16654 -r16856 --- forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDaoImpl.java (.../ObjectDaoImpl.java) (revision 16654) +++ forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDaoImpl.java (.../ObjectDaoImpl.java) (revision 16856) @@ -12,6 +12,7 @@ import java.util.LinkedList; import java.util.List; import java.util.ListIterator; +import java.util.Map; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.collections.CollectionUtils; @@ -24,6 +25,7 @@ import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; +import org.hibernate.criterion.CriteriaSpecification; import org.hibernate.jdbc.ReturningWork; import org.hibernate.transform.Transformers; import org.springframework.orm.hibernate4.HibernateCallback; @@ -151,6 +153,29 @@ }); return list; } + + + + @Override + public List> findSqlByParam(String sql, List condition) { + SQLQuery query = this.getHibernateSession().createSQLQuery(sql); + for (int i = 0, size = condition.size(); i < size; i++) { + query.setParameter(i, condition.get(i)); + } + query.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP); + return query.list(); + } + + @Override + public List> findSqlByParam(String sql, Object[] condition) { + SQLQuery query = this.getHibernateSession().createSQLQuery(sql); + for (int i = 0, size = condition.length; i < size; i++) { + query.setParameter(i, condition[i]); + } + query.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP); + return query.list(); + } + public Object getByProperty(String objectPOName, String propertyName, Object propertyValue) { // Object po = null; Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousse.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousse.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousse.jsp (revision 16856) @@ -0,0 +1,122 @@ +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier" %> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.videomanager.VideoFile" %> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition" %> +<%@page contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %> +<%@include file="/common/taglibs.jsp" %> +<%@page import="com.forgon.tools.SpringBeanManger" %> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig" %> +<%@page import="com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager" %> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile" %> +<% + SupplyRoomConfigManager supplyRoomConfigManager = (SupplyRoomConfigManager) SpringBeanManger.getBean("supplyRoomConfigManager"); + SupplyRoomConfig supplyRoomConfig = supplyRoomConfigManager.getSystemParamsObj(); + SupplyRoomConfig firstSupplyRoom = supplyRoomConfigManager.getFirstSupplyRoomConfig(); + String departCode = firstSupplyRoom.getOrgUnitCoding(); + LoginUserData userData = AcegiHelper.getLoginUser(); + String currentOrgUnitCode = userData.getCurrentOrgUnitCode(); + String userName = userData.getUserFullName(); + request.setAttribute("userName", userName); + request.setAttribute("imageType", ImageFile.IMAGE_TYPE_TOUSSE); + request.setAttribute("videoType", VideoFile.VIDEO_TYPE_TOUSSE); + request.setAttribute("onlyShowDisable", request.getParameter("onlyShowDisable")); + if (currentOrgUnitCode != null) { + request.setAttribute("currentOrgUnitCode", currentOrgUnitCode); + request.setAttribute("departCode", departCode); + if (departCode.equals(currentOrgUnitCode)) { + request.setAttribute("isPriceReadOnly", false); + } + else { + request.setAttribute("isPriceReadOnly", true); + } + } +%> + + + + 器械包 + + + + + + +<%@ include file="/common/includeExtJsAndCss.jsp" %> + + + + + + + + + + + + + + + + + + +<%----%> + + + + + + + + + +
+
+
+
+ +
+ + \ No newline at end of file