Jelajahi Sumber

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

huangwenjie 7 tahun lalu
induk
melakukan
562ba243b5

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/service/ServiceItem.java

@ -16,6 +16,7 @@ public class ServiceItem extends IdEntity {
    private String code; //非业务主键
    private String serviceCode;// 所属服务code 关联表 wlyy_Service
    private String name;       //	服务名称
    private String subName;//副标题
    private String image;   //图片的url
    private Integer type;   // 服务类型 1 热线电话 2 中医体检
    private String mobile;  //服务项对应的热线电话
@ -148,4 +149,12 @@ public class ServiceItem extends IdEntity {
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getSubName() {
        return subName;
    }
    public void setSubName(String subName) {
        this.subName = subName;
    }
}

+ 32 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -0,0 +1,32 @@
package com.yihu.wlyy.event;
import com.yihu.wlyy.redis.RedisThread;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Service;
/**
 * Created by lyr-pc on 2017/3/10.
 */
@Service
public class ApplicationEvent implements ApplicationListener<ContextRefreshedEvent> {
    private Logger logger = LoggerFactory.getLogger(ApplicationEvent.class);
    @Autowired
    private RedisThread redisThread;
    @Override
    public void onApplicationEvent(ContextRefreshedEvent ContextRefreshedEvent) {
        try {
            // 启动redis 消息队列线程
            logger.info("redis message start");
            new Thread(redisThread).start();
            logger.info("redis message end");
        } catch (Exception e) {
            logger.info("redis message start failed");
        }
    }
}

+ 23 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/redis/RedisThread.java

@ -1,10 +1,12 @@
package com.yihu.wlyy.redis;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
/**
 * Created by Trick on 2017/8/7.
@ -16,9 +18,27 @@ public class RedisThread implements Runnable {
    private String url;
    @Autowired
    private RedisMsgPubSubListener redisMsgPubSubListener;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PrescriptionService prescriptionService;
    @Override
    public void run() {
        Jedis jedis = new Jedis(url);
        jedis.subscribe(redisMsgPubSubListener, SystemConf.getInstance().getSystemProperties().getProperty("redis_prescription_title"));
        String key = SystemConf.getInstance().getSystemProperties().getProperty("redis_prescription_title");
        while (true){
            redisTemplate.watch(key);
            String message = redisTemplate.opsForList().rightPop(key);
            redisTemplate.unwatch();
            if(StringUtils.isEmpty(message)){
                try{
                    Thread.sleep(1000L);//如果没有读取到记录,等待1秒
                }catch (Exception e){
                    e.printStackTrace();
                }
            }else {
                prescriptionService.redisMessage(message);
            }
        }
    }
}

+ 7 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -88,6 +88,8 @@ public class PrescriptionInfoService extends BaseService {
    private static final String tnb = "HP0047";
    @Autowired
    private PrescriptionExpressageService expressageService;
    @Autowired
    private PrescriptionService prescriptionService;
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@ -305,7 +307,7 @@ public class PrescriptionInfoService extends BaseService {
        }
        if (prescription != null && prescription.getStatus() == 10) {
        if (prescription != null && prescription.getStatus() == PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue()) {
            Long s = (prescription.getCreateTime().getTime() - new Date().getTime()) / 1000;
            //rs.put("time",s);
            if (s > 172800) {
@ -385,6 +387,9 @@ public class PrescriptionInfoService extends BaseService {
                //审核通过模板消息
                sendRMess(code, 1);
                //获取智业待结算接口,更新药品金额
                prescriptionService.getPerscriptionInfoCostFromPayInfo(p.getCode());
                return 1;
            } else {
                p.setStatus(PrescriptionLog.PrescriptionLogStatus.add_error.getValue());
@ -525,7 +530,7 @@ public class PrescriptionInfoService extends BaseService {
                reviewed.setStatus(PrescriptionReviewed.PrescriptionReviewedStatus.del.getValue());
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(code, "2", 6);
                messageDao.updatePreScriptionMessage(p.getConsult(), "2", 6);
                //审核不用过发送消息
                //发送Im消息

+ 20 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -76,6 +76,26 @@ public class PrescriptionService extends BaseService {
        return prescriptionDao.findByCode(prescriptionCode);
    }
    /**
     * redis 消息队列
     * @param message
     */
    public void redisMessage(String message){
        logger.info("redis_onMessage...:"+message);
        //this.unsubscribe();
        try{
            JSONObject json = JSONObject.parseObject(message);
            String title =  json.getString("title");
            if("dispensingComplete".equals(title)){//配药完成
                //药品配送完成,提醒取药
                String prescriptionCode = json.getString("prescription");
                dispensingComplete(prescriptionCode);
            }
        }catch (Exception e){
            logger.error("redis_error...",e);
        }
    }
    /**
     * 配药完成
     * @param code

+ 0 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -124,11 +124,6 @@ public class JwPrescriptionService {
     * @throws Exception
     */
    public String saveRecipe(String prescriptionCode) throws Exception{
        try {
        }catch (Exception e){
        }
        String url = jwUrl + "/third/prescription/saveRecipe";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));

+ 8 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -93,22 +93,24 @@ public class ZyDictService {
     * @return
     */
    public List<Map<String, Object>> findDictByDoctorAndName(String doctor,String name){
        String sql = "SELECT " +
                " yp.physic_code drugCode, " +
        String sql = "SELECT  yp.physic_code drugCode, " +
                " yp.physic_name drugName, " +
                " yp.physic_spec drugFormat, " +
                " yp.subject_class subjectClass, " +
                " yp.pack_unit packUnit, " +
                " com3.`name` packUnitName, " +
                " yp.min_dose minDose, " +
                " yp.pack_spec pakeSpec, " +
                " class.class_name className, " +
                " yp.dose_unit physicDoseUnit, " +
                " com1.`name` physicDoseUnitName, " +
                " yp.quantity_unit drugNumUnit, " +
                " com2.`name` drugNumUnitName " +
                " com2.`name` drugNumUnitName, " +
                " yp.retail_price retailPrice " +
                " FROM " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com2, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com3, " +
                "  zy_iv_subject_class_dict class,  " +
                "  (  " +
                "    SELECT  " +
@ -120,7 +122,8 @@ public class ZyDictService {
                "   p.quantity_unit, " +
                "   p.pack_unit, " +
                "   p.min_dose, " +
                "   p.pack_spec " +
                "   p.pack_spec," +
                "   p.retail_price " +
                "    FROM  " +
                "   zy_iv_physic_dict p, " +
                "  ( " +
@ -147,6 +150,7 @@ public class ZyDictService {
                "WHERE " +
                " com1.`code` = yp.dose_unit " +
                " AND com2.`code` = yp.quantity_unit " +
                " AND com3.`code` = yp.pack_unit " +
                " AND class.class_code = yp.subject_class";
//        subjectClass
//        drugNumUnit":"224","drugNumUnitName":"支",

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java

@ -27,7 +27,7 @@ public class PrescriptionExpressagePCController extends BaseController {
    public String getMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try{
            JSONObject jSONObject = prescriptionExpressagePCService.getMedicine(code,getRepUID());
            JSONObject jSONObject = prescriptionExpressagePCService.getMedicine(code,getUID());
//            jSONObject.toString().replace("\\","");
            return write(200, "获取信息成功!", "data", jSONObject);
        }catch (Exception e) {
@ -41,7 +41,7 @@ public class PrescriptionExpressagePCController extends BaseController {
    public String fetchingMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try {
            prescriptionExpressagePCService.fetchingMedicine(code, getRepUID());
            prescriptionExpressagePCService.fetchingMedicine(code, getUID());
            return write(200, "更改成功!");
        }catch (Exception e) {
            error(e);