Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java =================================================================== diff -u -r21639 -r21719 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 21639) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 21719) @@ -5897,69 +5897,4 @@ } } - @Override - public void saveOrUpdateExpensiveGoodsApplication( - RecyclingApplication recyclingApplication, JSONArray items) { - String deliverStatus = recyclingApplication.getDeliverStatus(); - if (StringTools.isNotBlank(deliverStatus) && !InvoicePlan.DELIVERSTATUS_AWAITDELIVER.equals(deliverStatus)) { - throw new RuntimeException("发货状态必须为待发货才能修改!"); - } - - if (items != null && items.size() > 0) { - //1、设置申请项 - List oldApplicationItems = recyclingApplication.getApplicationItems(); //旧的申请项集合 - List newApplicationItems = new ArrayList(); //新的申请项集合 - for (Object object : items) { - JSONObject jsonObj = (JSONObject) object; - TousseItem tousseItem = tousseItemManager.get(jsonObj.optLong("id", 0)); - if (tousseItem == null || tousseItem.getAmount() <= 0) { - tousseItem = new TousseItem(); - tousseItem.setExpensiveGoodsId(jsonObj.optLong("expensiveGoodsId")); - tousseItem.setTousseName(jsonObj.optString("showName")); - tousseItem.setTousseType(ExpensiveGoods.TYPE_NAME); - tousseItem.setDiposable(com.forgon.Constants.STR_NO); - tousseItem.setInvoicePlan(recyclingApplication); - tousseItem.setInvoicePlanID(recyclingApplication.getId()); - objectDao.save(tousseItem); - } - tousseItem.setAmount(jsonObj.optInt("amount")); - newApplicationItems.add(tousseItem); - } - - //删除掉前台已经删除的申请项 - if (CollectionUtils.isNotEmpty(oldApplicationItems)) { - List oldApplicationItemIds = oldApplicationItems.stream().map(i->i.getId()).collect(Collectors.toList()); - List newApplicationItemIds = newApplicationItems.stream().map(i->i.getId()).collect(Collectors.toList()); - oldApplicationItemIds.removeAll(newApplicationItemIds); - if (CollectionUtils.isNotEmpty(oldApplicationItemIds)) { - objectDao.delete(TousseItem.class.getSimpleName(), oldApplicationItemIds); - } - } - recyclingApplication.setApplicationItems(newApplicationItems); - - //2、设置时间 - String applicationTimeStr = recyclingApplication.getApplicationTimeStr(); - if(recyclingApplication.getApplicationTime() == null){ - recyclingApplication.setApplicationTime(ForgonDateUtils.safelyParseDate(applicationTimeStr)); - } - recyclingApplication.setSubmitTime(new Date()); - - //3、设置单类型和状态等等信息 - if (StringUtils.isBlank(recyclingApplication.getSerialNumber())) { - recyclingApplication.setSerialNumber(serialNumManager.getSerialNumberStr(SerialNum.TYPE_RECYCLINGAPPLICATION)); - } - recyclingApplication.setCommittedStatus(true); - recyclingApplication.setOrderByFiled(InvoicePlan.ORDERBYFIELD_ONE); - recyclingApplication.setDeliverStatus(InvoicePlan.DELIVERSTATUS_AWAITDELIVER); - recyclingApplication.setIncludeInvoiceItems(1); - recyclingApplication.setIncludeRecyclingItems(0); - recyclingApplication.setSequence(supplyRoomConfigManager.getOrgUnitSequence(recyclingApplication.getDepartCoding())); - recyclingApplication.setType(InvoicePlan.TYPE_EXPENSIVEGOODS_FORM); - - saveOrUpdate(recyclingApplication); - } else { - throw new RuntimeException("申请项不能为空!"); - } - } - } Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/tousseitem/TousseItem.java =================================================================== diff -u -r21498 -r21719 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/tousseitem/TousseItem.java (.../TousseItem.java) (revision 21498) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/tousseitem/TousseItem.java (.../TousseItem.java) (revision 21719) @@ -70,6 +70,9 @@ */ private String ttsName; + /** + * 如果此项是高值耗材则为“生产厂家” + */ private String supplierName; /** Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java =================================================================== diff -u --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java (revision 0) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java (revision 21719) @@ -0,0 +1,121 @@ +package com.forgon.disinfectsystem.expensivegoodsapplication.service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.StringUtils; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoods; +import com.forgon.disinfectsystem.entity.expensivegoodsapplication.Expensivegoodsapplication; +import com.forgon.disinfectsystem.entity.invoicemanager.InvoicePlan; +import com.forgon.disinfectsystem.entity.tousseitem.TousseItem; +import com.forgon.disinfectsystem.tousseitem.service.TousseItemManager; +import com.forgon.serialnumber.model.SerialNum; +import com.forgon.serialnumber.service.SerialNumManager; +import com.forgon.tools.GB2Alpha; +import com.forgon.tools.GB2WB; +import com.forgon.tools.hibernate.BasePoManagerImpl; +import com.forgon.tools.string.StringTools; +import com.forgon.tools.util.ForgonDateUtils; + +public class ExpensiveGoodsApplicationManagerImpl extends BasePoManagerImpl implements + ExpensiveGoodsApplicationManager { + + private TousseItemManager tousseItemManager; + + private SerialNumManager serialNumManager; + + private SupplyRoomConfigManager supplyRoomConfigManager; + + public void setTousseItemManager(TousseItemManager tousseItemManager) { + this.tousseItemManager = tousseItemManager; + } + + public void setSerialNumManager(SerialNumManager serialNumManager) { + this.serialNumManager = serialNumManager; + } + + public void setSupplyRoomConfigManager( + SupplyRoomConfigManager supplyRoomConfigManager) { + this.supplyRoomConfigManager = supplyRoomConfigManager; + } + + + + @Override + public void saveOrUpdate(Expensivegoodsapplication expensivegoodsapplication, JSONArray items) { + String deliverStatus = expensivegoodsapplication.getDeliverStatus(); + if (StringTools.isNotBlank(deliverStatus) && !InvoicePlan.DELIVERSTATUS_AWAITDELIVER.equals(deliverStatus)) { + throw new RuntimeException("发货状态必须为待发货才能修改!"); + } + + if (items != null && items.size() > 0) { + //1、设置申请项 + List oldApplicationItems = expensivegoodsapplication.getApplicationItems(); //旧的申请项集合 + List newApplicationItems = new ArrayList(); //新的申请项集合 + for (Object object : items) { + JSONObject jsonObj = (JSONObject) object; + TousseItem tousseItem = tousseItemManager.get(jsonObj.optLong("id", 0)); + if (tousseItem == null || tousseItem.getAmount() <= 0) { + tousseItem = new TousseItem(); + tousseItem.setExpensiveGoodsId(jsonObj.optLong("expensiveGoodsId")); + tousseItem.setTousseName(jsonObj.optString("showName")); + tousseItem.setSupplierName(jsonObj.optString("supplierName")); //高值耗材的生产厂家 + tousseItem.setPrice(jsonObj.optDouble("referencePrice")); //高值耗材的参考价 + tousseItem.setTousseType(ExpensiveGoods.TYPE_NAME); + tousseItem.setDiposable(com.forgon.Constants.STR_NO); + tousseItem.setInvoicePlan(expensivegoodsapplication); + tousseItem.setInvoicePlanID(expensivegoodsapplication.getId()); + objectDao.save(tousseItem); + } + tousseItem.setAmount(jsonObj.optInt("amount")); + newApplicationItems.add(tousseItem); + } + + //删除掉前台已经删除的申请项 + if (CollectionUtils.isNotEmpty(oldApplicationItems)) { + List oldApplicationItemIds = oldApplicationItems.stream().map(i->i.getId()).collect(Collectors.toList()); + List newApplicationItemIds = newApplicationItems.stream().map(i->i.getId()).collect(Collectors.toList()); + oldApplicationItemIds.removeAll(newApplicationItemIds); + if (CollectionUtils.isNotEmpty(oldApplicationItemIds)) { + objectDao.delete(TousseItem.class.getSimpleName(), oldApplicationItemIds); + } + } + expensivegoodsapplication.setApplicationItems(newApplicationItems); + + //2、设置时间 + String applicationTimeStr = expensivegoodsapplication.getApplicationTimeStr(); + if(expensivegoodsapplication.getApplicationTime() == null){ + expensivegoodsapplication.setApplicationTime(ForgonDateUtils.safelyParseDate(applicationTimeStr)); + } + expensivegoodsapplication.setSubmitTime(new Date()); + + //3、设置单类型和状态等等信息 + if (StringUtils.isBlank(expensivegoodsapplication.getSerialNumber())) { + expensivegoodsapplication.setSerialNumber(serialNumManager.getSerialNumberStr(SerialNum.TYPE_RECYCLINGAPPLICATION)); + } + expensivegoodsapplication.setCommittedStatus(true); + expensivegoodsapplication.setOrderByFiled(InvoicePlan.ORDERBYFIELD_ONE); + expensivegoodsapplication.setDeliverStatus(InvoicePlan.DELIVERSTATUS_AWAITDELIVER); + expensivegoodsapplication.setIncludeInvoiceItems(1); + expensivegoodsapplication.setIncludeRecyclingItems(0); + expensivegoodsapplication.setSequence(supplyRoomConfigManager.getOrgUnitSequence(expensivegoodsapplication.getDepartCoding())); + expensivegoodsapplication.setType(InvoicePlan.TYPE_EXPENSIVEGOODS_FORM); + //设置五笔码和拼音码 + String depart = expensivegoodsapplication.getDepart(); + expensivegoodsapplication.setSpelling(GB2Alpha.string2Alpha(depart)); + expensivegoodsapplication.setWbCode(GB2WB.getWBCode(depart)); + objectDao.saveOrUpdate(expensivegoodsapplication); + } else { + throw new RuntimeException("申请项不能为空!"); + } + } + +} Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoodsapplication/Expensivegoodsapplication.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoodsapplication/Expensivegoodsapplication.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/expensivegoodsapplication/Expensivegoodsapplication.java (revision 21719) @@ -0,0 +1,178 @@ +package com.forgon.disinfectsystem.entity.expensivegoodsapplication; + +import java.util.Date; + +import javax.persistence.Entity; + +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +import com.forgon.disinfectsystem.entity.invoicemanager.InvoicePlan; + +/** + * 高值耗材申请单 + * @author Chenjiaru 2017-12-29 + * + */ +@Entity +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class Expensivegoodsapplication extends InvoicePlan { + + /** + * 住院号 + */ + private String hospitalNumber; + + /** + * 诊疗号 + */ + private String clinicNumber; + + /** + * 病人姓名 + */ + private String patient; + + /** + * 病区 + */ + private String patientArea; + + /** + * 病室 + */ + private String roomNumber; + + /** + * 床位 + */ + private String bedNumber; + + /** + * 病人年龄 + */ + private Integer patientAge; + + /** + * 病人性别 + */ + private String patientSex; + + /** + * 病人所属科室 + */ + private String ascriptionDepartment; + + /** + * 手术名称,标准名称:operation,surgery是外科手术 + */ + private String surgery; + + /** + * 手术时间 + */ + private Date operationTime; + + /** + * 医生 + */ + private String doctor; + + + public String getHospitalNumber() { + return hospitalNumber; + } + + public void setHospitalNumber(String hospitalNumber) { + this.hospitalNumber = hospitalNumber; + } + + public String getClinicNumber() { + return clinicNumber; + } + + public void setClinicNumber(String clinicNumber) { + this.clinicNumber = clinicNumber; + } + + public String getPatient() { + return patient; + } + + public void setPatient(String patient) { + this.patient = patient; + } + + public String getPatientArea() { + return patientArea; + } + + public void setPatientArea(String patientArea) { + this.patientArea = patientArea; + } + + public String getRoomNumber() { + return roomNumber; + } + + public void setRoomNumber(String roomNumber) { + this.roomNumber = roomNumber; + } + + public String getBedNumber() { + return bedNumber; + } + + public void setBedNumber(String bedNumber) { + this.bedNumber = bedNumber; + } + + public Integer getPatientAge() { + return patientAge; + } + + public void setPatientAge(Integer patientAge) { + this.patientAge = patientAge; + } + + public String getPatientSex() { + return patientSex; + } + + public void setPatientSex(String patientSex) { + this.patientSex = patientSex; + } + + public String getAscriptionDepartment() { + return ascriptionDepartment; + } + + public void setAscriptionDepartment(String ascriptionDepartment) { + this.ascriptionDepartment = ascriptionDepartment; + } + + public String getSurgery() { + return surgery; + } + + public void setSurgery(String surgery) { + this.surgery = surgery; + } + + public Date getOperationTime() { + return operationTime; + } + + public void setOperationTime(Date operationTime) { + this.operationTime = operationTime; + } + + public String getDoctor() { + return doctor; + } + + public void setDoctor(String doctor) { + this.doctor = doctor; + } + +} Index: ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml =================================================================== diff -u -r21617 -r21719 --- ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 21617) +++ ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 21719) @@ -2597,6 +2597,20 @@ class="com.forgon.disinfectsystem.basedatamanager.userecordconvertconfig.dwr.table.UseRecordConvertConfigTableManager"> + + + + + + + + + PROPAGATION_REQUIRED + + + + + Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManager.java =================================================================== diff -u --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManager.java (revision 0) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManager.java (revision 21719) @@ -0,0 +1,21 @@ +package com.forgon.disinfectsystem.expensivegoodsapplication.service; + +import net.sf.json.JSONArray; + +import com.forgon.disinfectsystem.entity.expensivegoodsapplication.Expensivegoodsapplication; +import com.forgon.tools.hibernate.BasePoManager; +/** + * 高值耗材申请单的业务接口 + * @author Chenjiaru 2017-12-29 + * + */ +public interface ExpensiveGoodsApplicationManager extends BasePoManager { + + /** + * 保存或者修改高值耗材申请单. + * @param expensivegoodsapplication 高值耗材申请单对象 + * @param items 此次提交的申请项信息 + */ + public void saveOrUpdate(Expensivegoodsapplication expensivegoodsapplication, JSONArray items); + +} Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/action/ExpensiveGoodsApplicationAction.java =================================================================== diff -u --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/action/ExpensiveGoodsApplicationAction.java (revision 0) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/action/ExpensiveGoodsApplicationAction.java (revision 21719) @@ -0,0 +1,148 @@ +package com.forgon.disinfectsystem.expensivegoodsapplication.action; + +import java.util.List; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; +import org.apache.struts2.convention.annotation.ParentPackage; + +import com.forgon.disinfectsystem.entity.expensivegoodsapplication.Expensivegoodsapplication; +import com.forgon.disinfectsystem.entity.tousseitem.TousseItem; +import com.forgon.disinfectsystem.expensivegoodsapplication.service.ExpensiveGoodsApplicationManager; +import com.forgon.tools.StrutsParamUtils; +import com.forgon.tools.StrutsResponseUtils; +import com.forgon.tools.db.DatabaseUtil; +import com.forgon.tools.json.JSONUtil; +import com.forgon.tools.string.StringTools; +import com.forgon.tools.util.ForgonDateUtils; +import com.opensymphony.xwork2.ModelDriven; +import com.opensymphony.xwork2.Preparable; +/** + * 高值耗材申请单的Action + * @author Chenjiaru 2017-12-29 + * + */ +@ParentPackage(value = "default") +@Namespace(value = "/disinfectSystem/expensivegoodsapplication") +@Action(value = "expensiveGoodsApplicationAction") +public class ExpensiveGoodsApplicationAction implements Preparable, +ModelDriven{ + + private Expensivegoodsapplication expensivegoodsapplication; + + private ExpensiveGoodsApplicationManager expensiveGoodsApplicationManager; + + + public void setExpensiveGoodsApplicationManager( + ExpensiveGoodsApplicationManager expensiveGoodsApplicationManager) { + this.expensiveGoodsApplicationManager = expensiveGoodsApplicationManager; + } + + @Override + public Expensivegoodsapplication getModel() { + return expensivegoodsapplication; + } + + @Override + public void prepare() throws Exception { + Long id = StrutsParamUtils.getPraramLongValue("id", 0L); + if (DatabaseUtil.isPoIdValid(id)) { + expensivegoodsapplication = expensiveGoodsApplicationManager.get(id); + } else { + expensivegoodsapplication = new Expensivegoodsapplication(); + } + } + + + /** + * 保存高值耗材申请单. + */ + public void saveExpensiveGoodsApplication() { + String tousseItems = StrutsParamUtils.getPraramValue("tousseItems", ""); + if (StringTools.isNotBlank(tousseItems)) { + JSONObject result = JSONUtil.buildJsonObject(true, "保存成功"); + try { + JSONArray items = JSONArray.fromObject(tousseItems); + //重新设置手术时间 + expensivegoodsapplication.setOperationTime(ForgonDateUtils.safelyParseDate(StrutsParamUtils.getPraramValue("operationTime", ""))); + expensiveGoodsApplicationManager.saveOrUpdate(expensivegoodsapplication, items); + } catch (Exception e) { + e.printStackTrace(); + result = JSONUtil.buildJsonObject(false, e.getMessage()); + } + StrutsResponseUtils.output(result); + } else { + StrutsResponseUtils.output(JSONUtil.buildJsonObject(false, "申请项不能为空!")); + } + } + + /** + * 加载高值耗材申请单的申请单明细. + */ + public void loadExpensiveGoodsApplication() { + JSONObject result = JSONUtil.buildJsonObject(false, "找不到对应的申请单!"); + if (expensivegoodsapplication != null && DatabaseUtil.isPoIdValid(expensivegoodsapplication.getId())) { + result = JSONUtil.buildJsonObject(true, "加载成功!"); + result.put("data", buildRecyclingApplicationJson(expensivegoodsapplication)); + } + StrutsResponseUtils.output(result); + } + + /** + * + * @param expensivegoodsapplication + * @return + */ + private String buildRecyclingApplicationJson(Expensivegoodsapplication expensivegoodsapplication) { + JSONObject obj = new JSONObject(); + obj.put("id", expensivegoodsapplication.getId()); + obj.put("depart", expensivegoodsapplication.getDepart()); + obj.put("departCoding", expensivegoodsapplication.getDepartCoding()); + obj.put("settleAccountsDepart", expensivegoodsapplication.getSettleAccountsDepart()); + obj.put("settleAccountsDepartCoding", expensivegoodsapplication.getSettleAccountsDepartCoding()); + obj.put("handleDepart", expensivegoodsapplication.getHandleDepart()); + obj.put("handleDepartCoding", expensivegoodsapplication.getHandleDepartCoding()); + obj.put("serialNumber", expensivegoodsapplication.getSerialNumber()); + obj.put("applicant", expensivegoodsapplication.getApplicant()); + obj.put("applicationTimeStr", expensivegoodsapplication.getApplicationTimeStr()); + obj.put("remark", expensivegoodsapplication.getRemark()); + obj.put("deliverStatus", expensivegoodsapplication.getDeliverStatus()); + + obj.put("hospitalNumber", expensivegoodsapplication.getHospitalNumber()); + obj.put("clinicNumber", expensivegoodsapplication.getClinicNumber()); + obj.put("patient", expensivegoodsapplication.getPatient()); + obj.put("patientArea", expensivegoodsapplication.getPatientArea()); + obj.put("roomNumber", expensivegoodsapplication.getRoomNumber()); + obj.put("bedNumber", expensivegoodsapplication.getBedNumber()); + obj.put("patientAge", expensivegoodsapplication.getPatientAge()); + obj.put("patientSex", expensivegoodsapplication.getPatientSex()); + obj.put("ascriptionDepartment", expensivegoodsapplication.getAscriptionDepartment()); + obj.put("surgery", expensivegoodsapplication.getSurgery()); + obj.put("operationTime", ForgonDateUtils.safelyFormatDate(expensivegoodsapplication.getOperationTime(), ForgonDateUtils.SIMPLEDATEFORMAT_YYYYMMDDHHMM, "")); + obj.put("doctor", expensivegoodsapplication.getDoctor()); + obj.put("operationRoom", expensivegoodsapplication.getOperationRoom()); + + //设置申请项 + JSONArray items = new JSONArray(); + List applicationItems = expensivegoodsapplication.getApplicationItems(); + if (CollectionUtils.isNotEmpty(applicationItems)) { + for (TousseItem tousseItem : applicationItems) { + JSONObject item = new JSONObject(); + item.put("id", tousseItem.getId()); + item.put("amount", tousseItem.getAmount()); + item.put("expensiveGoodsId", tousseItem.getExpensiveGoodsId()); + item.put("showName", tousseItem.getTousseName()); + item.put("supplierName", tousseItem.getSupplierName()); + item.put("referencePrice", tousseItem.getPrice()); + items.add(item); + } + } + obj.put("tousseItems", items); + return obj.toString(); + } + +} Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManager.java =================================================================== diff -u -r21526 -r21719 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManager.java (.../RecyclingApplicationManager.java) (revision 21526) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManager.java (.../RecyclingApplicationManager.java) (revision 21719) @@ -397,13 +397,6 @@ public void interfereApplicationTime(String[] ids, Date applicationTime); /** - * 保存或者更新高值耗材申请单. - * @param recyclingApplication 高值耗材申请单 - * @param newItems 此次提交的申请项 - */ - public void saveOrUpdateExpensiveGoodsApplication( - RecyclingApplication recyclingApplication, JSONArray newItems); - /** * 根据时间,申请科室编码 :获得Hrp申请单明细集合(已按一次性物品物质编码,名称规格过滤) * @param startDate 开始时间 * @param endDate 结束时间 Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java =================================================================== diff -u -r21620 -r21719 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 21620) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 21719) @@ -337,71 +337,6 @@ } /** - * 保存高值耗材申请单. - */ - public void saveExpensiveGoodsApplication() { - String tousseItems = StrutsParamUtils.getPraramValue("tousseItems", ""); - if (StringTools.isNotBlank(tousseItems)) { - JSONObject result = JSONUtil.buildJsonObject(true, "保存成功"); - try { - JSONArray items = JSONArray.fromObject(tousseItems); - recyclingApplicationManager.saveOrUpdateExpensiveGoodsApplication(recyclingApplication, items); - } catch (Exception e) { - e.printStackTrace(); - result = JSONUtil.buildJsonObject(false, e.getMessage()); - } - StrutsResponseUtils.output(result); - } else { - StrutsResponseUtils.output(JSONUtil.buildJsonObject(false, "申请项不能为空!")); - } - } - - /** - * 加载高值耗材申请单的申请单明细. - */ - public void loadExpensiveGoodsApplication() { - JSONObject result = JSONUtil.buildJsonObject(false, "找不到对应的申请单!"); - if (DatabaseUtil.isPoIdValid(recyclingApplication.getId())) { - result = JSONUtil.buildJsonObject(true, "加载成功!"); - result.put("data", buildRecyclingApplicationJson(recyclingApplication)); - } - StrutsResponseUtils.output(result); - } - - private String buildRecyclingApplicationJson(RecyclingApplication recyclingApplication) { - JSONObject obj = new JSONObject(); - obj.put("id", recyclingApplication.getId()); - obj.put("depart", recyclingApplication.getDepart()); - obj.put("departCoding", recyclingApplication.getDepartCoding()); - obj.put("settleAccountsDepart", recyclingApplication.getSettleAccountsDepart()); - obj.put("settleAccountsDepartCoding", recyclingApplication.getSettleAccountsDepartCoding()); - obj.put("handleDepart", recyclingApplication.getHandleDepart()); - obj.put("handleDepartCoding", recyclingApplication.getHandleDepartCoding()); - obj.put("serialNumber", recyclingApplication.getSerialNumber()); - obj.put("applicant", recyclingApplication.getApplicant()); - obj.put("applicationTimeStr", recyclingApplication.getApplicationTimeStr()); - obj.put("patient", recyclingApplication.getPatient()); - obj.put("remark", recyclingApplication.getRemark()); - obj.put("deliverStatus", recyclingApplication.getDeliverStatus()); - - //设置申请项 - JSONArray items = new JSONArray(); - List applicationItems = recyclingApplication.getApplicationItems(); - if (CollectionUtils.isNotEmpty(applicationItems)) { - for (TousseItem tousseItem : applicationItems) { - JSONObject item = new JSONObject(); - item.put("id", tousseItem.getId()); - item.put("amount", tousseItem.getAmount()); - item.put("expensiveGoodsId", tousseItem.getExpensiveGoodsId()); - item.put("showName", tousseItem.getTousseName()); - items.add(item); - } - } - obj.put("tousseItems", items); - return obj.toString(); - } - - /** * 保存申请单 */ public void saveRecyclingApplication() { Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/action/ExpensiveGoodsSupplierAction.java =================================================================== diff -u -r21539 -r21719 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/action/ExpensiveGoodsSupplierAction.java (.../ExpensiveGoodsSupplierAction.java) (revision 21539) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/action/ExpensiveGoodsSupplierAction.java (.../ExpensiveGoodsSupplierAction.java) (revision 21719) @@ -247,7 +247,7 @@ } //供应商类型 String type = StrutsParamUtils.getPraramValue("supplierType", ""); - List> mapList = expensiveGoodsSupplierManager.searchSupplier(supplierName, type); + List> mapList = expensiveGoodsSupplierManager.searchSupplier(supplierName.trim(), type); PageUtil.outPutResult(PageUtil.getPagePara(), mapList); } catch (UnsupportedEncodingException e) { Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js =================================================================== diff -u -r21666 -r21719 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js (.../expensiveGoodsApplicationForm.js) (revision 21666) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js (.../expensiveGoodsApplicationForm.js) (revision 21719) @@ -55,6 +55,7 @@ * 处理科室的store */ var handleDepartmentStore = new Ext4.data.Store({ + autoLoad: true, //先加载一下 proxy : { type : 'ajax', url : WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!searchExpensiveGoodsHandleDepartment.do', @@ -92,7 +93,9 @@ {name : 'expensiveGoodsId'}, //高值耗材id {name : 'showName'}, //高值耗材的显示名称(即:名称[规格]) {name : 'name'}, //高值耗材的名称 - {name : 'specification'} //高值耗材的规格 + {name : 'specification'}, //高值耗材的规格 + {name : 'supplierName'}, //高值耗材的生产厂家 + {name : 'referencePrice'} //高值耗材的参考价 ]}); expensiveGoodsStore = new Ext4.data.Store({ @@ -101,7 +104,8 @@ {name : 'id'}, //高值耗材id {name : 'showName'}, //高值耗材的显示名称(即:名称[规格]) {name : 'name'}, //高值耗材的名称 - {name : 'specification'} //高值耗材的规格 + {name : 'specification'}, //高值耗材的规格 + {name : 'referencePrice'} //高值耗材的参考价 ], proxy : { type : 'ajax', @@ -111,10 +115,55 @@ totalProperty : 'totalCount', root : 'data' } + }, + listeners: { + beforeload : function(store, operation, eOpts){ + var rawValue = top.Ext4.getCmp('expensiveGoodsSupplier').getRawValue(); + var value = top.Ext4.getCmp('expensiveGoodsSupplier').getValue(); + if (rawValue && value) { + store.proxy.extraParams.supplierId = value; + } else { + showResult('请先选择生产厂家!'); + return false; + } + } } }); + //高值耗材生产厂家的store + var expensiveGoodsSupplierStore = new Ext4.data.Store({ + fields: [ + {name : 'id'}, //高值耗材生产厂家的id + {name : 'name'} //高值耗材生产厂家的名称 + ], + proxy : { + extraParams : {supplierType : '生产厂家'}, + type : 'ajax', + url : WWWROOT + '/disinfectSystem/baseData/expensiveGoodsSupplierAction!getSupplierData.do', + reader : { + type : 'json', + totalProperty : 'totalCount', + root : 'data' + } + } + }); + /** + * 常用医生的store + */ + var commonlyUsedDoctorJsonStore = new Ext4.data.Store({ + proxy : { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/baseData/commonlyUsedDoctorAction!getDoctorBykeyWord.do', + reader : { + type : 'json', + root : 'data' + } + }, + fields : [{name : 'id',mapping : 'id'}, + {name : 'doctor',mapping : 'doctor'} + ] + }); treePanelStore = Ext4.create('Ext4.data.TreeStore', { autoLoad : true, @@ -150,6 +199,8 @@ },{ dataIndex: 'specification', hidden: true },{ + header: '生产厂家',dataIndex: 'supplierName', width: 200 + },{ header: '名称', dataIndex: 'showName', width: 250 },{ header: '申请数量', dataIndex : 'amount', width: 100, align: 'center', sortable: false, @@ -168,6 +219,8 @@ } } } + },{ + header: '价格',dataIndex: 'referencePrice', width: 70 }], viewConfig : { toggleOnDblClick: false, @@ -220,12 +273,12 @@ xtype: 'fieldset', title: '基本信息', layout: 'column', - height : 160, + height : 200, width: '100%', items: [{ //流水号、申请人、时间 xtype : 'container', layout : {type : 'hbox'}, - height: 30, + height: 25, items : [{ xtype : 'textfield', fieldLabel : '流水号', @@ -259,7 +312,7 @@ },{ //申请科室、结算科室、处理的供应室 xtype : 'container', layout : {type : 'hbox'}, - height: 30, + height: 25, items : [{ xtype : 'combo', flex : 1, @@ -354,30 +407,186 @@ } } }] - },{ //病人 + },{ //住院号、诊疗号、病人姓名 xtype : 'container', layout : {type : 'hbox'}, - height: 30, + height: 25, items : [{ + xtype : 'textfield', + fieldLabel : '住院号', + maxLength : '50', + id : 'hospitalNumber', + name : 'hospitalNumber', + allowBlank : true, + enableKeyEvents : true, + listeners : { + specialkey : function(field, ee) { + if (ee.getKey() == Ext4.EventObject.ENTER) { + var jsonStr = "{\"patientNum\":\"" + field.value + + "\",\"numType\":\"hospitalNum\",\"sourcePage\":\"0\"}"; + loadPatientInfoByValAndType(jsonStr); + } + } + }, + flex : 1 + },{ xtype : 'textfield', + fieldLabel : '诊疗号', + maxLength : '100', + id : 'clinicNumber', + name : 'clinicNumber', + allowBlank : true, + enableKeyEvents : true, + listeners : { + specialkey : function(field, ee) { + if (ee.getKey() == Ext4.EventObject.ENTER) { + var jsonStr = "{\"patientNum\":\"" + field.value + + "\",\"numType\":\"treatmentNum\",\"sourcePage\":\"0\"}"; + loadPatientInfoByValAndType(jsonStr); + } + } + }, + flex : 1 + },{ + xtype : 'textfield', fieldLabel : '病人姓名', maxLength : '50', id : 'patient', name : 'patient', allowBlank : true, flex : 1 }] - },{ //备注 - xtype: 'container', - height: 30, - width: 800, - layout: {type: 'hbox'}, - items: [{ + },{ //病区、病室、床位 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + hidden : sstsConfig.hidePatientArea, + flex : 1, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '病区', + maxLength : '50', + id : 'patientArea', + name : 'patientArea', + allowBlank : true, + flex : 1 + },{ + xtype : 'textfield', + fieldLabel : '病室', + maxLength : '50', + id : 'roomNumber', + name : 'roomNumber', + allowBlank : true, + hidden : sstsConfig.hideRoomNumber, + flex : 1 + }, { + xtype : 'textfield', + fieldLabel : '床位', + maxLength : '50', + id : 'bedNumber', + name : 'bedNumber', + allowBlank : true, + hidden : sstsConfig.hideRoomNumber, + flex : 1 + } + ] + },{ //年龄、性别、病人所属科室 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + items : [{ + xtype : 'numberfield', + id : 'patientAge', + name : 'patientAge', + fieldLabel : '年龄', + maxValue: 255, + minValue: 1, + allowNegative : false, + allowDecimals : false, + flex : 1 + },{ + xtype : 'combo', + fieldLabel : '性别', + valueField : 'typeName', + displayField : 'typeName', + id : 'patientSex', + name : 'patientSex', + mode : 'local', + triggerAction : 'all', + forceSelection : true, + editable : false, + store : new top.Ext4.data.SimpleStore({ + fields : [ 'typeName' ], + data : [['男'],['女']] + }), + flex : 1 + },{ xtype : 'textfield', + fieldLabel : '病人所属科室', + maxLength : '16', + id : 'ascriptionDepartment', + name : 'ascriptionDepartment', + allowBlank : true, + flex : 1 + }] + },{ //手术名称、手术时间、医生 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '手术名称', + id : 'surgery', + name : 'surgery', + allowBlank : true, + flex : 1 + },{ + xtype : 'datefield', + fieldLabel : '手术时间', + id : 'operationTime', + name : 'operationTime', + selectOnFocus :true, + format : 'Y-m-d H:i', + allowBlank : true, + flex : 1 + },{ + fieldLabel : '医生', + xtype : 'combo', + id : 'doctor', + name : 'doctor', + flex : 1, + queryParam : 'spell', + minChars : 0, + displayField : 'doctor', + listConfig: {width: 300}, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + allowBlank : true, + forceSelection:false, + store : commonlyUsedDoctorJsonStore + }] + },{ //手术间、备注 + xtype : 'container', + layout : {type : 'hbox'}, + width:790, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '手术间', + id : 'operationRoom', + name : 'operationRoom', + allowBlank : true, + flex : 1.3 + },{ + xtype : 'textfield', fieldLabel : '备注', id : 'remark', name : 'remark', - flex : 1 + flex : 3 }] }] },{ @@ -389,6 +598,31 @@ xtype : 'tree-grid', store : treePanelStore, tbar:[{ + text: "生产厂家:" + },{ + xtype: 'combo', + id : 'expensiveGoodsSupplier', + name : 'expensiveGoodsSupplier', + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + matchFieldWidth: false, + width : 200, + listConfig: {width : 200}, + store : expensiveGoodsSupplierStore, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + listeners: { + select: function(combo, records, index) { + expensiveGoodsStore.load(); + top.Ext4.getCmp('expensiveGoods').setValue('') + } + } + },{ text: "物品名称:" },{ xtype: 'combo', @@ -407,8 +641,16 @@ triggerAction : 'all', hideTrigger : true, typeAhead : false, - allowBlank : true, - pageSize:100 + pageSize:100, + listeners: { + focus: function(thiz, the, eOpts) { + var rawValue = top.Ext4.getCmp('expensiveGoodsSupplier').getRawValue(); + if (!rawValue) { + showResult('请先选择生产厂家!'); + top.Ext4.getCmp('expensiveGoodsSupplier').focus(); + } + } + } },{ text:"数量:" },{ @@ -465,29 +707,32 @@ if (id) { formObj.form.load({ - url : WWWROOT + '/disinfectSystem/recyclingApplicationAction!loadExpensiveGoodsApplication.do', + url : WWWROOT + '/disinfectSystem/expensivegoodsapplication/expensiveGoodsApplicationAction!loadExpensiveGoodsApplication.do', method : 'POST', waitMsg : '正在保存数据,请稍候', waitTitle : '提交表单', success : function(form, action) { - var invoicePlan = action.result.data; + var data = action.result.data; var depart = formObj.getForm().findField('depart').getValue(); var settleAccountsDepart = top.Ext4.getCmp('settleAccountsDepart').getValue(); var handleDepart = top.Ext4.getCmp('handleDepart').getValue(); - - //1、设置“申请科室”、“结算科室”、“处理科室”combo的显示值 + //1、设置“申请科室”、“结算科室”、“处理科室”、“手术时间”combo的显示值 top.Ext4.getCmp('department').setRawValue(depart); top.Ext4.getCmp('settleAccountsDepartment').setRawValue(settleAccountsDepart); top.Ext4.getCmp('handleDepartment').setRawValue(handleDepart); + var operationTime = data.operationTime; + if(operationTime){ + top.Ext4.getCmp("operationTime").setValue(operationTime); + } //2、设置申请项 - treePanelStore.proxy.data = {children: invoicePlan.tousseItems}; + treePanelStore.proxy.data = {children: data.tousseItems}; treePanelStore.load(); //3、状态等于待发货才允许修改 - if (invoicePlan.deliverStatus != '待发货') { + if (data.deliverStatus != '待发货') { top.Ext4.getCmp('saveBtn').disable(); } @@ -522,12 +767,17 @@ var amount = top.Ext4.getCmp('amount').getValue(); var id = top.Ext4.getCmp('expensiveGoods').getValue(); var showName = top.Ext4.getCmp('expensiveGoods').getRawValue(); + var expensiveGoodsSupplier = top.Ext4.getCmp('expensiveGoodsSupplier').getRawValue(); //1、先校验物品和数量 if (!id || !showName) { showResult('请选择要添加的物品!'); return false; } + if (!expensiveGoodsSupplier) { + showResult('物品的生产厂家不能为空!'); + return false; + } if (isNaN(amount) || amount <= 0) { showResult('申请数量必须大于0!'); @@ -550,10 +800,13 @@ expensiveGoodsId : selectRecord.get('id'), showName : selectRecord.get('showName'), name : selectRecord.get('name'), - specification : selectRecord.get('specification') + specification : selectRecord.get('specification'), + supplierName : expensiveGoodsSupplier, + referencePrice : selectRecord.get('referencePrice') }); treePanelStore.getRootNode().appendChild(node); } + top.Ext4.getCmp('expensiveGoodsSupplier').setValue(); top.Ext4.getCmp('expensiveGoods').setValue(); top.Ext4.getCmp('amount').setValue(); } @@ -596,7 +849,7 @@ function submitExpensiveGoodsApplication() { top.Ext4.getCmp('saveBtn').disable(); formObj.form.submit({ - url : WWWROOT + '/disinfectSystem/recyclingApplicationAction!saveExpensiveGoodsApplication.do', + url : WWWROOT + '/disinfectSystem/expensivegoodsapplication/expensiveGoodsApplicationAction!saveExpensiveGoodsApplication.do', method : 'POST', waitMsg : '正在保存数据,请稍候', waitTitle : '提交表单', @@ -631,7 +884,9 @@ expensiveGoodsId: node.get('expensiveGoodsId'), showName: node.get('showName'), name: node.get('name'), - specification: node.get('specification') + specification: node.get('specification'), + supplierName : node.get('supplierName'), + referencePrice : node.get('referencePrice') }; items.push(item); } @@ -645,7 +900,39 @@ } } +/** + * 同步HRP病人信息 + * @param patientInfo + */ +function showPatientInfo(patientInfo){ + top.Ext4.getCmp('patient').setValue(patientInfo.patientName); + top.Ext4.getCmp('patientAge').setValue(patientInfo.patientAge); + if(patientInfo.patientSex == '男'){ + top.Ext4.getCmp('patientSex').setValue('男'); + }else if(patientInfo.patientSex == '女'){ + top.Ext4.getCmp('patientSex').setValue('女'); + }else{ + top.Ext4.getCmp('patientSex').setValue(''); + } + top.Ext4.getCmp('patientArea').setValue(patientInfo.patientArea); + top.Ext4.getCmp('roomNumber').setValue(patientInfo.roomNumber); + top.Ext4.getCmp('bedNumber').setValue(patientInfo.bedNumber); + top.Ext4.getCmp('doctor').setValue(patientInfo.doctorName); + top.Ext4.getCmp('surgery').setValue(patientInfo.operation); + //手术时间需要特殊处理,需要将年和月之间的-符替换成/ + if(patientInfo.operationTime){ + try{ + top.Ext4.getCmp('operationTime').setValue(new Date(patientInfo.operationTime.replace("-","/"))); + }catch(e){ + + } + } + top.Ext4.getCmp('ascriptionDepartment').setValue(patientInfo.ascriptionDepartment); + top.Ext4.getCmp('operationRoom').setValue(patientInfo.opRoomId); + top.Ext4.getCmp('remark').setValue(patientInfo.remark); +} + /** * 根据申请科室设置结算科室. * @param settleAccountsDepartmentStore 结算科室的store