Browse Source

v1.4.0 审方流程

bing 2 years ago
parent
commit
e85d0f3227

+ 4 - 0
common/common-entity/sql记录

@ -1667,3 +1667,7 @@ ALTER table base_ylz_medical_recharge add column`amount` varchar(50) DEFAULT NUL
 ALTER table base_ylz_medical_recharge add column `charge_result_name` varchar(50) DEFAULT NULL COMMENT '支付结果';
 ALTER table base_ylz_medical_recharge add column `ssc` varchar(50) DEFAULT NULL COMMENT '支付卡号';
 ALTER table base_ylz_medical_recharge add column `deposit_type` varchar(50) DEFAULT NULL COMMENT '支付方式';
 --2022-07-20
alter table t_mediicine_order add column reviewer_state tinyint(2) default null comment '审方状态-1不通过0未审1审核通过';
 alter table t_mediicine_order add column reviewer_content varchar(255) default null comment '审方描述内容';

+ 26 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicineorder.java

@ -241,6 +241,16 @@ public class Mediicineorder extends UuidIdentityEntityWithOperator implements Se
     */
    private String applyNo;
    /**
     * 审方状态-1不通过0未审1审核通过
     */
    private Integer reviewerState;
    /**
     * 审方描述内容
     */
    private String reviewerContent;
    /**
     * 订单详情
@ -618,6 +628,22 @@ public class Mediicineorder extends UuidIdentityEntityWithOperator implements Se
        this.shippingType = shippingType;
    }
    public Integer getReviewerState() {
        return reviewerState;
    }
    public void setReviewerState(Integer reviewerState) {
        this.reviewerState = reviewerState;
    }
    public String getReviewerContent() {
        return reviewerContent;
    }
    public void setReviewerContent(String reviewerContent) {
        this.reviewerContent = reviewerContent;
    }
    @Transient
    public List<Mediicineorderdetail> getMediicineorderdetails() {
        return mediicineorderdetails;

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

@ -69,6 +69,7 @@ public class BaseRequestMapping {
        public static final String findDoctorOtherIncentive  = "/findDoctorOtherIncentive";
        public static final String removeIncentive  = "/removeIncentive";
        public static final String resetDoctorPwd  = "/resetDoctorPwd";
        public static final String bottomMenu  = "/bottomMenu";
    }
@ -159,6 +160,7 @@ public class BaseRequestMapping {
        public static final String getsumquantity  = "/getsumquantity";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String docFullInfo  = "/docFullInfo";
        public static final String reviewerOrder  = "/reviewerOrder";
        public static final String docOrgDutyTreeInfo  = "/docOrgDutyTreeInfo";
        public static final String docOrgDeptTreeInfo  = "/docOrgDeptTreeInfo";
        public static final String getDoctorListByDept  = "/getDoctorListByDept";

+ 26 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineOrderEndpoint.java

@ -11,9 +11,11 @@ import com.yihu.jw.entity.a1entity.Mediicineorderdetail;
import com.yihu.jw.entity.a1entity.Mediicinestockoutdetail;
import com.yihu.jw.entity.a1entity.Mediicinestockrecorddetail;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -97,6 +99,8 @@ public class MedicineOrderEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "sellState", required = false) String sellState,
            @ApiParam(name = "orderState", value = "订单状态")
            @RequestParam(value = "orderState", required = false) String orderState,
            @ApiParam(name = "reviewerState", value = "审方状态-1不通过0未审1审核通过")
            @RequestParam(value = "reviewerState", required = false) String reviewerState,
            @ApiParam(name = "dispensingWindow", value = "取药区域")
            @RequestParam(value = "dispensingWindow", required = false) String dispensingWindow,
            @ApiParam(name = "community", value = "所属社区")
@ -109,10 +113,31 @@ public class MedicineOrderEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        JSONObject result = orderservice.queryOrderListFullInfo(content,orderNum, equNum, contact, startTime, endTime, sellState, orderState, dispensingWindow, community, town,userId,page,size,wechatId);
        JSONObject result = orderservice.queryOrderListFullInfo(content,orderNum, equNum, contact, startTime, endTime, sellState, orderState,reviewerState, dispensingWindow, community, town,userId,page,size,wechatId);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
    }
    @PostMapping(value = BaseRequestMapping.BaseOrder.reviewerOrder)
    @ApiOperation(value = "审方处方订单")
    public Envelop reviewerOrder(@ApiParam(name = "orderId",value = "处方订单id",required = true)
                                 @RequestParam(value = "orderId",required = true)String orderId,
                                 @ApiParam(name = "reviewerState",value = "审方状态-1不通过1审核通过",required = true)
                                 @RequestParam(value = "reviewerState",required = true)Integer reviewerState,
                                 @ApiParam(name = "reviewerContent",value = "审核描述内容",required = false)
                                 @RequestParam(value = "reviewerContent",required = false)String reviewerContent){
        try {
            JSONObject result = orderservice.reviewerOrder(orderId,reviewerState,reviewerContent);
            if (result.getInteger(ResponseContant.resultFlag)==ResponseContant.fail){
                return failed(result.getString(ResponseContant.resultMsg));
            }else {
                return success(result.get(ResponseContant.resultMsg));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failed("系统繁忙,请稍后再试");
        }
    }
//------合计类
//    @GetMapping(value = BaseRequestMapping.BaseOrder.docFullInfo)
//    @ApiOperation(value = "获得时间段内的销售金额", notes="获得时间段内的销售金额")

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineUserEndpoint.java

@ -68,6 +68,14 @@ public class MedicineUserEndpoint extends EnvelopRestEndpoint {
        return success(result.getString("response"));
    }
    @GetMapping(value = BaseRequestMapping.BaseUser.bottomMenu)
    @ApiOperation(value = "用户底部菜单数量")
    public Envelop bottomMenu(@ApiParam(name = "userId", value = "用户id")
                              @RequestParam(value = "userId", required = true) String userId) throws Exception {
        JSONObject result = userService.bottomMenu(userId);
        return success(result);
    }
//---------众建平台,无法转移,
//    @GetMapping("getorderlist")
//    @ApiOperation("获取订单列表")

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

@ -144,7 +144,9 @@ public class ServiceNoLoginEndPoint extends EnvelopRestEndpoint {
            @ApiParam(name = "cardNum", value = "社保卡号")
            @RequestParam(value = "cardNum", required = false) String cardNum,
            @ApiParam(name = "ehcCard", value = "电子健康卡")
            @RequestParam(value = "ehcCard", required = false) String ehcCard
            @RequestParam(value = "ehcCard", required = false) String ehcCard,
            @ApiParam(name = "patientName", value = "patientName")
            @RequestParam(value = "patientName", required = false) String patientName
    ) throws Exception {
        if (StringUtils.isNoneBlank(ehcCard)){
            cardNum = orderservice.getEhcCardInfo(ehcCard);
@ -154,9 +156,9 @@ public class ServiceNoLoginEndPoint extends EnvelopRestEndpoint {
        }
        //拉取线下智业订单
        if (StringUtils.isNoneBlank(cardNum)){
            orderservice.getPhysicApplyWaitExecList(deviceId,cardNum);
            orderservice.getPhysicApplyWaitExecList(deviceId,cardNum,patientName);
        }
        JSONObject jsonObject =  orderservice.checkOrderAndReturnOrderList(deviceId, pickUpNum, cardNum);
        JSONObject jsonObject =  orderservice.checkOrderAndReturnOrderList(deviceId, pickUpNum, cardNum,patientName);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }

+ 5 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedOrderService.java

@ -68,6 +68,8 @@ public class MedOrderService {
    private YlzMedicalResponseDao ylzMedicalResponseDao;
    @Autowired
    private YlzService ylzService;
    @Autowired
    private MedicineOrderService orderService;
    /**
     * 获取续方订单及药方
@ -119,6 +121,7 @@ public class MedOrderService {
            mediicineorder.setDoctorAdvice(params.getString("rx_doctoradvice"));
            mediicineorder.setAllergyInfo(params.getString("rx_allergy_info"));
            mediicineorder.setPickUpNum(order);
            mediicineorder.setReviewerState(0);
            mediicineorder.setOrderSource("厦门i健康");
            mediicineorder.setAmount(params.getString("orderAmount"));
            mediicineorder.setSocialSecurityCardNum(params.getString("SecurityCardNum"));
@ -161,6 +164,8 @@ public class MedOrderService {
            Iterable<Mediicineorderdetail>mediicineorderdetails= mediicineorderdetailDao.save(mediicineorderdetailList);
            result.put("order",ord);
            result.put("drugs",mediicineorderdetails);
            orderService.reviewRemindSendMessage(mediicineorder.getBelongCommunity(),mediicineorder.getName());
            return result;
        }
        return null;

+ 73 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineOrderService.java

@ -24,6 +24,7 @@ import com.yihu.jw.hospital.HospitalDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.OauthCaConfigDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -220,7 +221,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
    //orderNum, equNum, contact, startTime, endTime, sellState, orderState, dispensingWindow
    public JSONObject queryOrderListFullInfo(String content,String orderNum, String equNum, String contact,
                                             String startTime, String endTime, String sellState,
                                             String orderState, String dispensingWindow, String community,String town,
                                             String orderState,String reviewerState, String dispensingWindow, String community,String town,
                                             String userId, int page, int size, String wechatId) throws Exception {
        JSONObject result = new JSONObject();
@ -313,6 +314,8 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
                "    t.prescribe_num as prescribeNum,\n" +
                "    t.prescribe_time as prescribeTime,\n" +
                "    t.sell_state as sellState,\n" +
                "    t.reviewer_state as reviewerState,\n" +
                "    t.reviewer_content as reviewerContent,\n" +
                "    t.sex as sex,\n" +
                "    t.shipping_equ as shippingEqu,\n" +
                "    t.shipping_time as shippingTime,\n" +
@ -373,6 +376,9 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        if (!StringUtils.isEmpty(orderState)) {
            conditionSql += " and t.order_state = '" + orderState + "'";
        }
        if (org.apache.commons.lang3.StringUtils.isNotBlank(reviewerState)){
            conditionSql += " and t.reviewer_state='"+reviewerState+"' ";
        }
        if (!StringUtils.isEmpty(dispensingWindow)) {
            conditionSql += " and t.dispensing_window = '" + dispensingWindow + "'";
        }
@ -474,6 +480,8 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
                break;
        }
        jsonObject.put("sellStateName", sellStateName);
        jsonObject.put("socialSecurityCardNum", mediicineorder.getSocialSecurityCardNum());
        jsonObject.put("doctorName", mediicineorder.getDoctorName());
        jsonObject.put("infoAccess", mediicineorder.getInfoAccess());
        jsonObject.put("orderTypeName", orderTypeMap.get(mediicineorder.getOrderType()));
        //取药码
@ -1379,7 +1387,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
     * @param cardNo
     * @return
     */
    public boolean getPhysicApplyWaitExecList(String deviceId,String cardNo){
    public boolean getPhysicApplyWaitExecList(String deviceId,String cardNo,String patientName){
        Mediicinedevice mediicinedevice = deviceDao.findMediicinedeviceByEquNum(deviceId);
        String orgCode = "";
        String community = "";
@ -1448,10 +1456,14 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
                                    mediicineorder.setApplyNo(alyNo);
                                    mediicineorder.setOrderSource("智业系统");
                                    mediicineorder.setOrderState("1");
                                    mediicineorder.setReviewerState(0);
                                    mediicineorder.setPickUpNum(realOrder);
                                    mediicineorder.setPrescribeNum(realOrder);
                                    mediicineorder.setSellState("0");
                                    mediicineorder.setInfo("慢病");
                                    if (org.apache.commons.lang.StringUtils.isNotBlank(patientName)){
                                        mediicineorder.setName(patientName);
                                    }
                                    mediicineorder.setSocialSecurityCardNum(cardNo);
                                    mediicineorder.setBelongCommunity(orgCode);
                                    mediicineorder.setCommunity(community);
@ -1594,6 +1606,30 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        }
    }
    /**
     * 待审核发送模板消息
     * @param hospital
     */
    public void reviewRemindSendMessage(String hospital,String patientName){
        try {
            if (org.apache.commons.lang.StringUtils.isNotBlank(hospital)){
                List<WlyyUserAreaDO> userAreaDOList = userAreaDao.findAllByHospital(hospital);
                for (WlyyUserAreaDO userAreaDO:userAreaDOList){
                    UserDO userDO = userDao.findById(userAreaDO.getUserId());
                    if (userDO!=null){
                        RoleDO roleDO = roleDao.findOne(userDO.getRoleId());
                        if (roleDO.getCode().equalsIgnoreCase("replenisher")
                                ||roleDO.getCode().equalsIgnoreCase("communityAdmin")){
                            sendDoctorTemplates(userDO.getIdcard(),"9","","您好,您有1位患者的续方待审方,请前往审核。","居民:"+patientName,"审方提醒,"+userAreaDO.getHospitalName()+","+userDO.getName());
                        }
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
     * 温度、在线离线发送模板消息
     * @param hospital
@ -2133,7 +2169,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject checkOrderAndReturnOrderList(String deviceId, String pickUpNum, String cardNum) {
    public JSONObject checkOrderAndReturnOrderList(String deviceId, String pickUpNum, String cardNum,String patientName) {
        JSONObject result = new JSONObject();
        if (deviceId == null || StringUtils.isEmpty(deviceId)) {
            result.put("msg", "parameter deviceId is null or empty");
@ -2180,7 +2216,14 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        }
        List<Map<String , Object>> orderList = new ArrayList<>();
        //遍历所有订单
        List<Mediicineorder> orderSetName = new ArrayList<>();
        for (Mediicineorder order : orders) {
            if (org.apache.commons.lang3.StringUtils.isNotBlank(order.getName())){
                if (org.apache.commons.lang3.StringUtils.isNotBlank(patientName)){
                    order.setName(patientName);
                    orderSetName.add(order);
                }
            }
            Map<String, Object> map = new HashMap<>();
            DmHospitalDO dmHospitalDO = hospitalDao.findByCode(order.getBelongCommunity());
            if (!mediicinedevice.getBelongCommunity().equals(order.getBelongCommunity())) {
@ -2468,7 +2511,9 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
            }
            orderList.add(map);
        }
        if (orderSetName.size()>0){
            orderDao.save(orderSetName);
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("orderList", orderList);
@ -2782,4 +2827,28 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        }
        return list;
    }
    @Transactional(rollbackFor = Exception.class)
    public JSONObject reviewerOrder(String orderId,Integer reviewerState,String reviewerContent) {
        JSONObject result = new JSONObject();
        Mediicineorder mediicineorder = orderDao.findOne(orderId);
        if (null == mediicineorder) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "审方订单不存在");
            return result;
        }
        if (0!= mediicineorder.getReviewerState()) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "该订单已审核过,无需重复审核");
            return result;
        }
        mediicineorder.setReviewerState(reviewerState);
        if (org.apache.commons.lang3.StringUtils.isNotBlank(reviewerContent)) {
            mediicineorder.setReviewerContent(reviewerContent);
        }
        orderDao.save(mediicineorder);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, mediicineorder);
        return result;
    }
}

+ 76 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineUserService.java

@ -432,6 +432,82 @@ public class MedicineUserService extends BaseJpaService<Mediicineuser, Mediicine
        return result;
    }
    public JSONObject bottomMenu(String userId) throws Exception {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(userId)) {
            result.put("msg", "userId is empty");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        UserDO user = userDao.findOne(userId);
        RoleDO role = roleDao.findOne(user.getRoleId());
        if (role==null){
            throw new Exception("角色为空!");
        }
        String belongCommunitys = "";
        String sql = "";
        String conditionSql = "";
        //获取社区code,串
        {
            //市管理员
            if ("saasAdmin".equals(role.getCode())) {
                sql = "SELECT\n" +
                        "\t`code`\tas community\n" +
                        "FROM\n" +
                        "\tdm_hospital\n" +
                        "WHERE\n" +
                        "\tdel = 1";
            }
            //区域管理员
            if ("regionAdmin".equals(role.getCode())) {
                sql = "SELECT\n" +
                        "\tdh.`code` AS community\n" +
                        "FROM\n" +
                        "\twlyy_user_area t\n" +
                        "LEFT JOIN dm_hospital dh ON t.town = dh.town\n" +
                        "WHERE\n" +
                        "\tt.user_id = '" + userId + "'\n" +
                        "AND t.del = 1\n" +
                        "AND dh.del = 1";
            }
            //社区管理员
            if ("communityAdmin".equals(role.getCode()) || "replenisher".equals(role.getCode())) {
                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);
            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();
                    }
                }
            }
        }
        if (!StringUtils.isEmpty(belongCommunitys)) {
            conditionSql += " and '," + belongCommunitys + ",' LIKE CONCAT('%,',t.belong_community,',%')\n";
        }
        String notReviewCountSql = " select " +
                "     COUNT(DISTINCT (t.id)) as count " +
                "   from " +
                "     t_mediicine_order t " +
                "  where " +
                "  1=1 and t.reviewer_state = 0 " +
                conditionSql;
        Logger.getAnonymousLogger().info("finalCountSql=" + notReviewCountSql);
        int count = jdbcTemplate.queryForObject(notReviewCountSql, Integer.class);
        result.put("notReviewCount",count);
        return result;
    }
}