Przeglądaj źródła

Merge branch 'dev' of chaoren1/wlyy2.0 into medicare

wangzhinan 3 lat temu
rodzic
commit
7a9640cb84

+ 20 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinedevice.java

@ -170,9 +170,29 @@ public class Mediicinedevice extends UuidIdentityEntityWithOperator implements S
     */
    private String wayer;
    private String humidity;
    private String temperature;
    public Mediicinedevice() {
    }
    public String getHumidity() {
        return humidity;
    }
    public void setHumidity(String humidity) {
        this.humidity = humidity;
    }
    public String getTemperature() {
        return temperature;
    }
    public void setTemperature(String temperature) {
        this.temperature = temperature;
    }
    public String getBelongCommunity() {
        return belongCommunity;
    }

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -182,6 +182,7 @@ public class BaseRequestMapping {
        public static final String updateNetWorkStatus  = "/updateNetWorkStatus";
        public static final String UPDATESALESTATUS  = "/updateSaleStatus";
        public static final String UNBINDDEVICE  = "/unbindDevice";
        public static final String mergeAndSplitCargo  = "/mergeAndSplitCargo";
        public static final String getDeviceListByUserId  = "/getDeviceListByUserId";
        public static final String getDeviceListWithUserId  = "/getDeviceListWithUserId";
        public static final String getInitDeviceByPage  = "/getInitDeviceByPage";

+ 17 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineDeviceEndpoint.java

@ -231,6 +231,23 @@ public class MedicineDeviceEndpoint extends EnvelopRestEndpoint {
        return success(jsonObject.getString("response"));
    }
    @PostMapping(value = BaseRequestMapping.BaseDevice.mergeAndSplitCargo)
    @ApiOperation(value = "设备货道合并and分离")
    public Envelop mergeAndSplitCargo(
            @ApiParam(name = "cargoIds", value = "货道Id字符串", required = true)
            @RequestParam(value = "cargoIds") String cargoIds,
            @ApiParam(name = "isMerge", value = "是否合并,true 合并,false分离", required = true)
            @RequestParam(value = "isMerge") Boolean isMerge) throws Exception {
        String str = deviceService.mergeAndSplitCargo(cargoIds, isMerge);
        JSONObject jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
    @GetMapping(value = BaseRequestMapping.BaseDevice.getDeviceListByPage)
    @ApiOperation(value = "分页查询设备列表")
    public PageEnvelop getDeviceListByPage(

+ 24 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineDrugsEndpoint.java

@ -11,6 +11,7 @@ import com.yihu.jw.entity.a1entity.Mediicinedrugs;
import com.yihu.jw.entity.a1entity.Mediicinestockoutdetail;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
@RestController
@ -124,10 +126,11 @@ public class MedicineDrugsEndpoint extends EnvelopRestEndpoint {
        return success(jsonObject.getString("msg"));
    }
    @GetMapping(value = "/excelControl/exportExcel")
    @ApiOperation("导出列表")
    @ResponseBody
    public void searchList(
    public Envelop searchList(
            @ApiParam(name = "state", value = "药品状态")
            @RequestParam(value = "state", required = false) String state,
            @ApiParam(name = "content", value = "查询内容")
@ -145,16 +148,28 @@ public class MedicineDrugsEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "heightPrice", value = "价格上限")
            @RequestParam(value = "heightPrice", required = false) String heightPrice,
            HttpServletResponse response) {
        try {
            JSONObject result = drugsService.queryDrugListFullInfo(state, content, drugClass, drugType, lowVolume, heightVolume, lowPrice, heightPrice,1,10000,wechatId);
            List<Mediicinedrugs> list = JSONObject.parseArray(result.getJSONArray("msg").toJSONString(), Mediicinedrugs.class);
//        try {
//            JSONObject result = drugsService.queryDrugListFullInfo(state, content, drugClass, drugType, lowVolume, heightVolume, lowPrice, heightPrice,1,10000,wechatId);
//            List<Mediicinedrugs> list = JSONObject.parseArray(result.getJSONArray("msg").toJSONString(), Mediicinedrugs.class);
//            response.setContentType("octet/stream");
//            response.setHeader("Content-Disposition","attachment;filename="+new String("volunteerInfo.xls".getBytes("UTF-8"),"ISO8859-1"));
//            OutputStream os = response.getOutputStream();
//            this.write(os, list);
//            return success(list);
//        } catch (Exception ex) {
//            return failed("导出失败");
//        }
            response.setContentType("application/octet-stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("volunteerInfo.xls"));
        try{
            MixEnvelop expressages = drugsService.queryDrugListFullInfo2(state, content, drugClass, drugType, lowVolume, heightVolume, lowPrice, heightPrice,1,10000,wechatId);
            List<Map<String, Object>> list = expressages.getDetailModelList();
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("pushDataList.xls".getBytes("utf-8"), "iso8859-1"));
            OutputStream os = response.getOutputStream();
            this.write(os, list);
        } catch (Exception ex) {
            Envelop.getError("导出失败");
            drugsService.pushListWrite(os, list);
            return success(expressages);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }

+ 15 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/nologin/ServiceNoLoginEndPoint.java

@ -102,6 +102,21 @@ public class ServiceNoLoginEndPoint extends EnvelopRestEndpoint {
    }
//    @GetMapping(value = BaseRequestMapping.BaseOrder.getOrderOutList)
//    @ApiOperation(value = "上传温湿度数据" , notes="上传温湿度数据")
//    public Envelop getOrderOutList(
//            @ApiParam(name = "equNum", value = "订单id", required = true)
//            @RequestParam(value = "equNum", required = true) String equNum
//    ) throws Exception {
//        JSONObject jsonObject =  orderservice.getOrderOutList(orderId);
//        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
//            return failed(jsonObject.getString("msg"));
//        }
//        List<MedicineShipmentLog> list = JSONObject.parseArray(jsonObject.getJSONArray("msg").toJSONString(), MedicineShipmentLog.class);
//        return success(list, MedicineShipmentLog.class);
//    }
    @PostMapping(value = BaseRequestMapping.BaseOrder.updateOrderOutStatus)
    @ApiOperation(value = "更新订单出货单状态" , notes="更新订单出货单状态")
    public Envelop updateOrderOut(

+ 181 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineDrugsService.java

@ -15,14 +15,20 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.team.BaseTeamDO;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import jxl.format.VerticalAlignment;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
import java.util.logging.Logger;
@ -288,6 +294,181 @@ public class MedicineDrugsService extends BaseJpaService<Mediicinedrugs, Mediici
        return result;
    }
    public MixEnvelop  queryDrugListFullInfo2(String state, String content, String drugClass,
                                              String drugType, String lowVolume, String heightVolume,
                                              String lowPrice, String heightPrice, int page, int size,String wechatId) {
        String sql ="";
        {
            sql += "SELECT\n" +
                    "    t.id as id,\n" +
                    "    t.approval_num as approvalNum,\n" +
                    "    t.barcode as barcode,\n" +
                    "    t.brand as brand,\n" +
                    "    t.dos_form as dosForm,\n" +
                    "    t.state as state,\n" +
                    "    t.drug_bar_code as drugBarCode,\n" +
                    "    t.drug_class as drugClass,\n" +
                    "    t.drug_class_code as drugClassCode,\n" +
                    "    t.drug_code as drugCode,\n" +
                    "    t.drug_name as drugName,\n" +
                    "    t.drug_name_alies as drugNameAlies,\n" +
                    "    t.drug_short_code as drugShortCode,\n" +
                    "    t.drug_type_code as drugTypeCode,\n" +
                    "    t.earlywarningcate as earlywarningcate,\n" +
                    "    t.inventory as inventory,\n" +
                    "    t.manufactor as manufactor,\n" +
                    "    t.med_cabinet as medCabinet,\n" +
                    "    t.pic as pic,\n" +
                    "    t.price as price,\n" +
                    "    t.sale_volume as saleVolume,\n" +
                    "    t.self_code as selfCode,\n" +
                    "    t.specif as specif,\n" +
                    "    t.unit as unit,\n" +
                    "    t.create_time as createTime,\n" +
                    "    t.create_user as createUser,\n" +
                    "    t.create_user_name as createUserName,\n" +
                    "    t.update_time as updateTime,\n" +
                    "    t.update_user as updateUser,\n" +
                    "    t.update_user_name as updateUserName,\n" +
                    "    t.drug_sku as drugSku,\n" +
                    "    t.drug_num as drugNum,\n" +
                    "    t.use_num as useNum,\n" +
                    "    t.use_way as useWay,\n" +
                    "    t.use_rate as useRate,\n" +
                    "    t.use_dose as useDose,\n" +
                    "    t.use_way_add as useWayAdd,\n" +
                    "    t.org_code as orgCode,\n" +
                    "    t.org_name as orgName,\n" +
                    "    t.quantity_unit as quantityUnit,\n" +
                    "    t.pack_unit as packUnit\n" +
                    "FROM\n" +
                    "    t_mediicine_drugs AS t where 1=1";
        }
        String conditionSql = "";
        if (!StringUtils.isEmpty(state)){
            conditionSql += " and t.state = '" + state + "'";
        }
        if (!StringUtils.isEmpty(content)){
            conditionSql += " and CONCAT(t.drug_code, t.drug_bar_code, drug_name, t.drug_short_code) like '%"+content+"%'";
        }
        if (!StringUtils.isEmpty(drugClass)){
            conditionSql += " and t.drug_class_code = '" + drugClass + "'";
        }
        if (!StringUtils.isEmpty(drugType)){
            conditionSql += " and t.drug_type_code = '" + drugType + "'";
        }
        if (!StringUtils.isEmpty(lowVolume)){
            conditionSql += " and t.sale_volume >= " + lowVolume;
        }
        if (!StringUtils.isEmpty(heightVolume)) {
            conditionSql += " and t.sale_volume <= " + heightVolume;
        }
        if (!StringUtils.isEmpty(lowPrice)){
            conditionSql += " and t.price >= " + lowPrice;
        }
        if (!StringUtils.isEmpty(heightPrice)) {
            conditionSql += " and t.price <= " + heightPrice;
        }
        sql = sql + conditionSql;
        List<Map<String,Object>> list=null;
        list = hibenateUtils.createSQLQuery(sql,page,size);
        String countSql = " select " +
                "     COUNT(DISTINCT (t.id)) as count " +
                "   from " +
                "     t_mediicine_drugs t " +
                "  where " +
                "  1=1   " +
                conditionSql;
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        int count = jdbcTemplate.queryForObject(countSql,Integer.class);
        for (Map<String,Object> stringObjectMap:list){
            if (stringObjectMap.get("state") != null) {
                if (!StringUtils.isEmpty(stringObjectMap.get("state").toString())) {
                    if ("1".equals(stringObjectMap.get("state").toString())) {
                        stringObjectMap.put("stateName", "已上架");
                    }
                    if ("2".equals(stringObjectMap.get("state").toString())) {
                        stringObjectMap.put("stateName", "已下架");
                    }
                    if ("3".equals(stringObjectMap.get("state").toString())) {
                        stringObjectMap.put("stateName", "处方");
                    }
                    if ("4".equals(stringObjectMap.get("state").toString())) {
                        stringObjectMap.put("stateName", "非处方");
                    }
                }
            }
        }
        return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, list);
    }
    public void pushListWrite(OutputStream os, List<Map<String, Object>> ls) throws Exception {
        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
        try {
            WritableSheet sheet;
            sheet = wwb.createSheet("sheet", 1);
            String header[] = {"图片", "药品名称/药品条码", "分类", "剂型", "类型", "单位", "售价", "库存", "销量", "自编码", "规格", "厂家", "批准文号", "品牌", "状态"};
            int i = 0;
            for (String h : header) {
                addCell(sheet, 0, i, h);
                i++;
            }
            int j = 1;
            int ii=1;
            for (Map<String, Object> tmp : ls) {
                addCell(sheet, j, 0, ii + "img");
                addCell(sheet, j, 1, tmp.get("drugNameAlies") +"/" + tmp.get("drugBarCode"));
                addCell(sheet, j, 2, tmp.get("drugTypeCode") + "");
                addCell(sheet, j, 3, tmp.get("dosForm") + "");
                addCell(sheet, j, 4, tmp.get("drugTypeCode")+"");
                addCell(sheet, j, 5, tmp.get("unit") + "");
                addCell(sheet, j, 6, tmp.get("price") + "");
                addCell(sheet, j, 7, tmp.get("inventory") + "");
                addCell(sheet, j, 8, tmp.get("saleVolume") + "");
                addCell(sheet, j, 9, tmp.get("selfCode") + "");
                addCell(sheet, j, 10, tmp.get("specif") + "");
                addCell(sheet, j, 11, tmp.get("manufactor") + "");
                addCell(sheet, j, 12, tmp.get("approvalNum") + "");
                addCell(sheet, j, 13, tmp.get("brand") + "");
                addCell(sheet, j, 14, tmp.get("state") + "");
                j++;
                ii++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column, row, data);
        WritableCellFormat cellFormat = new WritableCellFormat();
        cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
        cellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
        label.setCellFormat(cellFormat);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column, row, data);
        if (!org.springframework.util.StringUtils.isEmpty(memo)) {
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
    public JSONObject getOneDrugInfo(String drugId) throws Exception{
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(drugId)){

+ 81 - 11
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicinedeviceService.java

@ -529,7 +529,76 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
        return result.toJSONString();
    }
    //mergeAndSplitCargo
    /**
     * 合并和分离过道
     * @param cargoIds
     * @param isMerge
     * @return
     */
    public String mergeAndSplitCargo(String cargoIds, Boolean isMerge){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(cargoIds)){
            result.put("msg","cargoIds is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        for (String deviceId : cargoIds.split(",")) {
            if(!StringUtils.isEmpty(deviceId)){
                Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId);
                //删除补货员
                {
                    List<Map<String, Object>> list = null;
                    list = hibenateUtils.createSQLQuery("SELECT * FROM t_mediicine_device_user where del = 1 AND device_id = '" + deviceId + "'");
                    if (list != null && list.size() > 0) {
                        for (Map<String, Object> stringObjectMap : list) {
                            if (!StringUtils.isEmpty(stringObjectMap.get("id").toString())) {
                                MediicineDeviceUser mediicineDeviceUser = deviceUserDao.findOne(stringObjectMap.get("id").toString());
                                if (mediicineDeviceUser != null) {
                                    mediicineDeviceUser.setDel("0");
                                    deviceUserDao.save(mediicineDeviceUser);
                                }
                            }
                        }
                    }
                }
                //删除社区,社区中心名称
                mediicinedevice.setBelongCommunity(null);
                mediicinedevice.setCommunity(null);
                mediicinedevice.setStatus("0");
                mediicinedevice.setSaleStatus("2");
                mediicinedevice.setAisles(String.valueOf(Integer.parseInt(mediicinedevice.getLayer()) *
                        Integer.parseInt(mediicinedevice.getWayer())));
                mediicinedevice.setCargoCapacity("5");
                mediicinedevice.setCapacity(String.valueOf(Integer.parseInt(mediicinedevice.getAisles()) *
                        Integer.parseInt(mediicinedevice.getCargoCapacity())));
                mediicinedevice.setDeliveryAddress(null);
                mediicinedevice.setDetailAddress(null);
                mediicinedevice.setEquArea(null);
                this.save(mediicinedevice);
                //更新库存
                List<MediicinecabinetInventory> list = inventoryDao.findMediicinecabinetInventoryByDeviceId(deviceId);
                for (MediicinecabinetInventory inventory : list) {
                    inventory.setPic(null);
                    inventory.setShelfStatus("0");
                    inventory.setQty("0");
                    inventory.setDrugCode(null);
                    inventory.setDrugId(null);
                    inventory.setDrugName(null);
                    inventory.setPrice(null);
                    inventory.setSku(null);
                    inventory.setDrugSku(null);
                    inventory.setNum("0");
                    inventory.setLongtime(null);
                    inventory.setOrgCode(null);
                    inventoryDao.save(inventory);
                }
            }
        }
        result.put("response",ConstantUtils.SUCCESS);
        return result.toJSONString();
    }
    /**
@ -1580,17 +1649,18 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
            if (xiajiaQty != null) {
                stringObjectMap.put("xiajiaQty", xiajiaQty);
            }
            tempSql = "SELECT\n" +
                    "\tcreate_time\n" +
                    "FROM\n" +
                    "\tt_mediicine_stockrecord_detail\n" +
                    "ORDER BY\n" +
                    "\tcreate_time DESC\n" +
                    "LIMIT 1";
            Date buhuoDate = jdbcTemplate.queryForObject(tempSql, Date.class);
            if (buhuoDate != null) {
                stringObjectMap.put("buhuoTime", DateUtil.dateToStr(buhuoDate, "yyyy-MM-dd HH:mm:ss" ));
            }
//            tempSql = "select count(distinct(id)) from t_mediicine_stockrecord_detail";
//            tempSql = "SELECT\n" +
//                    "\tcreate_time\n" +
//                    "FROM\n" +
//                    "\tt_mediicine_stockrecord_detail\n" +
//                    "ORDER BY\n" +
//                    "\tcreate_time DESC\n" +
//                    "LIMIT 1";
//            Date buhuoDate = jdbcTemplate.queryForObject(tempSql, Date.class);
//            if (buhuoDate != null) {
//                stringObjectMap.put("buhuoTime", DateUtil.dateToStr(buhuoDate, "yyyy-MM-dd HH:mm:ss" ));
//            }
        }