yeshijie преди 7 години
родител
ревизия
d8c9913720

+ 4 - 4
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -119,12 +119,12 @@ public class PrescriptionController extends BaseController{
	@RequestMapping(value = "getRecipeTemplate",method = RequestMethod.POST)
	@ApiOperation("处方模板获取接口")
	public Result getRecipeTemplate(@ApiParam(name="deptCode",value="科室编码",defaultValue = "")
	public Result getRecipeTemplate(@ApiParam(name="deptCode",value="科室编码",defaultValue = "5")
									@RequestParam(value = "deptCode",required = true) String deptCode,
									@ApiParam(name="staffCode",value="人员code",defaultValue = "")
									@ApiParam(name="staffCode",value="人员code",defaultValue = "7")
									@RequestParam(value = "staffCode",required = true) String staffCode,
									@ApiParam(name="hospital",value="医院code",defaultValue = "3501111")
									@RequestParam(value = "hospital",required = true) String hospital)
									@ApiParam(name="hospital",value="医院code",defaultValue = "")
									@RequestParam(value = "hospital",required = false) String hospital)
	{
		try {

+ 3 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDao.java

@ -24,4 +24,7 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query("from Prescription p where p.visitNo=?1")
    Prescription findByVisitNo(String visitNo);
    @Query("from Prescription p where p.visitNo=?1 and p.recipeNo=?2")
    Prescription findByVisitNoAndRecipeNo(String visitNo,String recipeNo);
}

Файловите разлики са ограничени, защото са твърде много
+ 67 - 6
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Message.java


+ 11 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -236,11 +236,18 @@ public class PrescriptionService extends ZysoftBaseService{
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
                    prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    prescriptionDao.save(prescription);
                }
                //判断健管师配送要添加续方消息,提示健管师有续方代配送
                JSONObject message = new JSONObject();
                message.put("title","dispensingComplete");
                message.put("state",1);
                message.put("prescription","fd3b137cd907456dbcc5b11ecd701741");
                message.put("prescription",prescription.getCode());
//                message.put("mes","预结算完成完成");
                message.put("mes","success");
                redisTemplate.convertAndSend(channelTopic,message.toString());
@ -322,6 +329,9 @@ public class PrescriptionService extends ZysoftBaseService{
        return response;
    }
//    public String getDictForI
    /**
     * 7.2 处方模板获取接口
     * @param staffCode 员工编码

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -988,7 +988,7 @@ public class ConsultTeamService extends ConsultService {
        message.setSex(patient.getSex());
        message.setSenderName(patient.getName());
        message.setSenderPhoto(patient.getPhoto());
        message.setTitle("续方申请");
        message.setTitle(patient.getName()+"申请续方");
        message.setContent("您有一条新的续方申请待处理!");
        message.setType(6);//续方咨询待审核提醒
        message.setReadonly(1);//是否只读消息

Файловите разлики са ограничени, защото са твърде много
+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -55,8 +55,8 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.read=?2 and a.type=?3 order by a.createTime desc")
    List<Message> getSysTemMessageByTypeAndRead(String doctor, Integer read, Integer type);
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type=?3 order by a.createTime desc")
    List<Message> getSysTemMessageByType(String doctor, String prescriptionStatus, Integer type);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6)")
    List<Message> getSystemMessage(String doctor,Pageable pageRequest);

+ 4 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -968,7 +968,7 @@ public class ConsultTeamService extends ConsultService {
            consultTeamDoctorDao.save(cd);
            //7、发送系统消息提示团队长有未审核的消息
            addCheckMessage(prescription,p);
            addCheckMessage(prescription);
            //8、 保存医生咨询信息
            // 添加咨询转发记录
@ -982,20 +982,17 @@ public class ConsultTeamService extends ConsultService {
    /**
     * 保存审核提醒消息
     * @param prescription
     * @param patient
     */
    public void addCheckMessage(Prescription prescription,Patient patient){
    public void addCheckMessage(Prescription prescription){
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setRead(1);//设置未读
        message.setOver("1");
        message.setReceiver(prescription.getDoctor());
        message.setSender(prescription.getPatient());
        message.setSender("system");
        message.setCode(getCode());
        message.setSex(patient.getSex());
        message.setSenderName(patient.getName());
        message.setSenderPhoto(patient.getPhoto());
        message.setSenderName("系统");
        message.setTitle("续方申请");
        message.setContent("您有一条新的续方申请待处理!");
        message.setType(6);//续方咨询待审核提醒

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -152,7 +152,7 @@ public class MessageService extends BaseService {
        }
        //获取续方消息
        List<Message> prescriptionMessage = messageDao.getSysTemMessageByTypeAndRead(doctor,1,6);
        List<Message> prescriptionMessage = messageDao.getSysTemMessageByType(doctor,"0",6);
        JSONObject prescriptionJson = new JSONObject();
        if (prescriptionMessage != null && prescriptionMessage.size() > 0) {
            prescriptionJson.put("amount", prescriptionMessage.size());

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

@ -2,20 +2,46 @@ package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.PrescriptionLog;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.MessageType;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
 * Created by chenweida on 2017/7/27.
 */
@Service
public class PrescriptionService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(PrescriptionService.class);
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionNoticesService prescriptionNoticesService;
    @Autowired
    private PatientDao patientDao;
    /**
     *  获取处方信息
@ -31,11 +57,45 @@ public class PrescriptionService extends BaseService {
     * @param code
     */
    public void dispensingComplete(String code){
        logger.info("配药完成,提示居民或健管师取药:"+code);
        Prescription prescription = prescriptionDao.findByCode(code);
        if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue())){//等待领药
            if(prescription.getDispensaryType()==1){
                //自取
                Patient patient = patientDao.findByCode(prescription.getPatient());
                try {
                    prescriptionNoticesService.sendMessages(patient.getCode(), patient.getName(), null, null, 2, 0, "");
                }catch (Exception e){
                    logger.info("微信模板发送失败,续方code"+code);
                }
            }else if(prescription.getDispensaryType()==3){
                //健管师配送
                PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(code);
                if(StringUtils.isEmpty(expressage.getExpressageCode())){
                    String content = "您有一条新的续方订单待取药!";
                    Message message = new Message();
                    message.setCzrq(new Date());
                    message.setCreateTime(new Date());
                    message.setRead(1);//设置未读
                    message.setOver("1");
                    message.setReceiver(expressage.getExpressageCode());
                    message.setSender("system");
                    message.setCode(getCode());
                    message.setSenderName("系统");
                    message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                    message.setContent("您有一条新的续方订单待取药!");
                    message.setType(7);//续方订单待取药
                    message.setReadonly(1);//是否只读消息
                    message.setDel("1");
                    message.setRelationCode(prescription.getCode());
                    message.setPrescriptionStatus("0");//待取药
                    messageDao.save(message);
                    pushMsgTask.put(expressage.getExpressageCode(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.D_P_WRD.name(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.续方消息.name(), content, prescription.getCode());
                }
            }
        }
        logger.info("配药完成,提示居民或健管师取药:"+code+",status="+prescription.getStatus());
    }
    /**

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java

@ -173,4 +173,8 @@ public class MessageType {
		D_HI_01, 体征指标
	};
	public static enum MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG{
		D_P_WRD, 续方消息, 待取药
	}
}