Procházet zdrojové kódy

Merge branch 'dev' of yeshijie/patient-co-management into dev

trick9191 před 7 roky
rodič
revize
5ced11844f

+ 4 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/redis/RedisThread.java

@ -95,8 +95,10 @@ public class RedisThread implements Runnable {
            }else if("wechat".equals(title)){
                String data = json.getString("value");
                pushMsgTask.getQueue().put(new org.json.JSONObject(data));
            }else{
            }else if("adjustPrescription".equals(title)){
                //线下调整处方完成
                String prescriptionCode = json.getString("prescription");
                prescriptionService.setPrescriptionInfo(prescriptionCode);
            }
        }catch (Exception e){
            logger.error("redis_error...",e);

+ 31 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.message.MessageDao;
@ -18,16 +19,19 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.MessageType;
import net.sf.json.JSONArray;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * Created by chenweida on 2017/7/27.
@ -56,7 +60,8 @@ public class PrescriptionService extends BaseService {
    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private DoctorTeamDao doctorTeamDao;
    @Autowired
@ -97,6 +102,31 @@ public class PrescriptionService extends BaseService {
        }
    }
    /**
     * 设置处方redis药品信息
     * @param prescriptionCode
     * @return
     */
    public boolean setPrescriptionInfo(String prescriptionCode){
        try {
            if(!StringUtils.isEmpty(prescriptionCode))
            {
                //判断该续方的药品信息redis是否存在
                String key = "prescription:"+prescriptionCode+":drugInfo";
                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
                if(list!=null&&list.size()>0){
                    String re = JSONArray.fromObject(list).toString();
                    redisTemplate.opsForValue().set(key,re,180, TimeUnit.DAYS);
                }
            }
        }
        catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
        return true;
    }
    /**
     * 配药完成
     * @param code