Jelajahi Sumber

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

yeshijie 7 tahun lalu
induk
melakukan
df5622c3c3

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

@ -2785,4 +2785,48 @@ public class ConsultTeamService extends ConsultService {
        return json;
    }
    /**
     * 返回json
     * @param sessionType
     * @param content
     * @return
     */
    public String getMessageById(String sessionType,String content,String title){
        com.alibaba.fastjson.JSONObject re = new com.alibaba.fastjson.JSONObject();
        re.put("title",title);
        content = "'"+content.replace(",","','")+"'";
        String tableName = "";
        switch (sessionType){
            case "1":
            case "8":
                tableName = "muc_messages";
                break;
            case "2":
                tableName = "p2p_messages";
                break;
            default:
                tableName = "group_messages";
                break;
        }
        String sql = "select id, session_id, sender_id, sender_name, content_type, content, timestamp from " + imdb+"."+
                tableName + " where id in("+content+") order by timestamp desc ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
        for(int i=0;i<list.size();i++){
            Map<String,Object> map = list.get(i);
            com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
            json.put("id",map.get("id"));
            json.put("session_id",map.get("session_id"));
            json.put("sender_id",map.get("sender_id"));
            json.put("sender_name",map.get("sender_name"));
            json.put("content_type",map.get("content_type"));
            json.put("content",map.get("content"));
            json.put("timestamp",map.get("timestamp"));
            ja.add(json);
        }
        re.put("list",ja);
        return re.toString();
    }
}

+ 42 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -17,6 +17,48 @@ public class ImUtill {
    @Value("${im.im_list_get}")
    private String im_host;
    public enum ContentType {
        plainText("信息", "1"),
        image("图片信息", "2"),
        audio("创建处方", "3"),
        article("文章信息", "4"),
        goTo("跳转信息,求组其他医生或者邀请其他医生发送的推送消息", "5"),
        topicBegin("议题开始", "6"),
        topicEnd("议题结束", "7"),
        personalCard("个人名片", "18"),
        messageForward("消息转发", "19"),
        topicInto("进入议题", "14"),
        video("视频", "12"),
        system("系统消息", "13"),
        prescriptionCheck("续方审核消息消息", "15"),
        prescriptionBloodStatus("续方咨询血糖血压咨询消息", "16"),
        prescriptionFollowupContent("续方咨询随访问卷消息", "17");
        private String name;
        private String value;
        ContentType(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    /**
     * 获取医生统计数据
     * status reply 为空值是是该医生总咨询量

+ 64 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -8,9 +8,11 @@ import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroupMember;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyServer;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyServerDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
@ -34,11 +36,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -48,7 +46,7 @@ import java.util.Map;
 *
 * @author George
 */
@Controller
@RestController
@RequestMapping(value = "/doctor/consult", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "三师咨询")
public class DoctorConsultController extends WeixinBaseController {
@ -70,7 +68,7 @@ public class DoctorConsultController extends WeixinBaseController {
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private ImUtill ImUtill;
    private ImUtill imUtill;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
@ -83,6 +81,8 @@ public class DoctorConsultController extends WeixinBaseController {
    private PrescriptionDiagnosisService prescriptionDiagnosisService;
    @Autowired
    private FollowUpService followUpService;
    @Autowired
    private SignFamilyDao signFamilyDao;
    /**
     * 三师咨询列表查询
@ -1113,7 +1113,7 @@ public class DoctorConsultController extends WeixinBaseController {
            if (consultModel == null) {
                return error(-1, "咨询记录不存在!");
            }
            JSONObject messageObj = ImUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getUID());
            JSONObject messageObj = imUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getUID());
            return write(200, "查询成功", "list", messageObj);
        } catch (Exception e) {
            error(e);
@ -1215,4 +1215,60 @@ public class DoctorConsultController extends WeixinBaseController {
            return error(-1,"获取失败");
        }
    }
    @RequestMapping(value = "sendBusinessCard",method = RequestMethod.POST)
    @ApiOperation("发送居民的名片")
    public String sendBusinessCard(@ApiParam(name = "patient", value = "居民code", defaultValue = "")
                                   @RequestParam(value = "patient", required = true) String patient,
                                   @ApiParam(name = "sessionId", value = "会话id", defaultValue = "")
                                   @RequestParam(value = "sessionId", required = true) String sessionId,
                                   @ApiParam(name = "businessType", value = "businessType", defaultValue = "1")
                                   @RequestParam(value = "businessType", required = true) String businessType){
        try {
            String doctorCode = getUID();
            Doctor doctor = doctorService.findDoctorByCode(doctorCode);
            Patient p = patientService.findByCode(patient);
            com.alibaba.fastjson.JSONObject content = new com.alibaba.fastjson.JSONObject();
            content.put("name",p.getName());
            content.put("patient",patient);
            content.put("photo",p.getPhoto());
            content.put("age",IdCardUtil.getAgeForIdcard(p.getIdcard()));
            content.put("sex",IdCardUtil.getSexForIdcard(p.getIdcard()));
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily!=null){
                content.put("hospitalName",signFamily.getHospitalName());
            }
            imUtill.sendImMsg(doctorCode,doctor.getName(),sessionId,ImUtill.ContentType.personalCard.getValue(),content.toString(),businessType);
            return success("发送成功");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"发送失败");
        }
    }
    @RequestMapping(value = "messageForward",method = RequestMethod.POST)
    @ApiOperation("请求转发消息")
    public String messageForward(@ApiParam(name = "senderId", value = "发送者id", defaultValue = "")
                                     @RequestParam(value = "senderId", required = true) String senderId,
                                 @ApiParam(name = "senderName", value = "发送者姓名", defaultValue = "")
                                     @RequestParam(value = "senderName", required = true) String senderName,
                                 @ApiParam(name = "sessionId", value = "会话id", defaultValue = "")
                                     @RequestParam(value = "sessionId", required = true) String sessionId,
                                 @ApiParam(name = "content", value = "会话内容", defaultValue = "")
                                     @RequestParam(value = "content", required = true) String content,
                                 @ApiParam(name = "title", value = "会话标题", defaultValue = "")
                                     @RequestParam(value = "title", required = true) String title,
                                 @ApiParam(name = "sessionType", value = "原会话的会话类型", defaultValue = "")
                                     @RequestParam(value = "sessionType", required = true) String sessionType,
                                 @ApiParam(name = "businessType", value = "businessType", defaultValue = "1")
                                     @RequestParam(value = "businessType", required = true) String businessType){
        try{
            String message = consultTeamService.getMessageById(sessionType,content,title);
            imUtill.sendImMsg(senderId,senderName,sessionId,ImUtill.ContentType.messageForward.getValue(),message,businessType);
            return success("发送成功");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"发送失败");
        }
    }
}