Browse Source

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

trick9191 7 years ago
parent
commit
ea84b5e4f0

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -31,7 +31,7 @@ public class CallService extends IdEntity {
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3.预约失败
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -31,7 +31,7 @@ public class CallService extends IdEntity {
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3预约失败
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code

+ 20 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.manager.account;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.MessageDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.UserDao;
@ -56,6 +57,8 @@ public class CustomerService extends BaseService{
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private MessageDao messageDao;
	@Autowired
	private DoctorDao doctorDao;
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	private String messageApi;
@ -408,11 +411,18 @@ public class CustomerService extends BaseService{
		callService.setUser(user);
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		//存储患者信息
		Patient p = patientDao.findByCode(callService.getCode());
		callService.setIdcard(p.getIdcard());
		callService.setSsc(p.getSsc());
		//存储医生
		SignFamily sf = familyService.findByPatientCode(callService.getPatient());
		callService.setAdminTeamCode(sf.getAdminTeamId());
		callService.setCreateTime(new Date());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
			// 添加签约消息
			Message message = new Message();
			message.setCzrq(new Date());
@ -429,7 +439,7 @@ public class CustomerService extends BaseService{
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			message.setDel("1");
			messageDao.save(message);
		}
@ -451,7 +461,12 @@ public class CustomerService extends BaseService{
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCreateTime(new Date());
			message.setContent("您有一条新的协同服务消息!");
			if("1".equals(callService.getType())){
				message.setContent(u.getName()+"需要预约挂号");
			}else{
				message.setContent(u.getName()+"发起咨询");
			}
			message.setRead(1);//设置未读
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setSender(callService.getPatient());//设置发送的用户
@ -463,6 +478,7 @@ public class CustomerService extends BaseService{
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			message.setDel("1");
			messageDao.save(message);
		}
@ -527,7 +543,7 @@ public class CustomerService extends BaseService{
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
		}
		if(serverType!=null){
			sql += " AND s.server_type ='"+serverType+"' " ;
			sql += " AND s.type ='"+serverType+"' " ;
		}
		if(state != null){
			sql +=" AND s.state ='"+state+"'";

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

@ -62,7 +62,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type in (6,7) order by a.createTime desc")
    List<Message> getSysTemMessageByPrescription(String doctor, String prescriptionStatus);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7)")
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12)")
    List<Message> getSystemMessage(String doctor, Pageable pageRequest);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 and a.prescriptionStatus='0' ")
@ -98,9 +98,12 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 8 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    Message findByRelationCode(String relationCode);
    @Query("from Message a where a.type = 12 and a.state=0 and a.del='1' and a.over='0' and receiver = ?1  ")
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and receiver = ?1  ")
    List<Message> findByReceiverCallService(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 ")
    List<Message> getMessageByType(String doctor, Integer type, Pageable pageRequest);
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and relationCode = ?1  ")
    List<Message> findByCallServiceRelationCode(String relationCode);
}

+ 25 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -10,8 +10,11 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import org.apache.commons.collections.map.HashedMap;
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.jdbc.core.JdbcTemplate;
@ -27,6 +30,8 @@ import java.util.*;
@Service
@Transactional
public class PrescriptionExpressageService extends BaseService {
    private Logger logger = LoggerFactory.getLogger(ElasticsearchUtil.class);
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
@ -559,23 +564,28 @@ public class PrescriptionExpressageService extends BaseService {
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            prescriptionLogDao.save(prescriptionLog);
            //更新二维码(isUse)
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
            if(prescriptionDispensaryCode!=null){
                //修改取药码code为已经使用
                prescriptionDispensaryCode.setIsUse(1);
                prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
            try {
                //更新二维码(isUse)
                PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
                if(prescriptionDispensaryCode!=null){
                    //修改取药码code为已经使用
                    prescriptionDispensaryCode.setIsUse(1);
                    prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
                    //更新配送信息
                    PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                    if(prescriptionExpressage!=null){
                        prescriptionExpressage.setHospitalDoctor(doctor);
                        prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                        prescriptionExpressage.setFetchingMedicineTime(new Date());
                        prescriptionExpressageDao.save(prescriptionExpressage);
                    }
                }
            }catch (Exception e){
                logger.info("更新二维码(isUse),更新配送信息 异常:"+e.getMessage());
            }
            //更新配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            if(prescriptionExpressage!=null){
                prescriptionExpressage.setHospitalDoctor(doctor);
                prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                prescriptionExpressage.setFetchingMedicineTime(new Date());
                prescriptionExpressageDao.save(prescriptionExpressage);
            }
            return "1";
        }
        return "0";

+ 27 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.call;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.message.Message;
@ -46,13 +47,12 @@ public class CustomerService extends BaseService{
				" s.create_time AS createTime, " +
				" s.user, " +
				" s.user_name AS userName ," +
				" s.create_Time AS createTime ," +
				" p.sex," +
				" p.photo," +
				" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age" +
				" FROM " +
				" manage_call_service s " +
				" LEFT JOIN wlyy_patient p ON s.code = s.patient" +
				" LEFT JOIN wlyy_patient p ON p.code = s.patient" +
				" WHERE " +
				" s.state >0 ";
		if(StringUtils.isNotBlank(keyword)){
@ -116,6 +116,13 @@ public class CustomerService extends BaseService{
		CallService callService = callServiceDao.findByCode(code);
		CallRecord callRecord = callRecordDao.findByCode(callService.getCallCode());
		Map<String,Object> rs = new HashedMap();
		String id = callRecord.getIdcard();
		if(StringUtils.isNotBlank(id)){
			String idCard = id.substring(0,id.length()-10)+"*******"+id.substring(id.length()-2,id.length());
			callRecord.setIdcard(idCard);
			callService.setIdcard(idCard);
		}
		rs.put("callService",callService);
		rs.put("callRecord",callRecord);
		return rs;
@ -129,6 +136,15 @@ public class CustomerService extends BaseService{
		 callService.setDealTime(new Date());
		 callService.setState(2);
		 callServiceDao.save(callService);
		List<Message> mes = messageDao.findByCallServiceRelationCode(code);
		if(mes!=null&&mes.size()>0){
			for(Message m :mes){
				m.setOver("0");
				m.setRead(0);
				messageDao.save(m);
			}
		}
		return "1";
	}
@ -168,6 +184,15 @@ public class CustomerService extends BaseService{
			cs.setDealContent(dealContent);
		}
		callServiceDao.save(cs);
		List<Message> mes = messageDao.findByCallServiceRelationCode(code);
		if(mes!=null&&mes.size()>0){
			for(Message m :mes){
				m.setOver("0");
				m.setRead(0);
				messageDao.save(m);
			}
		}
		return "1";
	}
}

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java

@ -16,6 +16,7 @@ import org.springframework.util.ReflectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
@ApiResponses(value = {
@ -255,10 +256,12 @@ public class BaseController {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, list);
            return mapper.writeValueAsString(map);
            String s = mapper.writeValueAsString(map);
            return s;
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java

@ -40,6 +40,7 @@ public class CallRecordController extends BaseController {
                                  @ApiParam(name="page",value="第几页,从1开始")@RequestParam(required = true)Integer page,
                                  @ApiParam(name="size",value="每页大小")@RequestParam(required = true)Integer size){
        try {
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctorName, code,adminTeamCode,startDate, endDate, page, size));
        }catch (Exception e){
            error(e);