Procházet zdrojové kódy

Merge branch 'medicare' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

chenjiasheng před 3 roky
rodič
revize
f66d79678c

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinestockout.java

@ -76,7 +76,7 @@ public class Mediicinestockout extends UuidIdentityEntityWithOperator implements
    private String docNum;
    /**
     * 领取状态
     * 领取状态         0未申领,1已领取
     */
    private String receiveState;

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

@ -187,6 +187,7 @@ public class BaseRequestMapping {
        public static final String getDetialOutOfStock  = "/getDetialOutOfStock";
        public static final String getDevInventory  = "/getDevInventory";
        public static final String countall  = "/countall";
        public static final String countAllDevice  = "/countAllDevice";
        public static final String countOnline  = "/countOnline";
        public static final String getDevicesByMoreContent  = "/getDevicesByMoreContent";
        public static final String getOrderDetailListById  = "/getOrderDetailListById";

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

@ -281,6 +281,18 @@ public class MedicineDeviceEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = BaseRequestMapping.BaseDevice.countAllDevice)
    @ApiOperation(value = "获取设备总计" , notes="参数未添加通过数据区域查询获取")
    public Envelop countAllDevice(@ApiParam(name = "userId", value = "用户id", required = true)
                                      @RequestParam(value = "userId") String userId) throws Exception {
        JSONObject jsonObject = deviceService.countAllDevice(userId);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getJSONObject("msg"));
    }
//    @ApiOperation(value = "获取设备总数量", notes="参数未添加通过数据区域查询获取")
//    @GetMapping("/countall")

+ 14 - 13
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineDrugsService.java

@ -264,20 +264,21 @@ public class MedicineDrugsService extends BaseJpaService<Mediicinedrugs, Mediici
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        int count = jdbcTemplate.queryForObject(countSql,Integer.class);
        for (Map<String,Object> stringObjectMap:list){
            if (!StringUtils.isEmpty(stringObjectMap.get("state").toString())) {
                if ("1".equals(stringObjectMap.get("state").toString())) {
                    stringObjectMap.put("stateName", "已上架");
            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", "非处方");
                    }
                }
                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", "非处方");
                }
            }
        }
        result.put("count", count);

+ 18 - 16
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineOrderService.java

@ -196,18 +196,18 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
                "    t.update_user as updateUser,\n" +
                "    t.update_user_name as updateUserName,\n" +
                "    t.attr AS attr,\n" +
                "    t.userId AS userId,\n" +
                "    t.shopNo AS shopNo,\n" +
                "    t.hospitalInfo AS hospitalInfo,\n" +
                "    t.user_id AS userId,\n" +
                "    t.shop_no AS shopNo,\n" +
                "    t.hospital_info AS hospitalInfo,\n" +
                "    t.birth AS birth,\n" +
                "    t.deptNum AS deptNum,\n" +
                "    t.deptName AS deptName,\n" +
                "    t.doctorNum AS doctorNum,\n" +
                "    t.doctorName AS doctorName,\n" +
                "    t.doctorAdvice AS doctorAdvice,\n" +
                "    t.allergyInfo AS allergyInfo,\n" +
                "    t.dept_num AS deptNum,\n" +
                "    t.dept_name AS deptName,\n" +
                "    t.doctor_num AS doctorNum,\n" +
                "    t.doctor_name AS doctorName,\n" +
                "    t.doctor_advice AS doctorAdvice,\n" +
                "    t.allergy_info AS allergyInfo,\n" +
                "    t.info AS info,\n" +
                "    t.socialSecurityCardNum AS socialSecurityCardNum\n" +
                "    t.social_security_card_num AS socialSecurityCardNum\n" +
                "FROM\n" +
                "    t_mediicine_order AS t where 1=1";
@ -252,12 +252,14 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        int count = jdbcTemplate.queryForObject(countSql,Integer.class);
        for (Map<String, Object> stringObjectMap : list) {
            if (!StringUtils.isEmpty(stringObjectMap.get("sellState").toString())) {
                if ("0".equals(stringObjectMap.get("sellState").toString())) {
                    stringObjectMap.put("sellStateName", "未取药");
                }
                if ("1".equals(stringObjectMap.get("sellState").toString())) {
                    stringObjectMap.put("sellStateName", "已取药");
            if (stringObjectMap.get("sellState") != null) {
                if (!StringUtils.isEmpty(stringObjectMap.get("sellState").toString())) {
                    if ("0".equals(stringObjectMap.get("sellState").toString())) {
                        stringObjectMap.put("sellStateName", "未取药");
                    }
                    if ("1".equals(stringObjectMap.get("sellState").toString())) {
                        stringObjectMap.put("sellStateName", "已取药");
                    }
                }
            }
        }

+ 12 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineStockOutService.java

@ -71,7 +71,8 @@ public class MedicineStockOutService extends BaseJpaService<Mediicinestockout, M
        //需要补货的设备
        Mediicinedevice mediicinedevice = deviceDao.findOne(obj.getDeviceId());
        Mediicinestockout mediicinestockout = new Mediicinestockout();
        mediicinestockout.setReceiveState("1");
        //领取状态,0未申领,1已领取
        mediicinestockout.setReceiveState("0");
        mediicinestockout.setRemark(obj.getRemark());
        mediicinestockout.setReplenishEr(obj.getReplenishEr());
        mediicinestockout.setReplenishEqu(mediicinedevice.getId());
@ -294,7 +295,16 @@ public class MedicineStockOutService extends BaseJpaService<Mediicinestockout, M
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        int count = jdbcTemplate.queryForObject(countSql,Integer.class);
        for (Map<String,Object> map:list){
            if (map.get("receiveState") != null) {
                if (!StringUtils.isEmpty(map.get("receiveState").toString())) {
                    if ("0".equals(map.get("receiveState").toString())) {
                        map.put("receiveStateName", "未申领");
                    }
                    if ("1".equals(map.get("receiveState").toString())) {
                        map.put("receiveStateName", "已领取");
                    }
                }
            }
        }
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));

+ 123 - 27
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicinedeviceService.java

@ -8,15 +8,21 @@ import com.yihu.jw.base.dao.a2dao.MedicineDeviceDeliveryDao;
import com.yihu.jw.base.dao.a2dao.MediicineDeviceDao;
import com.yihu.jw.base.dao.a2dao.MediicineDeviceUserDao;
import com.yihu.jw.base.dao.a2dao.MediicinedrugsDao;
import com.yihu.jw.base.dao.role.RoleDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.useragent.UserAgent;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.a1entity.MedicineDeviceDelivery;
import com.yihu.jw.entity.a1entity.MediicineDeviceUser;
import com.yihu.jw.entity.a1entity.Mediicinedevice;
import com.yihu.jw.entity.a1entity.Mediicinedrugs;
import com.yihu.jw.entity.base.role.RoleDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
@ -48,6 +54,14 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private UserDao userDao;
    @Autowired
    private RoleDao roleDao;
    @Autowired
    private UserAgent userAgent;
    @Autowired
    private HibenateUtils hibenateUtils;
@ -874,7 +888,87 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
        return result;
    }
    //获取当前设备数量
    /**
     * 获取设备总计
     * @return
     * @throws Exception
     */
    public  JSONObject countAllDevice(String userId) throws Exception {
        JSONObject result = new JSONObject();
        JSONObject jsonObject = new JSONObject();
//        String userId = userAgent.getUID();
        UserDO user = userDao.findOne(userId);
        RoleDO role = roleDao.findOne(user.getRoleId());
        int count = 0;
        int onlineCount = 0;
        int saleCount = 0;
        if ("replenisher".equals(role.getCode())) {
            String sql = "SELECT\n" +
                    "\tdevice_id\n" +
                    "FROM\n" +
                    "\tt_mediicine_device_user\n" +
                    "WHERE\n" +
                    "\tuser_id = '" + userId +"'\n" +
                    "AND del = 1";
            //设备列表
            List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
            String deviceIds = "";
            for (Map<String, Object> stringObjectMap : list) {
                if (stringObjectMap.get("device_id") != null && !StringUtils.isEmpty(stringObjectMap.get("device_id").toString())) {
                    if (StringUtils.isEmpty(deviceIds)) {
                        deviceIds += stringObjectMap.get("device_id").toString();
                    } else {
                        deviceIds += "," +  stringObjectMap.get("device_id").toString();
                    }
                }
            }
            String sencodSql = "select count(distinct(id)) from t_mediicine_device a where a.del = 1 and ',"+ deviceIds +",' LIKE CONCAT('%,',a.id,',%')";
            count = jdbcTemplate.queryForObject(sencodSql,Integer.class);
            jsonObject.put("total", count);
            sencodSql = "select count(distinct(id)) from t_mediicine_device a where a.del = 1 and a.network_status = 1 and ',"+ deviceIds +",' LIKE CONCAT('%,',a.id,',%')";
            onlineCount = jdbcTemplate.queryForObject(sencodSql, Integer.class);
            sencodSql = "select count(distinct(id)) from t_mediicine_device a where a.del = 1 and a.sale_status = 1 and ',"+ deviceIds +",' LIKE CONCAT('%,',a.id,',%')";
            saleCount = jdbcTemplate.queryForObject(sencodSql, Integer.class);
        } else {
            String sql = "SELECT\n" +
                    "t.hospital AS community\n" +
                    "FROM\n" +
                    "wlyy_user_area AS t\n" +
                    "WHERE\n" +
                    "t.user_id = '" + userId + "'\n" +
                    "AND t.del = 1";
            List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
            String belongCommunitys = "";
            for (Map<String, Object> stringObjectMap : list) {
                if (stringObjectMap.get("community") != null && !StringUtils.isEmpty(stringObjectMap.get("community").toString())) {
                    if (StringUtils.isEmpty(belongCommunitys)) {
                        belongCommunitys += stringObjectMap.get("community").toString();
                    } else {
                        belongCommunitys += "," +  stringObjectMap.get("community").toString();
                    }
                }
            }
            //多个社区
            String sencodSql = "select count(1) from t_mediicine_device a where a.del = 1 and ',"+ belongCommunitys +",' LIKE CONCAT('%,',a.belong_community,',%')";
            count = jdbcTemplate.queryForObject(sencodSql,Integer.class);
            jsonObject.put("total", count);
            sencodSql = "select count(distinct(id)) from t_mediicine_device a where a.del = 1 and a.network_status = 1 and ',"+ belongCommunitys +",' LIKE CONCAT('%,',a.belong_community,',%')";
            onlineCount = jdbcTemplate.queryForObject(sencodSql, Integer.class);
            sencodSql = "select count(distinct(id)) from t_mediicine_device a where a.del = 1 and a.sale_status = 1 and ',"+ belongCommunitys +",' LIKE CONCAT('%,',a.belong_community,',%')";
            saleCount = jdbcTemplate.queryForObject(sencodSql, Integer.class);
        }
        jsonObject.put("total", count);
        jsonObject.put("onlineTotal", onlineCount);
        jsonObject.put("saleTotal", saleCount);
        jsonObject.put("onlineRate", onlineCount * 1.0 / count);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg", jsonObject);
        return result;
    }
    //获取当前设备数量countAllDevice
//    public  long countAll() {
//        return deviceDao.countAll();
//    }
@ -1177,20 +1271,21 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
            if (childList != null) {
                for (Map<String, Object> objectMap : childList) {
                    objectMap.put("upInventory", Integer.parseInt(stringObjectMap.get("cargoCapacity").toString()) - Integer.parseInt(objectMap.get("qty").toString()));
                    if (!StringUtils.isEmpty(objectMap.get("state").toString())) {
                        if ("1".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "已上架");
                        }
                        if ("2".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "已下架");
                        }
                        if ("3".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "处方");
                        }
                        if ("4".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "非处方");
                    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", "非处方");
                            }
                        }
                    }
                }
                stringObjectMap.put("children", childList);
@ -1352,20 +1447,21 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
            if (childList != null) {
                for (Map<String, Object> objectMap : childList) {
                    objectMap.put("upInventory", Integer.parseInt(stringObjectMap.get("cargoCapacity").toString()) - Integer.parseInt(objectMap.get("qty").toString()));
                    if (!StringUtils.isEmpty(objectMap.get("state").toString())) {
                        if ("1".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "已上架");
                        }
                        if ("2".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "已下架");
                        }
                        if ("3".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "处方");
                        }
                        if ("4".equals(objectMap.get("state").toString())) {
                            objectMap.put("stateName", "非处方");
                    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", "非处方");
                            }
                        }
                    }
                }
                stringObjectMap.put("children", childList);