|
@ -69,950 +69,924 @@ import java.util.*;
|
|
|
@Api(value = "居民端咨询IM接口", description = "居民端咨询IM接口", tags = {"居民端咨询IM接口"})
|
|
|
public class PatientConsultEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(PatientConsultEndpoint.class);
|
|
|
|
|
|
@Autowired
|
|
|
private ImService imService;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionService prescriptionService;
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientService basePatientService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private WechatInfoService wechatInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private WechatDao wechatDao;
|
|
|
|
|
|
@Autowired
|
|
|
private HospitalSystemMessageService hospitalSystemMessageService;
|
|
|
|
|
|
@Autowired
|
|
|
private EnterpriseService enterpriseService;
|
|
|
|
|
|
@Autowired
|
|
|
private WlyyBusinessService wlyyBusinessService;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
|
|
|
@Autowired
|
|
|
FileUploadService fileUploadService;
|
|
|
@Autowired
|
|
|
private BaseDoctorInfoService doctorInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private BusinessOrderService businessOrderService;
|
|
|
|
|
|
@Autowired
|
|
|
private SystemMessageService systemMessageService;
|
|
|
|
|
|
@Autowired
|
|
|
private ConsultDao consultDao;
|
|
|
@Autowired
|
|
|
private YkyyService ykyyService;
|
|
|
@Autowired
|
|
|
private BaseDoctorRoleDao doctorRoleDao;
|
|
|
|
|
|
@Autowired
|
|
|
public ImUtil imUtil;
|
|
|
@Autowired
|
|
|
private OutpatientDao outpatientDao;
|
|
|
@Autowired
|
|
|
private YlzPayService ylzPayService;
|
|
|
@Autowired
|
|
|
private PatientMappingDao patientMappingDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
@Autowired
|
|
|
private EntranceService entranceService;
|
|
|
@Autowired
|
|
|
private WlyyFamilyMemberService familyMemberService;
|
|
|
|
|
|
|
|
|
@Value("${fastDFS.fastdfs_file_url}")
|
|
|
private String fastdfs_file_url;
|
|
|
|
|
|
@Value("${wlyy.url}")
|
|
|
private String wlyyUrl;
|
|
|
|
|
|
@Value("${qywx.url}")
|
|
|
private String qywxUrl;
|
|
|
|
|
|
@Value("${qywx.id}")
|
|
|
private String qywxId;
|
|
|
|
|
|
@Value("${wechat.id}")
|
|
|
private String wxId;
|
|
|
|
|
|
@Value("${pay.flag}")
|
|
|
private boolean payFlag;
|
|
|
|
|
|
@Value("${testPattern.remote_inner_url}")
|
|
|
private String remote_inner_url;
|
|
|
@Autowired
|
|
|
private RobotService robotService;
|
|
|
@Autowired
|
|
|
private FileUtil fileUtil;
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
|
|
|
@ApiOperation(value = "患者咨询记录查询")
|
|
|
public Envelop records(
|
|
|
@ApiParam(name = "patient", value = "居民id")
|
|
|
@RequestParam(value = "patient",required = true) String patient,
|
|
|
@ApiParam(name = "doctorId", value = "医生id",required = false)
|
|
|
@RequestParam(value = "doctorId",required = false) String doctorId,
|
|
|
@ApiParam(name = "title", value = "咨询标题关键字")
|
|
|
@RequestParam(value = "title",required = false) String title,
|
|
|
@ApiParam(name = "id", value = "咨询ID")
|
|
|
@RequestParam(value = "id",required = false) String id,
|
|
|
@ApiParam(name = "type", value = "咨询类型")
|
|
|
@RequestParam(value = "type",required = true) String type,
|
|
|
@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
|
|
|
@RequestParam(value = "status",required = false) Integer status,
|
|
|
@ApiParam(name = "payStatus", value = "支付状态0支付1已支付")
|
|
|
@RequestParam(value = "payStatus",required = false) Integer payStatus,
|
|
|
@ApiParam(name = "page", value = "第几页")
|
|
|
@RequestParam(value = "page",required = false) int page,
|
|
|
@ApiParam(name = "pagesize", value = "分页大小")
|
|
|
@RequestParam(value = "pagesize",required = false) int pagesize,
|
|
|
@ApiParam(name = "doctorName", value = "医生名字")
|
|
|
@RequestParam(value = "doctorName",required = false) String doctorName
|
|
|
){
|
|
|
try {
|
|
|
List<Map<String,Object>> data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,payStatus,doctorName,doctorId);
|
|
|
Long total = imService.countConsultRecordByPatient(patient, id,type,title,doctorId);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("total",total);
|
|
|
result.put("list",data);
|
|
|
return success(result);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedConsult)
|
|
|
@ApiOperation(value = "查询居民与某个医生是否存在未结束的专家咨询")
|
|
|
public Envelop isExistsUnfinishedConsult(
|
|
|
@ApiParam(name = "doctor", value = "医生CODE")
|
|
|
@RequestParam(value = "doctor",required = true) String doctor,
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient",required = true) String patient)throws Exception {
|
|
|
|
|
|
|
|
|
try {
|
|
|
if(StringUtils.isEmpty(patient)){
|
|
|
patient= getUID();
|
|
|
}
|
|
|
|
|
|
String consultCode = imService.getUnfinishedConsult(patient, doctor);
|
|
|
return success("请求成功",consultCode);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedOutpatient)
|
|
|
@ApiOperation(value = "查询居民与某个医生是否存在未结束的专家咨询")
|
|
|
public Envelop isExistsUnfinishedOutpatient(
|
|
|
@ApiParam(name = "doctor", value = "医生CODE")
|
|
|
@RequestParam(value = "doctor",required = true) String doctor,
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient",required = true) String patient)throws Exception {
|
|
|
|
|
|
|
|
|
try {
|
|
|
if(StringUtils.isEmpty(patient)){
|
|
|
patient= getUID();
|
|
|
}
|
|
|
|
|
|
String consultCode = imService.getUnfinishedConsult2(patient, doctor);
|
|
|
return success("请求成功",consultCode);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.participants)
|
|
|
@ApiOperation(value = "获取会话成员")
|
|
|
public ListEnvelop participants(
|
|
|
@ApiParam(name = "sessionId", value = "会话ID")
|
|
|
@RequestParam(value = "sessionId",required = true) String sessionId)throws Exception{
|
|
|
|
|
|
|
|
|
try {
|
|
|
JSONArray participants = imService.getSessions(sessionId);
|
|
|
return success(participants);
|
|
|
}catch (Exception e){
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getSessionMessage)
|
|
|
@ApiOperation(value = "根据会话ID获取消息记录")
|
|
|
public ListEnvelop getSessionMessage(
|
|
|
@ApiParam(name = "sessionId", value = "会话ID")
|
|
|
@RequestParam(value = "sessionId",required = true) String sessionId,
|
|
|
@ApiParam(name = "startMsgId", value = "开始的消息记录ID")
|
|
|
@RequestParam(value = "startMsgId",required = false) String startMsgId,
|
|
|
@ApiParam(name = "endMsgId", value = "结束的消息记录ID")
|
|
|
@RequestParam(value = "endMsgId",required = false) String endMsgId,
|
|
|
@ApiParam(name = "page", value = "第几页")
|
|
|
@RequestParam(value = "page",required = true) int page,
|
|
|
@ApiParam(name = "pagesize", value = "分页数")
|
|
|
@RequestParam(value = "pagesize",required = true) int pagesize)throws Exception{
|
|
|
|
|
|
try {
|
|
|
JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
|
|
|
return success(messageArray);
|
|
|
}catch (Exception e){
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.intoTopic)
|
|
|
@ApiOperation(value = "根据咨询CODE进入会话")
|
|
|
public Envelop intoTopic(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = true) String consult,
|
|
|
@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode",required = true) String patientCode
|
|
|
){
|
|
|
|
|
|
try {
|
|
|
int result = imService.intoTopic(consult,patientCode,"");
|
|
|
if(result==-1){
|
|
|
return failed("该咨询不是进行中");
|
|
|
}
|
|
|
return success("进入成功");
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.append)
|
|
|
@ApiOperation(value = "居民咨询发消息(追问接口)")
|
|
|
public ListEnvelop append(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = true) String consult,
|
|
|
@ApiParam(name = "content", value = "追问内容")
|
|
|
@RequestParam(value = "content",required = true) String content,
|
|
|
@ApiParam(name = "type", value = "追问内容类型:1文字,2图片,3语音 ... (im消息类型)")
|
|
|
@RequestParam(value = "type",required = true) Integer type,
|
|
|
@ApiParam(name = "times", value = "")
|
|
|
@RequestParam(value = "times",required = false) Integer times,
|
|
|
@ApiParam(name = "wechat_appid", value = "来源:xm_ihealth_wx厦门i健康,xm_zsyy_wx中山医院")
|
|
|
@RequestParam(value = "wechat_appid",required = false) String wechat_appid,
|
|
|
@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode",required = false) String patientCode) throws Exception {
|
|
|
|
|
|
try {
|
|
|
List<String> failed = new ArrayList<>();
|
|
|
|
|
|
//处理语音文件
|
|
|
if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
|
|
|
private static final Logger logger = LoggerFactory.getLogger(PatientConsultEndpoint.class);
|
|
|
|
|
|
@Autowired
|
|
|
private ImService imService;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionService prescriptionService;
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientService basePatientService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private WechatInfoService wechatInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private WechatDao wechatDao;
|
|
|
|
|
|
@Autowired
|
|
|
private HospitalSystemMessageService hospitalSystemMessageService;
|
|
|
|
|
|
@Autowired
|
|
|
private EnterpriseService enterpriseService;
|
|
|
|
|
|
@Autowired
|
|
|
private WlyyBusinessService wlyyBusinessService;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
|
|
|
@Autowired
|
|
|
FileUploadService fileUploadService;
|
|
|
@Autowired
|
|
|
private BaseDoctorInfoService doctorInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private BusinessOrderService businessOrderService;
|
|
|
|
|
|
@Autowired
|
|
|
private SystemMessageService systemMessageService;
|
|
|
|
|
|
@Autowired
|
|
|
private ConsultDao consultDao;
|
|
|
@Autowired
|
|
|
private YkyyService ykyyService;
|
|
|
@Autowired
|
|
|
private BaseDoctorRoleDao doctorRoleDao;
|
|
|
|
|
|
@Autowired
|
|
|
public ImUtil imUtil;
|
|
|
@Autowired
|
|
|
private OutpatientDao outpatientDao;
|
|
|
@Autowired
|
|
|
private YlzPayService ylzPayService;
|
|
|
@Autowired
|
|
|
private PatientMappingDao patientMappingDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
@Autowired
|
|
|
private EntranceService entranceService;
|
|
|
@Autowired
|
|
|
private WlyyFamilyMemberService familyMemberService;
|
|
|
|
|
|
|
|
|
@Value("${fastDFS.fastdfs_file_url}")
|
|
|
private String fastdfs_file_url;
|
|
|
|
|
|
@Value("${wlyy.url}")
|
|
|
private String wlyyUrl;
|
|
|
|
|
|
@Value("${qywx.url}")
|
|
|
private String qywxUrl;
|
|
|
|
|
|
@Value("${qywx.id}")
|
|
|
private String qywxId;
|
|
|
|
|
|
@Value("${wechat.id}")
|
|
|
private String wxId;
|
|
|
|
|
|
@Value("${pay.flag}")
|
|
|
private boolean payFlag;
|
|
|
|
|
|
@Value("${testPattern.remote_inner_url}")
|
|
|
private String remote_inner_url;
|
|
|
@Autowired
|
|
|
private RobotService robotService;
|
|
|
@Autowired
|
|
|
private FileUtil fileUtil;
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
|
|
|
@ApiOperation(value = "患者咨询记录查询")
|
|
|
public Envelop records(
|
|
|
@ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient,
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = false) @RequestParam(value = "doctorId", required = false) String doctorId,
|
|
|
@ApiParam(name = "title", value = "咨询标题关键字") @RequestParam(value = "title", required = false) String title,
|
|
|
@ApiParam(name = "id", value = "咨询ID") @RequestParam(value = "id", required = false) String id,
|
|
|
@ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) String type,
|
|
|
@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束") @RequestParam(value = "status", required = false) Integer status,
|
|
|
@ApiParam(name = "payStatus", value = "支付状态0支付1已支付") @RequestParam(value = "payStatus", required = false) Integer payStatus,
|
|
|
@ApiParam(name = "page", value = "第几页") @RequestParam(value = "page", required = false) int page,
|
|
|
@ApiParam(name = "pagesize", value = "分页大小") @RequestParam(value = "pagesize", required = false) int pagesize,
|
|
|
@ApiParam(name = "doctorName", value = "医生名字") @RequestParam(value = "doctorName", required = false) String doctorName
|
|
|
) {
|
|
|
try {
|
|
|
List<Map<String, Object>> data = imService.findConsultRecordByPatient(patient, id, type, page, pagesize, title, status, payStatus, doctorName, doctorId);
|
|
|
Long total = imService.countConsultRecordByPatient(patient, id, type, title, doctorId);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("total", total);
|
|
|
result.put("list", data);
|
|
|
return success(result);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedConsult)
|
|
|
@ApiOperation(value = "查询居民与某个医生是否存在未结束的专家咨询")
|
|
|
public Envelop isExistsUnfinishedConsult(
|
|
|
@ApiParam(name = "doctor", value = "医生CODE")
|
|
|
@RequestParam(value = "doctor", required = true) String doctor,
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient", required = true) String patient) throws Exception {
|
|
|
|
|
|
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(patient)) {
|
|
|
patient = getUID();
|
|
|
}
|
|
|
|
|
|
String consultCode = imService.getUnfinishedConsult(patient, doctor);
|
|
|
return success("请求成功", consultCode);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedOutpatient)
|
|
|
@ApiOperation(value = "查询居民与某个医生是否存在未结束的专家咨询")
|
|
|
public Envelop isExistsUnfinishedOutpatient(
|
|
|
@ApiParam(name = "doctor", value = "医生CODE")
|
|
|
@RequestParam(value = "doctor", required = true) String doctor,
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient", required = true) String patient) throws Exception {
|
|
|
|
|
|
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(patient)) {
|
|
|
patient = getUID();
|
|
|
}
|
|
|
|
|
|
String consultCode = imService.getUnfinishedConsult2(patient, doctor);
|
|
|
return success("请求成功", consultCode);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.participants)
|
|
|
@ApiOperation(value = "获取会话成员")
|
|
|
public ListEnvelop participants(
|
|
|
@ApiParam(name = "sessionId", value = "会话ID")
|
|
|
@RequestParam(value = "sessionId", required = true) String sessionId) throws Exception {
|
|
|
|
|
|
|
|
|
try {
|
|
|
JSONArray participants = imService.getSessions(sessionId);
|
|
|
return success(participants);
|
|
|
} catch (Exception e) {
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getSessionMessage)
|
|
|
@ApiOperation(value = "根据会话ID获取消息记录")
|
|
|
public ListEnvelop getSessionMessage(
|
|
|
@ApiParam(name = "sessionId", value = "会话ID")
|
|
|
@RequestParam(value = "sessionId", required = true) String sessionId,
|
|
|
@ApiParam(name = "startMsgId", value = "开始的消息记录ID")
|
|
|
@RequestParam(value = "startMsgId", required = false) String startMsgId,
|
|
|
@ApiParam(name = "endMsgId", value = "结束的消息记录ID")
|
|
|
@RequestParam(value = "endMsgId", required = false) String endMsgId,
|
|
|
@ApiParam(name = "page", value = "第几页")
|
|
|
@RequestParam(value = "page", required = true) int page,
|
|
|
@ApiParam(name = "pagesize", value = "分页数")
|
|
|
@RequestParam(value = "pagesize", required = true) int pagesize) throws Exception {
|
|
|
|
|
|
try {
|
|
|
JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
|
|
|
return success(messageArray);
|
|
|
} catch (Exception e) {
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.intoTopic)
|
|
|
@ApiOperation(value = "根据咨询CODE进入会话")
|
|
|
public Envelop intoTopic(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult", required = true) String consult,
|
|
|
@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode", required = true) String patientCode
|
|
|
) {
|
|
|
|
|
|
try {
|
|
|
int result = imService.intoTopic(consult, patientCode, "");
|
|
|
if (result == -1) {
|
|
|
return failed("该咨询不是进行中");
|
|
|
}
|
|
|
return success("进入成功");
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.append)
|
|
|
@ApiOperation(value = "居民咨询发消息(追问接口)")
|
|
|
public ListEnvelop append(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult", required = true) String consult,
|
|
|
@ApiParam(name = "content", value = "追问内容")
|
|
|
@RequestParam(value = "content", required = true) String content,
|
|
|
@ApiParam(name = "type", value = "追问内容类型:1文字,2图片,3语音 ... (im消息类型)")
|
|
|
@RequestParam(value = "type", required = true) Integer type,
|
|
|
@ApiParam(name = "times", value = "")
|
|
|
@RequestParam(value = "times", required = false) Integer times,
|
|
|
@ApiParam(name = "wechat_appid", value = "来源:xm_ihealth_wx厦门i健康,xm_zsyy_wx中山医院")
|
|
|
@RequestParam(value = "wechat_appid", required = false) String wechat_appid,
|
|
|
@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode", required = false) String patientCode) throws Exception {
|
|
|
|
|
|
try {
|
|
|
List<String> failed = new ArrayList<>();
|
|
|
|
|
|
//处理语音文件
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(wechat_appid)) {
|
|
|
|
|
|
// imService.getInputStream("1",wechat_appid);
|
|
|
|
|
|
if(3 == type){//语音文件
|
|
|
String voicepath = imService.fetchWxVoices(wechat_appid);
|
|
|
logger.info("voice_path:"+voicepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String voiceurl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
|
|
|
if("xm_ihealth_wx".equals(wechat_appid)){
|
|
|
logger.info("voice_wx_type:"+wechat_appid);
|
|
|
voiceurl = fileUploadService.uploadWxVoice(voicepath);
|
|
|
if (3 == type) {//语音文件
|
|
|
String voicepath = imService.fetchWxVoices(wechat_appid);
|
|
|
logger.info("voice_path:" + voicepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String voiceurl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
|
|
|
if ("xm_ihealth_wx".equals(wechat_appid)) {
|
|
|
logger.info("voice_wx_type:" + wechat_appid);
|
|
|
voiceurl = fileUploadService.uploadWxVoice(voicepath);
|
|
|
// uploadVO.setFullUri(map.get("accessory").toString());
|
|
|
}else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)||"xm_hcyy_wx".equalsIgnoreCase(wechat_appid)){
|
|
|
voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url,voicepath);
|
|
|
logger.info(voiceurl);
|
|
|
}else {
|
|
|
voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
|
|
|
}
|
|
|
obj.put("path", voiceurl);
|
|
|
obj.put("times", times);
|
|
|
content = obj.toString();
|
|
|
}
|
|
|
}else if(2 == type){//图片文件
|
|
|
String imagepath = imService.fetchWxImages(wechat_appid);
|
|
|
logger.info("image_path:"+imagepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String imgeUrl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
|
|
|
if("xm_ihealth_wx".equals(wechat_appid)){
|
|
|
logger.info("imge_wx_type:"+wechat_appid);
|
|
|
imgeUrl = fileUploadService.uploadWxImage(imagepath);
|
|
|
} else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid) || "xm_hcyy_wx".equalsIgnoreCase(wechat_appid)) {
|
|
|
voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url, voicepath);
|
|
|
logger.info(voiceurl);
|
|
|
} else {
|
|
|
voiceurl = fileUtil.copyTempVoice(voicepath, fastdfs_file_url);
|
|
|
}
|
|
|
obj.put("path", voiceurl);
|
|
|
obj.put("times", times);
|
|
|
content = obj.toString();
|
|
|
}
|
|
|
} else if (2 == type) {//图片文件
|
|
|
String imagepath = imService.fetchWxImages(wechat_appid);
|
|
|
logger.info("image_path:" + imagepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String imgeUrl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
|
|
|
if ("xm_ihealth_wx".equals(wechat_appid)) {
|
|
|
logger.info("imge_wx_type:" + wechat_appid);
|
|
|
imgeUrl = fileUploadService.uploadWxImage(imagepath);
|
|
|
// uploadVO.setFullUri(map.get("accessory").toString());
|
|
|
}else{
|
|
|
imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
|
|
|
}
|
|
|
content = imgeUrl;
|
|
|
}
|
|
|
}else{}
|
|
|
|
|
|
}
|
|
|
|
|
|
failed = imService.append(consult,content,type,times,patientCode,wechat_appid);
|
|
|
return success(failed);
|
|
|
}catch (Exception e){
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDiseaseAndDept)
|
|
|
@ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
|
|
|
public MixEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "机构code")
|
|
|
@RequestParam(value = "iswork", required = false)String iswork,
|
|
|
@ApiParam(name = "patientid", value = "居民ID")
|
|
|
@RequestParam(value = "patientid", required = false)String patientid,
|
|
|
@ApiParam(name = "orgCode", value = "机构code")
|
|
|
@RequestParam(value = "orgCode", required = false)String orgCode,
|
|
|
@ApiParam(name = "dept", value = "部门code")
|
|
|
@RequestParam(value = "dept", required = false)String dept,
|
|
|
@ApiParam(name = "diseaseKey", value = "疾病名称关键字")
|
|
|
@RequestParam(value = "diseaseKey", required = false)String diseaseKey,
|
|
|
@ApiParam(name = "doctorNameKey", value = "医生名称关键字")
|
|
|
@RequestParam(value = "doctorNameKey", required = false)String doctorNameKey,
|
|
|
@ApiParam(name = "jobTitleNameKey", value = "医生职称关键字")
|
|
|
@RequestParam(value = "jobTitleNameKey", required = false)String jobTitleNameKey,
|
|
|
@ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频")
|
|
|
@RequestParam(value = "outpatientType", required = false)String outpatientType,
|
|
|
@ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字")
|
|
|
@RequestParam(value = "keyName", required = false)String keyName,
|
|
|
@ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD")
|
|
|
@RequestParam(value = "workingTime", required = false)String workingTime,
|
|
|
@ApiParam(name = "consultStatus", value = "在线状态")
|
|
|
@RequestParam(value = "consultStatus", required = false,defaultValue = "")String consultStatus,
|
|
|
@ApiParam(name = "chargType", value = "医生号别")
|
|
|
@RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
|
|
|
@ApiParam(name = "consutlSort", value = "咨询量排序")
|
|
|
@RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
|
|
|
|
|
|
@ApiParam(name = "isAttention", value = "是否关注")
|
|
|
@RequestParam(value = "isAttention", required = false)String isAttention,
|
|
|
|
|
|
@ApiParam(name = "page", value = "第几页")
|
|
|
@RequestParam(value = "page",required = false) Integer page,
|
|
|
@ApiParam(name = "pagesize", value = "分页大小")
|
|
|
@RequestParam(value = "pagesize",required = false) Integer pagesize
|
|
|
) throws Exception{
|
|
|
|
|
|
|
|
|
try {
|
|
|
logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
|
|
|
return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
|
|
|
orgCode,dept,
|
|
|
diseaseKey,doctorNameKey,
|
|
|
jobTitleNameKey,outpatientType,
|
|
|
keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
|
|
|
}catch (Exception e){
|
|
|
return failedMixEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.Prescription.findHotDeptAndDiseaseDict)
|
|
|
@ApiOperation(value = "获取常见疾病、热门部门、医生拒绝接诊原因 字典", notes = "获取常见疾病、热门部门、医生拒绝接诊原因 字典")
|
|
|
public ListEnvelop findHotDeptAndDiseaseDict(@ApiParam(name = "dictName", value = "dictName")
|
|
|
@RequestParam(value = "dictName", required = true,defaultValue = "ONLINE_HOSPITAL_DEPT_350211A1002")String dictName)throws Exception{
|
|
|
|
|
|
try {
|
|
|
return success(prescriptionService.findHotDeptAndDiseaseDict(dictName));
|
|
|
}catch (Exception e){
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.add)
|
|
|
@ApiOperation(value = "居民添加咨询接口", notes = "居民添加咨询接口")
|
|
|
public Envelop add(
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient",required = false) String patient,
|
|
|
@ApiParam(name = "doctor", value = "医生CODE")
|
|
|
@RequestParam(value = "doctor",required = true) String doctor,
|
|
|
@ApiParam(name = "when", value = "发病时间")
|
|
|
@RequestParam(value = "when",required = false) String when,
|
|
|
@ApiParam(name = "symptoms", value = "主述")
|
|
|
@RequestParam(value = "symptoms",required = false) String symptoms,
|
|
|
@ApiParam(name = "images", value = "图片")
|
|
|
@RequestParam(value = "images",required = false) String images,
|
|
|
@ApiParam(name = "voice", value = "语音")
|
|
|
@RequestParam(value = "voice",required = false) String voice,
|
|
|
@ApiParam(name = "relationCode", value = "关联业务表的code(服务项执行计划id)")
|
|
|
@RequestParam(value = "relationCode",required = false) String relationCode,
|
|
|
@ApiParam(name = "type", value = "咨询类型:1专家咨询 14导诊助手 17专家视频咨询 28康复咨询")
|
|
|
@RequestParam(value = "type",required = false) Integer type,
|
|
|
@ApiParam(name = "source", value = "咨询类型来源")
|
|
|
@RequestParam(value = "source",required = false) String source)throws Exception{
|
|
|
|
|
|
System.out.println("symptoms="+symptoms);
|
|
|
|
|
|
if (type == null) {
|
|
|
type = 1;
|
|
|
}
|
|
|
|
|
|
ConsultTeamDo consult = new ConsultTeamDo();
|
|
|
// 设置咨询类型:1专家咨询 14导诊助手
|
|
|
consult.setType(type);
|
|
|
// 设置发病时间
|
|
|
consult.setWhen(when);
|
|
|
// 设置主要症状
|
|
|
consult.setSymptoms(symptoms);
|
|
|
// 设置咨询图片URL
|
|
|
consult.setImages(images);
|
|
|
// 设置咨询语音URL
|
|
|
consult.setVoice(voice);
|
|
|
consult.setDoctor(doctor);
|
|
|
consult.setPatient(patient);
|
|
|
// 保存到数据库
|
|
|
} else {
|
|
|
imgeUrl = fileUtil.copyTempVoice(imagepath, fastdfs_file_url);
|
|
|
}
|
|
|
content = imgeUrl;
|
|
|
}
|
|
|
} else {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
failed = imService.append(consult, content, type, times, patientCode, wechat_appid);
|
|
|
return success(failed);
|
|
|
} catch (Exception e) {
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDiseaseAndDept)
|
|
|
@ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
|
|
|
public MixEnvelop findDoctorByHospitalAndDiseaseAndDept(
|
|
|
@ApiParam(name = "iswork", value = "机构code") @RequestParam(value = "iswork", required = false) String iswork,
|
|
|
@ApiParam(name = "patientid", value = "居民ID") @RequestParam(value = "patientid", required = false) String patientid,
|
|
|
@ApiParam(name = "orgCode", value = "机构code") @RequestParam(value = "orgCode", required = false) String orgCode,
|
|
|
@ApiParam(name = "dept", value = "部门code") @RequestParam(value = "dept", required = false) String dept,
|
|
|
@ApiParam(name = "diseaseKey", value = "疾病名称关键字") @RequestParam(value = "diseaseKey", required = false) String diseaseKey,
|
|
|
@ApiParam(name = "doctorNameKey", value = "医生名称关键字") @RequestParam(value = "doctorNameKey", required = false) String doctorNameKey,
|
|
|
@ApiParam(name = "jobTitleNameKey", value = "医生职称关键字") @RequestParam(value = "jobTitleNameKey", required = false) String jobTitleNameKey,
|
|
|
@ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频") @RequestParam(value = "outpatientType", required = false) String outpatientType,
|
|
|
@ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字") @RequestParam(value = "keyName", required = false) String keyName,
|
|
|
@ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD") @RequestParam(value = "workingTime", required = false) String workingTime,
|
|
|
@ApiParam(name = "consultStatus", value = "在线状态") @RequestParam(value = "consultStatus", required = false, defaultValue = "") String consultStatus,
|
|
|
@ApiParam(name = "chargType", value = "医生号别") @RequestParam(value = "chargType", required = false, defaultValue = "") String chargType,
|
|
|
@ApiParam(name = "consutlSort", value = "咨询量排序") @RequestParam(value = "consutlSort", required = true, defaultValue = "DESC") String consutlSort,
|
|
|
@ApiParam(name = "isAttention", value = "是否关注") @RequestParam(value = "isAttention", required = false) String isAttention,
|
|
|
@ApiParam(name = "page", value = "第几页") @RequestParam(value = "page", required = false) Integer page,
|
|
|
@ApiParam(name = "pagesize", value = "分页大小") @RequestParam(value = "pagesize", required = false) Integer pagesize
|
|
|
) throws Exception {
|
|
|
try {
|
|
|
logger.info("findDoctorByHospitalAndDiseaseAndDept start:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
|
|
|
return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork, patientid,
|
|
|
orgCode, dept,
|
|
|
diseaseKey, doctorNameKey,
|
|
|
jobTitleNameKey, outpatientType,
|
|
|
keyName, workingTime, consultStatus, chargType, consutlSort, isAttention, page, pagesize);
|
|
|
} catch (Exception e) {
|
|
|
return failedMixEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.Prescription.findHotDeptAndDiseaseDict)
|
|
|
@ApiOperation(value = "获取常见疾病、热门部门、医生拒绝接诊原因 字典", notes = "获取常见疾病、热门部门、医生拒绝接诊原因 字典")
|
|
|
public ListEnvelop findHotDeptAndDiseaseDict(@ApiParam(name = "dictName", value = "dictName")
|
|
|
@RequestParam(value = "dictName", required = true, defaultValue = "ONLINE_HOSPITAL_DEPT_350211A1002") String dictName) throws Exception {
|
|
|
|
|
|
try {
|
|
|
return success(prescriptionService.findHotDeptAndDiseaseDict(dictName));
|
|
|
} catch (Exception e) {
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.add)
|
|
|
@ApiOperation(value = "居民添加咨询接口", notes = "居民添加咨询接口")
|
|
|
public Envelop add(
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient", required = false) String patient,
|
|
|
@ApiParam(name = "doctor", value = "医生CODE")
|
|
|
@RequestParam(value = "doctor", required = true) String doctor,
|
|
|
@ApiParam(name = "when", value = "发病时间")
|
|
|
@RequestParam(value = "when", required = false) String when,
|
|
|
@ApiParam(name = "symptoms", value = "主述")
|
|
|
@RequestParam(value = "symptoms", required = false) String symptoms,
|
|
|
@ApiParam(name = "images", value = "图片")
|
|
|
@RequestParam(value = "images", required = false) String images,
|
|
|
@ApiParam(name = "voice", value = "语音")
|
|
|
@RequestParam(value = "voice", required = false) String voice,
|
|
|
@ApiParam(name = "relationCode", value = "关联业务表的code(服务项执行计划id)")
|
|
|
@RequestParam(value = "relationCode", required = false) String relationCode,
|
|
|
@ApiParam(name = "type", value = "咨询类型:1专家咨询 14导诊助手 17专家视频咨询 28康复咨询")
|
|
|
@RequestParam(value = "type", required = false) Integer type,
|
|
|
@ApiParam(name = "source", value = "咨询类型来源")
|
|
|
@RequestParam(value = "source", required = false) String source) throws Exception {
|
|
|
|
|
|
System.out.println("symptoms=" + symptoms);
|
|
|
|
|
|
if (type == null) {
|
|
|
type = 1;
|
|
|
}
|
|
|
|
|
|
ConsultTeamDo consult = new ConsultTeamDo();
|
|
|
// 设置咨询类型:1专家咨询 14导诊助手
|
|
|
consult.setType(type);
|
|
|
// 设置发病时间
|
|
|
consult.setWhen(when);
|
|
|
// 设置主要症状
|
|
|
consult.setSymptoms(symptoms);
|
|
|
// 设置咨询图片URL
|
|
|
consult.setImages(images);
|
|
|
// 设置咨询语音URL
|
|
|
consult.setVoice(voice);
|
|
|
consult.setDoctor(doctor);
|
|
|
consult.setPatient(patient);
|
|
|
// 保存到数据库
|
|
|
// int res = 0;
|
|
|
// JSONArray dts = null;
|
|
|
synchronized (patient.intern()){//新增同步方法。设备保存写在service层但是不生效,写在controller层才生效
|
|
|
JSONObject re = null;
|
|
|
re = imService.addTeamConsult(consult, patient,doctor,source,relationCode);
|
|
|
synchronized (patient.intern()) {//新增同步方法。设备保存写在service层但是不生效,写在controller层才生效
|
|
|
JSONObject re = null;
|
|
|
re = imService.addTeamConsult(consult, patient, doctor, source, relationCode);
|
|
|
// res = re.getInteger("status");
|
|
|
// dts = re.containsKey("doctor")?re.getJSONArray("doctor"):null;
|
|
|
if (payFlag){
|
|
|
//线上问诊支付提醒
|
|
|
if (type==17||type==1){
|
|
|
SystemMessageDO systemMessageDO = new SystemMessageDO();
|
|
|
systemMessageDO.setTitle("支付提醒");
|
|
|
systemMessageDO.setType("11");
|
|
|
systemMessageDO.setSender(re.getString("doctor"));
|
|
|
systemMessageDO.setSenderName(re.getString("doctorName"));
|
|
|
systemMessageDO.setRelationCode(re.getString("consult"));
|
|
|
systemMessageDO.setReceiver(re.getString("patient"));
|
|
|
systemMessageDO.setReceiverName(re.getString("patientName"));
|
|
|
|
|
|
net.sf.json.JSONObject data = new net.sf.json.JSONObject();
|
|
|
data.put("name",re.getString("patientName"));
|
|
|
data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
|
|
|
data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
|
|
|
data.put("question",symptoms);
|
|
|
data.put("type",type);
|
|
|
String msg= "";
|
|
|
/*prescriptionService.sendWxTemplateMsg(wxId,"",consult,type+"","payRemind","");*/
|
|
|
prescriptionService.saveInquirySystemMessage(null,consult);
|
|
|
data.put("msg",msg);
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
String templateMsgResult = ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//发送系统消息
|
|
|
SystemMessageDO systemMessageDO = new SystemMessageDO();
|
|
|
systemMessageDO.setTitle("新增"+re.getString("title"));
|
|
|
systemMessageDO.setType("4");
|
|
|
systemMessageDO.setReceiver(re.getString("doctor"));
|
|
|
systemMessageDO.setReceiverName(re.getString("doctorName"));
|
|
|
systemMessageDO.setRelationCode(re.getString("sessiond_id"));
|
|
|
systemMessageDO.setSender(re.getString("patient"));
|
|
|
systemMessageDO.setSenderName(re.getString("patientName"));
|
|
|
|
|
|
net.sf.json.JSONObject data = new net.sf.json.JSONObject();
|
|
|
data.put("name",re.getString("patientName"));
|
|
|
data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
|
|
|
data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
|
|
|
data.put("question",symptoms);
|
|
|
data.put("type",1);
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
hospitalSystemMessageService.saveMessage(systemMessageDO);
|
|
|
BaseDoctorDO d = baseDoctorDao.findByIdAndDel(re.getString("doctor"));
|
|
|
BasePatientDO p = basePatientDao.findById(re.getString("patient")).orElse(null);
|
|
|
|
|
|
try {
|
|
|
//眼科支付订单
|
|
|
if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
BusinessOrderDO businessOrderDO = new BusinessOrderDO();
|
|
|
businessOrderDO.setDoctor(doctor);
|
|
|
businessOrderDO.setRematk(symptoms);
|
|
|
businessOrderDO.setPatient(patient);
|
|
|
businessOrderDO.setPatientName(re.getString("patientName"));
|
|
|
businessOrderDO.setDescription("专家咨询费");
|
|
|
businessOrderDO.setOrderCategory("1");
|
|
|
if (type==1){
|
|
|
businessOrderDO.setOrderType(1);
|
|
|
businessOrderDO.setRelationCode(re.getString("consult"));
|
|
|
businessOrderDO.setRelationName("新增专家咨询");
|
|
|
}else if (type==17){
|
|
|
businessOrderDO.setOrderType(3);
|
|
|
businessOrderDO.setRelationCode(re.getString("consult"));
|
|
|
businessOrderDO.setRelationName("新增专家咨询");
|
|
|
}
|
|
|
businessOrderService.saveOrder(businessOrderDO);
|
|
|
}else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
Double price = 0.0;
|
|
|
if(d!=null&& org.apache.commons.lang3.StringUtils.isNoneBlank(d.getFee())){
|
|
|
price = Double.parseDouble(d.getFee());
|
|
|
}
|
|
|
ConsultDo consultDo = consultDao.findById(re.getString("consult")).orElse(null);
|
|
|
if (price==0.0){
|
|
|
consultDo.setPayStatus(1);
|
|
|
consultDao.save(consultDo);
|
|
|
}
|
|
|
businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
|
|
|
}else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
|
|
|
Double price = 0.0;
|
|
|
if(d!=null&& org.apache.commons.lang3.StringUtils.isNoneBlank(d.getFee())){
|
|
|
price = Double.parseDouble(d.getFee());
|
|
|
}
|
|
|
ConsultDo consultDo = consultDao.findById(re.getString("consult")).orElse(null);
|
|
|
if (price==0.0){
|
|
|
consultDo.setPayStatus(1);
|
|
|
consultDao.save(consultDo);
|
|
|
}
|
|
|
businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
logger.info("支付订单失败:"+e.getMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
//发送企业号推送
|
|
|
try{
|
|
|
|
|
|
|
|
|
if("zsyy".equals(qywxId)){
|
|
|
String url = qywxUrl+"/ims-app-web/#/onlineChat/chatroom?rstitle="+p.getName()+"%20专家咨询&type="+type+"&sessionId="+re.getString("sessiond_id");
|
|
|
logger.info("发送企业号url:"+url);
|
|
|
enterpriseService.sendMKMesByMobile(qywxId,d.getMobile(),"您的专家咨询有新的消息,请您尽快回复[查看详情]("+url+")");
|
|
|
}else if("xm_xzzx_wx".equals(qywxId)){
|
|
|
String roomUrl = "pages/doctor/index?opath=/onlineChat/chatroom&rstitle="+p.getName()+"%20专家咨询&type="+type+"&sessionId="+re.getString("sessiond_id");
|
|
|
logger.info("发送企业号url:"+roomUrl);
|
|
|
enterpriseService.sendXCXMesByDoctor(qywxId,
|
|
|
re.getString("doctor"),
|
|
|
"wx53f6bb4ac081d840",
|
|
|
roomUrl,
|
|
|
p.getName()+"%20专家咨询","您有新的咨询消息",false,"");
|
|
|
}else{}
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
logger.info("发送企业号失败"+e.toString());
|
|
|
}
|
|
|
if(!"zsyy".equals(qywxId) && !"xm_xzzx_wx".equals(qywxId)){
|
|
|
//发送厦门i健康智能推送
|
|
|
try{
|
|
|
String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId="+p.getId()+"_"+d.getId()+"_1&sessionType=1&from="+p.getId()+"&content="+URLEncoder.encode(symptoms)+"&businessType=1&doctor_idcard="+d.getIdcard()+"&patientName="+URLEncoder.encode(p.getName())+"&url=1";
|
|
|
logger.info("发送厦门i健康智能推送url:"+wxurl);
|
|
|
wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
|
|
|
}catch (Exception e){
|
|
|
logger.info("发送厦门i健康智能失败"+e.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return success("操作成功", consult);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.patientInfo)
|
|
|
@ApiOperation(value = "根据居民ID获取居民详情信息", notes = "根据居民ID获取居民详情信息")
|
|
|
public Envelop patientInfo(
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient",required = false) String patient) throws Exception {
|
|
|
|
|
|
try {
|
|
|
BasePatientDO result = basePatientService.findByIdAndDel(patient);
|
|
|
//---居民性别取身份证字段--
|
|
|
result.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(result.getIdcard())));
|
|
|
if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
familyMemberService.saveYktFamily(patient);
|
|
|
}
|
|
|
return success(result);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.finish)
|
|
|
@ApiOperation(value = "居民结束咨询", notes = "居民结束咨询")
|
|
|
public Envelop finish(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = false) String consult,
|
|
|
@ApiParam(name = "patientCode", value = "居民COEE")
|
|
|
@RequestParam(value = "patientCode",required = false) String patientCode
|
|
|
) throws Exception {
|
|
|
|
|
|
int resutl = imService.finish(consult,patientCode,1);
|
|
|
//医生未回复可以退费
|
|
|
try {
|
|
|
businessOrderService.consultRefund(consult,wxId);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
|
|
|
JSONObject msgObj = new JSONObject();
|
|
|
msgObj.put("msg",basePatientDO.getName()+"结束了咨询");
|
|
|
msgObj.put("consultcode",consult);
|
|
|
String jsonStr = "";
|
|
|
if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
|
|
|
//结束时医生未开处方则发送模板消息结算
|
|
|
ConsultDo cons = consultDao.findById(consult).orElse(null);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(cons.getRelationCode())){
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(cons.getRelationCode()).orElse(null);
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutpatientId(outpatientDO.getId());
|
|
|
if (wlyyPrescriptionDOS==null||wlyyPrescriptionDOS.size()==0){
|
|
|
logger.info("发送诊查费支付模板消息start");
|
|
|
BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
|
|
|
String userName = null;
|
|
|
String idcard = null;
|
|
|
if (patientDO != null) {
|
|
|
userName = patientDO.getName();
|
|
|
idcard = patientDO.getIdcard();
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getConsumer());
|
|
|
String userNo = null;
|
|
|
if (patientMappingDO != null) {
|
|
|
userNo = patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
String cardNo = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(outpatientDO.getCardNo())) {
|
|
|
cardNo = outpatientDO.getCardNo();
|
|
|
}
|
|
|
String free = 0+"";
|
|
|
String date=DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyyMMddHHmmss");
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(outpatientDO.getRealOrder())){
|
|
|
net.sf.json.JSONObject object =entranceService.BS15054(patientMappingDO.getMappingCode(),outpatientDO.getRealOrder(),false);
|
|
|
if(object!=null){
|
|
|
net.sf.json.JSONObject res = object.getJSONObject("resquest");
|
|
|
String rsCode = res.getString("@RESULT");
|
|
|
if ("0".equals(rsCode)) {
|
|
|
if (res.getString("@settle_flag").equalsIgnoreCase("N")){
|
|
|
free = res.getString("@total_charge");
|
|
|
}
|
|
|
}
|
|
|
logger.info("获取待结算数据 res: " + res.toString());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByRegisterNoList(outpatientDO.getRegisterNo());
|
|
|
if (outpatientDOS!=null&&outpatientDOS.size()>1){
|
|
|
outpatientDO.setHisStatus(1);
|
|
|
}else {
|
|
|
prescriptionService.sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "diagnoPayRemind", "");
|
|
|
}
|
|
|
if (payFlag) {
|
|
|
//线上问诊支付提醒
|
|
|
if (type == 17 || type == 1) {
|
|
|
SystemMessageDO systemMessageDO = new SystemMessageDO();
|
|
|
systemMessageDO.setTitle("支付提醒");
|
|
|
systemMessageDO.setType("11");
|
|
|
systemMessageDO.setSender(re.getString("doctor"));
|
|
|
systemMessageDO.setSenderName(re.getString("doctorName"));
|
|
|
systemMessageDO.setRelationCode(re.getString("consult"));
|
|
|
systemMessageDO.setReceiver(re.getString("patient"));
|
|
|
systemMessageDO.setReceiverName(re.getString("patientName"));
|
|
|
|
|
|
net.sf.json.JSONObject data = new net.sf.json.JSONObject();
|
|
|
data.put("name", re.getString("patientName"));
|
|
|
data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
|
|
|
data.put("gender", IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
|
|
|
data.put("question", symptoms);
|
|
|
data.put("type", type);
|
|
|
String msg = "";
|
|
|
/*prescriptionService.sendWxTemplateMsg(wxId,"",consult,type+"","payRemind","");*/
|
|
|
prescriptionService.saveInquirySystemMessage(null, consult);
|
|
|
data.put("msg", msg);
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
|
|
|
String templateMsgResult = ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//发送系统消息
|
|
|
SystemMessageDO systemMessageDO = new SystemMessageDO();
|
|
|
systemMessageDO.setTitle("新增" + re.getString("title"));
|
|
|
systemMessageDO.setType("4");
|
|
|
systemMessageDO.setReceiver(re.getString("doctor"));
|
|
|
systemMessageDO.setReceiverName(re.getString("doctorName"));
|
|
|
systemMessageDO.setRelationCode(re.getString("sessiond_id"));
|
|
|
systemMessageDO.setSender(re.getString("patient"));
|
|
|
systemMessageDO.setSenderName(re.getString("patientName"));
|
|
|
|
|
|
net.sf.json.JSONObject data = new net.sf.json.JSONObject();
|
|
|
data.put("name", re.getString("patientName"));
|
|
|
data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
|
|
|
data.put("gender", IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
|
|
|
data.put("question", symptoms);
|
|
|
data.put("type", 1);
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
hospitalSystemMessageService.saveMessage(systemMessageDO);
|
|
|
BaseDoctorDO d = baseDoctorDao.findByIdAndDel(re.getString("doctor"));
|
|
|
BasePatientDO p = basePatientDao.findById(re.getString("patient")).orElse(null);
|
|
|
|
|
|
try {
|
|
|
//眼科支付订单
|
|
|
if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
|
|
|
BusinessOrderDO businessOrderDO = new BusinessOrderDO();
|
|
|
businessOrderDO.setDoctor(doctor);
|
|
|
businessOrderDO.setRematk(symptoms);
|
|
|
businessOrderDO.setPatient(patient);
|
|
|
businessOrderDO.setPatientName(re.getString("patientName"));
|
|
|
businessOrderDO.setDescription("专家咨询费");
|
|
|
businessOrderDO.setOrderCategory("1");
|
|
|
if (type == 1) {
|
|
|
businessOrderDO.setOrderType(1);
|
|
|
businessOrderDO.setRelationCode(re.getString("consult"));
|
|
|
businessOrderDO.setRelationName("新增专家咨询");
|
|
|
} else if (type == 17) {
|
|
|
businessOrderDO.setOrderType(3);
|
|
|
businessOrderDO.setRelationCode(re.getString("consult"));
|
|
|
businessOrderDO.setRelationName("新增专家咨询");
|
|
|
}
|
|
|
businessOrderService.saveOrder(businessOrderDO);
|
|
|
} else if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
|
|
|
Double price = 0.0;
|
|
|
if (d != null && org.apache.commons.lang3.StringUtils.isNoneBlank(d.getFee())) {
|
|
|
price = Double.parseDouble(d.getFee());
|
|
|
}
|
|
|
ConsultDo consultDo = consultDao.findById(re.getString("consult")).orElse(null);
|
|
|
if (price == 0.0) {
|
|
|
consultDo.setPayStatus(1);
|
|
|
consultDao.save(consultDo);
|
|
|
}
|
|
|
businessOrderService.recharge(re.getString("consult"), "新增专家咨询", "1", "专家咨询费", patient, re.getString("patientName"), doctor, price);
|
|
|
} else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
|
|
|
Double price = 0.0;
|
|
|
if (d != null && org.apache.commons.lang3.StringUtils.isNoneBlank(d.getFee())) {
|
|
|
price = Double.parseDouble(d.getFee());
|
|
|
}
|
|
|
ConsultDo consultDo = consultDao.findById(re.getString("consult")).orElse(null);
|
|
|
if (price == 0.0) {
|
|
|
consultDo.setPayStatus(1);
|
|
|
consultDao.save(consultDo);
|
|
|
}
|
|
|
businessOrderService.recharge(re.getString("consult"), "新增专家咨询", "1", "专家咨询费", patient, re.getString("patientName"), doctor, price);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.info("支付订单失败:" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
//发送企业号推送
|
|
|
try {
|
|
|
|
|
|
|
|
|
if ("zsyy".equals(qywxId)) {
|
|
|
String url = qywxUrl + "/ims-app-web/#/onlineChat/chatroom?rstitle=" + p.getName() + "%20专家咨询&type=" + type + "&sessionId=" + re.getString("sessiond_id");
|
|
|
logger.info("发送企业号url:" + url);
|
|
|
enterpriseService.sendMKMesByMobile(qywxId, d.getMobile(), "您的专家咨询有新的消息,请您尽快回复[查看详情](" + url + ")");
|
|
|
} else if ("xm_xzzx_wx".equals(qywxId)) {
|
|
|
String roomUrl = "pages/doctor/index?opath=/onlineChat/chatroom&rstitle=" + p.getName() + "%20专家咨询&type=" + type + "&sessionId=" + re.getString("sessiond_id");
|
|
|
logger.info("发送企业号url:" + roomUrl);
|
|
|
enterpriseService.sendXCXMesByDoctor(qywxId,
|
|
|
re.getString("doctor"),
|
|
|
"wx53f6bb4ac081d840",
|
|
|
roomUrl,
|
|
|
p.getName() + "%20专家咨询", "您有新的咨询消息", false, "");
|
|
|
} else {
|
|
|
}
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
logger.info("发送企业号失败" + e.toString());
|
|
|
}
|
|
|
if (!"zsyy".equals(qywxId) && !"xm_xzzx_wx".equals(qywxId)) {
|
|
|
//发送厦门i健康智能推送
|
|
|
try {
|
|
|
String wxurl = wlyyUrl + "/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId=" + p.getId() + "_" + d.getId() + "_1&sessionType=1&from=" + p.getId() + "&content=" + URLEncoder.encode(symptoms) + "&businessType=1&doctor_idcard=" + d.getIdcard() + "&patientName=" + URLEncoder.encode(p.getName()) + "&url=1";
|
|
|
logger.info("发送厦门i健康智能推送url:" + wxurl);
|
|
|
wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
|
|
|
} catch (Exception e) {
|
|
|
logger.info("发送厦门i健康智能失败" + e.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return success("操作成功", consult);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.patientInfo)
|
|
|
@ApiOperation(value = "根据居民ID获取居民详情信息", notes = "根据居民ID获取居民详情信息")
|
|
|
public Envelop patientInfo(
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient", required = false) String patient) throws Exception {
|
|
|
|
|
|
try {
|
|
|
BasePatientDO result = basePatientService.findByIdAndDel(patient);
|
|
|
//---居民性别取身份证字段--
|
|
|
result.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(result.getIdcard())));
|
|
|
if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
|
|
|
familyMemberService.saveYktFamily(patient);
|
|
|
}
|
|
|
return success(result);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.finish)
|
|
|
@ApiOperation(value = "居民结束咨询", notes = "居民结束咨询")
|
|
|
public Envelop finish(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult", required = false) String consult,
|
|
|
@ApiParam(name = "patientCode", value = "居民COEE")
|
|
|
@RequestParam(value = "patientCode", required = false) String patientCode
|
|
|
) throws Exception {
|
|
|
|
|
|
int resutl = imService.finish(consult, patientCode, 1);
|
|
|
//医生未回复可以退费
|
|
|
try {
|
|
|
businessOrderService.consultRefund(consult, wxId);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
|
|
|
JSONObject msgObj = new JSONObject();
|
|
|
msgObj.put("msg", basePatientDO.getName() + "结束了咨询");
|
|
|
msgObj.put("consultcode", consult);
|
|
|
String jsonStr = "";
|
|
|
if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
|
|
|
//结束时医生未开处方则发送模板消息结算
|
|
|
ConsultDo cons = consultDao.findById(consult).orElse(null);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(cons.getRelationCode())) {
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(cons.getRelationCode()).orElse(null);
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutpatientId(outpatientDO.getId());
|
|
|
if (wlyyPrescriptionDOS == null || wlyyPrescriptionDOS.size() == 0) {
|
|
|
logger.info("发送诊查费支付模板消息start");
|
|
|
BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
|
|
|
String userName = null;
|
|
|
String idcard = null;
|
|
|
if (patientDO != null) {
|
|
|
userName = patientDO.getName();
|
|
|
idcard = patientDO.getIdcard();
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getConsumer());
|
|
|
String userNo = null;
|
|
|
if (patientMappingDO != null) {
|
|
|
userNo = patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
String cardNo = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(outpatientDO.getCardNo())) {
|
|
|
cardNo = outpatientDO.getCardNo();
|
|
|
}
|
|
|
String free = 0 + "";
|
|
|
String date = DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyyMMddHHmmss");
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(outpatientDO.getRealOrder())) {
|
|
|
net.sf.json.JSONObject object = entranceService.BS15054(patientMappingDO.getMappingCode(), outpatientDO.getRealOrder(), false);
|
|
|
if (object != null) {
|
|
|
net.sf.json.JSONObject res = object.getJSONObject("resquest");
|
|
|
String rsCode = res.getString("@RESULT");
|
|
|
if ("0".equals(rsCode)) {
|
|
|
if (res.getString("@settle_flag").equalsIgnoreCase("N")) {
|
|
|
free = res.getString("@total_charge");
|
|
|
}
|
|
|
}
|
|
|
logger.info("获取待结算数据 res: " + res.toString());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByRegisterNoList(outpatientDO.getRegisterNo());
|
|
|
if (outpatientDOS != null && outpatientDOS.size() > 1) {
|
|
|
outpatientDO.setHisStatus(1);
|
|
|
} else {
|
|
|
prescriptionService.sendWxTemplateMsg(wxId, outpatientDO.getId(), null, "", "diagnoPayRemind", "");
|
|
|
}
|
|
|
/*if (!free.equalsIgnoreCase("0")){
|
|
|
|
|
|
ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getXtgzh(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1","WX_PUB");
|
|
|
}*/
|
|
|
logger.info("发送诊查费支付模板消息end");
|
|
|
}
|
|
|
outpatientDO.setEndTime(new Date());
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
}
|
|
|
}
|
|
|
if(1 == resutl){
|
|
|
jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
|
|
|
}
|
|
|
logger.info("发送诊查费支付模板消息end");
|
|
|
}
|
|
|
outpatientDO.setEndTime(new Date());
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
}
|
|
|
}
|
|
|
if (1 == resutl) {
|
|
|
jsonStr = "{\"id\":\"" + UUID.randomUUID().toString() + "\",\"sender_id\":\"" + patientCode + "\",\"sender_name\":\"系统\",\"timestamp\":" + new Date().getTime() + ",\"content_type\":7,\"content\":" + msgObj.toString() + ",\"business_type\":1}";
|
|
|
}
|
|
|
// else{
|
|
|
// throw new Exception("结束失败");
|
|
|
// }
|
|
|
|
|
|
return success(jsonStr);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getTopic)
|
|
|
@ApiOperation(value = "根据咨询CODE获取session_id", notes = "根据咨询CODE获取session_id")
|
|
|
public Envelop getTopic(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = false) String consult)throws Exception {
|
|
|
try {
|
|
|
return success("请求成功",imService.getTopic(consult));
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getConsultCodeByOutpatientId)
|
|
|
@ApiOperation(value = "根据复诊记录ID获取咨询CODE", notes = "根据复诊记录ID获取咨询CODE")
|
|
|
public Envelop getConsultCodeByOutpatientId(
|
|
|
@ApiParam(name = "outpatientid", value = "复诊ID")
|
|
|
@RequestParam(value = "outpatientid",required = true) String outpatientid)throws Exception {
|
|
|
|
|
|
try {
|
|
|
return success("请求成功",imService.getConsultCodeByOutpatientId(outpatientid));
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.evaluationByConsultCode)
|
|
|
@ApiOperation(value = "评价咨询", notes = "评价咨询")
|
|
|
public Envelop evaluationByConsultCode(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = true) String consult,
|
|
|
@ApiParam(name = "scoreContent", value = "评价内容")
|
|
|
@RequestParam(value = "scoreContent",required = false) String scoreContent,
|
|
|
@ApiParam(name = "type", value = "1、实名,2、匿名")
|
|
|
@RequestParam(value = "type",required = true) Integer type,
|
|
|
@ApiParam(name = "bannerList",value = "锦旗")
|
|
|
@RequestParam(value = "bannerList",required = false) String bannerList)throws Exception{
|
|
|
return success(jsonStr);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getTopic)
|
|
|
@ApiOperation(value = "根据咨询CODE获取session_id", notes = "根据咨询CODE获取session_id")
|
|
|
public Envelop getTopic(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult", required = false) String consult) throws Exception {
|
|
|
try {
|
|
|
return success("请求成功", imService.getTopic(consult));
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getConsultCodeByOutpatientId)
|
|
|
@ApiOperation(value = "根据复诊记录ID获取咨询CODE", notes = "根据复诊记录ID获取咨询CODE")
|
|
|
public Envelop getConsultCodeByOutpatientId(
|
|
|
@ApiParam(name = "outpatientid", value = "复诊ID")
|
|
|
@RequestParam(value = "outpatientid", required = true) String outpatientid) throws Exception {
|
|
|
|
|
|
try {
|
|
|
return success("请求成功", imService.getConsultCodeByOutpatientId(outpatientid));
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.evaluationByConsultCode)
|
|
|
@ApiOperation(value = "评价咨询", notes = "评价咨询")
|
|
|
public Envelop evaluationByConsultCode(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult", required = true) String consult,
|
|
|
@ApiParam(name = "scoreContent", value = "评价内容")
|
|
|
@RequestParam(value = "scoreContent", required = false) String scoreContent,
|
|
|
@ApiParam(name = "type", value = "1、实名,2、匿名")
|
|
|
@RequestParam(value = "type", required = true) Integer type,
|
|
|
@ApiParam(name = "bannerList", value = "锦旗")
|
|
|
@RequestParam(value = "bannerList", required = false) String bannerList) throws Exception {
|
|
|
// if(StringUtils.isEmpty(scoreContent)){
|
|
|
// scoreContent= "[{\"scoreType\":\"1\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"2\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"3\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"4\",\"score\":0,\"content\":\"测试评语。。。。123123\"}]";
|
|
|
// }
|
|
|
|
|
|
try {
|
|
|
imService.evaluationByConsultCode(consult,scoreContent,type,bannerList);
|
|
|
return success("请求成功");
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getEvaluationByConsultCode)
|
|
|
@ApiOperation(value = "根据咨询CODE获取评价", notes = "根据咨询CODE获取评价")
|
|
|
public ListEnvelop getEvaluationByConsultCode(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = true) String consult)throws Exception{
|
|
|
try {
|
|
|
imService.evaluationByConsultCode(consult, scoreContent, type, bannerList);
|
|
|
return success("请求成功");
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getEvaluationByConsultCode)
|
|
|
@ApiOperation(value = "根据咨询CODE获取评价", notes = "根据咨询CODE获取评价")
|
|
|
public ListEnvelop getEvaluationByConsultCode(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult", required = true) String consult) throws Exception {
|
|
|
// if(StringUtils.isEmpty(scoreContent)){
|
|
|
// scoreContent= "[{\"scoreType\":\"1\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"2\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"3\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"4\",\"score\":0,\"content\":\"测试评语。。。。123123\"}]";
|
|
|
// }
|
|
|
try {
|
|
|
return success("请求成功",imService.getEvaluationByConsultCode(consult));
|
|
|
}catch (Exception e){
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.getSign)
|
|
|
@ApiOperation(value = "获取微信签名", notes = "获取微信签名")
|
|
|
public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
|
|
|
@RequestParam(value = "pageUrl", required = true)String pageUrl,
|
|
|
@ApiParam(name = "wxId", value = "微信id")
|
|
|
@RequestParam(value = "wxId", required = true)String wxId) throws Exception {
|
|
|
try {
|
|
|
logger.info("pageUrl="+pageUrl);
|
|
|
logger.info("wxId="+wxId);
|
|
|
String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
|
|
|
WxWechatDO wxWechatDO = wechatDao.findByIdAndStatus(wxId);
|
|
|
Map<Object, Object> map = new HashMap<Object, Object>();
|
|
|
if (ticket != null) {
|
|
|
String noncestr = UUID.randomUUID().toString();
|
|
|
long timestamp = System.currentTimeMillis() / 1000;
|
|
|
String url = pageUrl;
|
|
|
logger.info("getSign.url="+url);
|
|
|
String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url;
|
|
|
logger.info("getSign.str="+str);
|
|
|
// sha1加密
|
|
|
String signature = SHA1(str);
|
|
|
map.put("noncestr", noncestr);
|
|
|
map.put("timestamp", timestamp);
|
|
|
map.put("signature", signature);
|
|
|
map.put("appid", wxWechatDO.getAppId());
|
|
|
return success(PatientRequestMapping.Wechat.api_success,map);
|
|
|
}
|
|
|
return failed(PatientRequestMapping.Wechat.api_error);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @description: SHA、SHA1加密 @parameter: str:待加密字符串 @return: 加密串
|
|
|
**/
|
|
|
public String SHA1(String str) throws Exception {
|
|
|
try {
|
|
|
MessageDigest digest = java.security.MessageDigest.getInstance("SHA-1"); // 如果是SHA加密只需要将"SHA-1"改成"SHA"即可
|
|
|
digest.update(str.getBytes());
|
|
|
byte messageDigest[] = digest.digest();
|
|
|
// Create Hex String
|
|
|
StringBuffer hexStr = new StringBuffer();
|
|
|
// 字节数组转换为 十六进制 数
|
|
|
for (int i = 0; i < messageDigest.length; i++) {
|
|
|
String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);
|
|
|
if (shaHex.length() < 2) {
|
|
|
hexStr.append(0);
|
|
|
}
|
|
|
hexStr.append(shaHex);
|
|
|
}
|
|
|
return hexStr.toString();
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
throw new Exception(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.getPatientGuaidenceConsult)
|
|
|
@ApiOperation(value = "导诊的咨询对话", notes = "导诊的咨询对话")
|
|
|
public Envelop getPatientGuaidenceConsult(@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode", required = true)String patientCode,
|
|
|
@ApiParam(name = "type", value = "_guidance_14 导诊收")
|
|
|
@RequestParam(value = "type", required = true)String type) throws Exception {
|
|
|
|
|
|
try {
|
|
|
String session_id = patientCode+type;
|
|
|
session_id = imService.getPatientGuaidenceConsult(patientCode,session_id,type);
|
|
|
return success(session_id);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.sessionIsExist)
|
|
|
@ApiOperation(value = "判断导诊sessionId是否存在", notes = "判断导诊sessionId是否存在")
|
|
|
public Envelop sessionIsExist(@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode", required = true)String patientCode,
|
|
|
@ApiParam(name = "type", value = "type")
|
|
|
@RequestParam(value = "type", required = false)String type) throws Exception {
|
|
|
|
|
|
try {
|
|
|
String session_id = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(type)){
|
|
|
session_id = patientCode+"_guidance_"+type;
|
|
|
}
|
|
|
Boolean re = imUtil.sessionIsExist(session_id);
|
|
|
|
|
|
return success(re);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.updateConsultParticipant)
|
|
|
@ApiOperation(value = "更新会话成员(新增或删除)", notes = "更新会话成员(新增或删除)")
|
|
|
public Envelop updateConsultParticipant(@ApiParam(name = "sessionid", value = "会话ID", defaultValue = "1")
|
|
|
@RequestParam(value = "sessionid", required = true) String sessionid,
|
|
|
@ApiParam(name = "userid", value = "新增成员ID,多个以英文逗号隔开", defaultValue = "1")
|
|
|
@RequestParam(value = "userid", required = true) String userid,
|
|
|
@ApiParam(name = "olduserid", value = "删除的成员id")
|
|
|
@RequestParam(value = "olduserid", required = false) String olduserid)throws Exception{
|
|
|
|
|
|
try {
|
|
|
imService.updateParticipant(sessionid,userid,olduserid);
|
|
|
return success("操作成功");
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.patientGuaidenceAppend)
|
|
|
@ApiOperation(value = "居民导诊会话发送消息", notes = "居民导诊会话发送消息")
|
|
|
public Envelop patientGuaidenceAppend(
|
|
|
@ApiParam(name = "sender_id", value = "发送者id", defaultValue = "")
|
|
|
@RequestParam(value = "sender_id", required = true) String sender_id,
|
|
|
@ApiParam(name = "sender_name", value = "发送者姓名", defaultValue = "")
|
|
|
@RequestParam(value = "sender_name", required = true) String sender_name,
|
|
|
@ApiParam(name = "session_id", value = "session_id", defaultValue = "")
|
|
|
@RequestParam(value = "session_id", required = false) String session_id,
|
|
|
@ApiParam(name = "content_type", value = "内容类型", defaultValue = "")
|
|
|
@RequestParam(value = "content_type", required = true) String content_type,
|
|
|
@ApiParam(name = "content", value = "消息内容", defaultValue = "")
|
|
|
@RequestParam(value = "content", required = true) String content,
|
|
|
@ApiParam(name = "extend", value = "扩展内容", defaultValue = "")
|
|
|
@RequestParam(value = "extend", required = false) String extend,
|
|
|
@ApiParam(name = "type", value = "咨询type", defaultValue = "")
|
|
|
@RequestParam(value = "type", required = false) String type,
|
|
|
@ApiParam(name = "times", value = "times", defaultValue = "")
|
|
|
@RequestParam(value = "times", required = false) Integer times,
|
|
|
@ApiParam(name = "wechat_appid", value = "wechat_appid", defaultValue = "")
|
|
|
@RequestParam(value = "wechat_appid", required = false) String wechat_appid
|
|
|
){
|
|
|
try {
|
|
|
//处理语音文件
|
|
|
if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
|
|
|
|
|
|
if("3".equalsIgnoreCase(content_type)){//语音文件
|
|
|
String voicepath = imService.fetchWxVoices(wechat_appid);
|
|
|
logger.info("voice_path:"+voicepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String voiceurl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
|
|
|
if("xm_ihealth_wx".equals(wechat_appid)){
|
|
|
logger.info("voice_wx_type:"+wechat_appid);
|
|
|
voiceurl = fileUploadService.uploadWxVoice(voicepath);
|
|
|
}else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)){
|
|
|
voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url,voicepath);
|
|
|
logger.info(voiceurl);
|
|
|
}else {
|
|
|
voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
|
|
|
}
|
|
|
obj.put("path", voiceurl);
|
|
|
obj.put("times", times);
|
|
|
content = obj.toString();
|
|
|
}
|
|
|
}else if("2".equalsIgnoreCase(content_type)){//图片文件
|
|
|
String imagepath = imService.fetchWxImages(wechat_appid);
|
|
|
logger.info("image_path:"+imagepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String imgeUrl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
|
|
|
if("xm_ihealth_wx".equals(wechat_appid)){
|
|
|
logger.info("imge_wx_type:"+wechat_appid);
|
|
|
imgeUrl = fileUploadService.uploadWxImage(imagepath);
|
|
|
}else{
|
|
|
imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
|
|
|
}
|
|
|
content = imgeUrl;
|
|
|
}
|
|
|
}else{
|
|
|
}
|
|
|
}
|
|
|
content = StringUtils.isNotEmpty(content)?content.trim():content;
|
|
|
Map<String,JSONObject> map = robotService.robotReply(session_id,type,content);
|
|
|
session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
|
|
|
String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1",extend);
|
|
|
robotService.sendReplyMap(map);
|
|
|
//消息存在时文本及问题集类型发送时自动回复
|
|
|
robotService.replyGuaidenceContent(session_id,type,content,content_type,"1",extend);
|
|
|
List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
|
|
|
for (BaseDoctorRoleDO doctorRoleDO:doctorRoleDOS){
|
|
|
System.out.println("发送外层SOCKET消息:通知医生导诊");
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("socket_sms_type",13);
|
|
|
object.put("relation_code",session_id);
|
|
|
imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
|
|
|
}
|
|
|
|
|
|
return success(result);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getDoctorConsultCount)
|
|
|
@ApiOperation(value = "医生端:查询会话视频邀请状态", notes = "医生端:查询会话视频邀请状态")
|
|
|
public Envelop getDoctorConsultCount(@ApiParam(name = "doctorids", value = "会话ID")
|
|
|
@RequestParam(value = "doctorids",required = true) String doctorids)throws Exception {
|
|
|
return success("查询成功",imService.getDoctorConsultCount(doctorids));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.Prescription.followOrgByPatient)
|
|
|
@ApiOperation(value = "居民关注医院", notes = "居民关注医院")
|
|
|
public Envelop followOrgByPatient(
|
|
|
@ApiParam(name = "patientid", value = "居民ID", defaultValue = "")
|
|
|
@RequestParam(value = "patientid", required = true) String patientid,
|
|
|
@ApiParam(name = "orgid", value = "医生ID", defaultValue = "")
|
|
|
@RequestParam(value = "orgid", required = true) String orgid,
|
|
|
@ApiParam(name = "type", value = "1关注 0取消关注", defaultValue = "")
|
|
|
@RequestParam(value = "type", required = true) String type
|
|
|
)throws Exception{
|
|
|
prescriptionService.followOrgByPatient(patientid,orgid,type);
|
|
|
return success("操作成功!");
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.Prescription.selectByGuidance)
|
|
|
@ApiOperation(value = "查询是否有导诊助手", notes = "查询是否有导诊助手")
|
|
|
public MixEnvelop selectByGuidance()throws Exception{
|
|
|
return MixEnvelop.getSuccessList("查询成功",doctorInfoService.selectByGuidance());
|
|
|
}
|
|
|
try {
|
|
|
return success("请求成功", imService.getEvaluationByConsultCode(consult));
|
|
|
} catch (Exception e) {
|
|
|
return failedListEnvelopException(e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.getSign)
|
|
|
@ApiOperation(value = "获取微信签名", notes = "获取微信签名")
|
|
|
public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
|
|
|
@RequestParam(value = "pageUrl", required = true) String pageUrl,
|
|
|
@ApiParam(name = "wxId", value = "微信id")
|
|
|
@RequestParam(value = "wxId", required = true) String wxId) throws Exception {
|
|
|
try {
|
|
|
logger.info("pageUrl=" + pageUrl);
|
|
|
logger.info("wxId=" + wxId);
|
|
|
String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
|
|
|
WxWechatDO wxWechatDO = wechatDao.findByIdAndStatus(wxId);
|
|
|
Map<Object, Object> map = new HashMap<Object, Object>();
|
|
|
if (ticket != null) {
|
|
|
String noncestr = UUID.randomUUID().toString();
|
|
|
long timestamp = System.currentTimeMillis() / 1000;
|
|
|
String url = pageUrl;
|
|
|
logger.info("getSign.url=" + url);
|
|
|
String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url;
|
|
|
logger.info("getSign.str=" + str);
|
|
|
// sha1加密
|
|
|
String signature = SHA1(str);
|
|
|
map.put("noncestr", noncestr);
|
|
|
map.put("timestamp", timestamp);
|
|
|
map.put("signature", signature);
|
|
|
map.put("appid", wxWechatDO.getAppId());
|
|
|
return success(PatientRequestMapping.Wechat.api_success, map);
|
|
|
}
|
|
|
return failed(PatientRequestMapping.Wechat.api_error);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @description: SHA、SHA1加密 @parameter: str:待加密字符串 @return: 加密串
|
|
|
**/
|
|
|
public String SHA1(String str) throws Exception {
|
|
|
try {
|
|
|
MessageDigest digest = java.security.MessageDigest.getInstance("SHA-1"); // 如果是SHA加密只需要将"SHA-1"改成"SHA"即可
|
|
|
digest.update(str.getBytes());
|
|
|
byte messageDigest[] = digest.digest();
|
|
|
// Create Hex String
|
|
|
StringBuffer hexStr = new StringBuffer();
|
|
|
// 字节数组转换为 十六进制 数
|
|
|
for (int i = 0; i < messageDigest.length; i++) {
|
|
|
String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);
|
|
|
if (shaHex.length() < 2) {
|
|
|
hexStr.append(0);
|
|
|
}
|
|
|
hexStr.append(shaHex);
|
|
|
}
|
|
|
return hexStr.toString();
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
throw new Exception(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.getPatientGuaidenceConsult)
|
|
|
@ApiOperation(value = "导诊的咨询对话", notes = "导诊的咨询对话")
|
|
|
public Envelop getPatientGuaidenceConsult(@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode", required = true) String patientCode,
|
|
|
@ApiParam(name = "type", value = "_guidance_14 导诊收")
|
|
|
@RequestParam(value = "type", required = true) String type) throws Exception {
|
|
|
|
|
|
try {
|
|
|
String session_id = patientCode + type;
|
|
|
session_id = imService.getPatientGuaidenceConsult(patientCode, session_id, type);
|
|
|
return success(session_id);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.sessionIsExist)
|
|
|
@ApiOperation(value = "判断导诊sessionId是否存在", notes = "判断导诊sessionId是否存在")
|
|
|
public Envelop sessionIsExist(@ApiParam(name = "patientCode", value = "居民CODE")
|
|
|
@RequestParam(value = "patientCode", required = true) String patientCode,
|
|
|
@ApiParam(name = "type", value = "type")
|
|
|
@RequestParam(value = "type", required = false) String type) throws Exception {
|
|
|
|
|
|
try {
|
|
|
String session_id = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(type)) {
|
|
|
session_id = patientCode + "_guidance_" + type;
|
|
|
}
|
|
|
Boolean re = imUtil.sessionIsExist(session_id);
|
|
|
|
|
|
return success(re);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.updateConsultParticipant)
|
|
|
@ApiOperation(value = "更新会话成员(新增或删除)", notes = "更新会话成员(新增或删除)")
|
|
|
public Envelop updateConsultParticipant(@ApiParam(name = "sessionid", value = "会话ID", defaultValue = "1")
|
|
|
@RequestParam(value = "sessionid", required = true) String sessionid,
|
|
|
@ApiParam(name = "userid", value = "新增成员ID,多个以英文逗号隔开", defaultValue = "1")
|
|
|
@RequestParam(value = "userid", required = true) String userid,
|
|
|
@ApiParam(name = "olduserid", value = "删除的成员id")
|
|
|
@RequestParam(value = "olduserid", required = false) String olduserid) throws Exception {
|
|
|
|
|
|
try {
|
|
|
imService.updateParticipant(sessionid, userid, olduserid);
|
|
|
return success("操作成功");
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.PatientIM.patientGuaidenceAppend)
|
|
|
@ApiOperation(value = "居民导诊会话发送消息", notes = "居民导诊会话发送消息")
|
|
|
public Envelop patientGuaidenceAppend(
|
|
|
@ApiParam(name = "sender_id", value = "发送者id", defaultValue = "")
|
|
|
@RequestParam(value = "sender_id", required = true) String sender_id,
|
|
|
@ApiParam(name = "sender_name", value = "发送者姓名", defaultValue = "")
|
|
|
@RequestParam(value = "sender_name", required = true) String sender_name,
|
|
|
@ApiParam(name = "session_id", value = "session_id", defaultValue = "")
|
|
|
@RequestParam(value = "session_id", required = false) String session_id,
|
|
|
@ApiParam(name = "content_type", value = "内容类型", defaultValue = "")
|
|
|
@RequestParam(value = "content_type", required = true) String content_type,
|
|
|
@ApiParam(name = "content", value = "消息内容", defaultValue = "")
|
|
|
@RequestParam(value = "content", required = true) String content,
|
|
|
@ApiParam(name = "extend", value = "扩展内容", defaultValue = "")
|
|
|
@RequestParam(value = "extend", required = false) String extend,
|
|
|
@ApiParam(name = "type", value = "咨询type", defaultValue = "")
|
|
|
@RequestParam(value = "type", required = false) String type,
|
|
|
@ApiParam(name = "times", value = "times", defaultValue = "")
|
|
|
@RequestParam(value = "times", required = false) Integer times,
|
|
|
@ApiParam(name = "wechat_appid", value = "wechat_appid", defaultValue = "")
|
|
|
@RequestParam(value = "wechat_appid", required = false) String wechat_appid
|
|
|
) {
|
|
|
try {
|
|
|
//处理语音文件
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(wechat_appid)) {
|
|
|
|
|
|
if ("3".equalsIgnoreCase(content_type)) {//语音文件
|
|
|
String voicepath = imService.fetchWxVoices(wechat_appid);
|
|
|
logger.info("voice_path:" + voicepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String voiceurl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
|
|
|
if ("xm_ihealth_wx".equals(wechat_appid)) {
|
|
|
logger.info("voice_wx_type:" + wechat_appid);
|
|
|
voiceurl = fileUploadService.uploadWxVoice(voicepath);
|
|
|
} else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)) {
|
|
|
voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url, voicepath);
|
|
|
logger.info(voiceurl);
|
|
|
} else {
|
|
|
voiceurl = fileUtil.copyTempVoice(voicepath, fastdfs_file_url);
|
|
|
}
|
|
|
obj.put("path", voiceurl);
|
|
|
obj.put("times", times);
|
|
|
content = obj.toString();
|
|
|
}
|
|
|
} else if ("2".equalsIgnoreCase(content_type)) {//图片文件
|
|
|
String imagepath = imService.fetchWxImages(wechat_appid);
|
|
|
logger.info("image_path:" + imagepath);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String imgeUrl = "";
|
|
|
// 将临时语音拷贝到正式存储路径下
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
|
|
|
if ("xm_ihealth_wx".equals(wechat_appid)) {
|
|
|
logger.info("imge_wx_type:" + wechat_appid);
|
|
|
imgeUrl = fileUploadService.uploadWxImage(imagepath);
|
|
|
} else {
|
|
|
imgeUrl = fileUtil.copyTempVoice(imagepath, fastdfs_file_url);
|
|
|
}
|
|
|
content = imgeUrl;
|
|
|
}
|
|
|
} else {
|
|
|
}
|
|
|
}
|
|
|
content = StringUtils.isNotEmpty(content) ? content.trim() : content;
|
|
|
Map<String, JSONObject> map = robotService.robotReply(session_id, type, content);
|
|
|
session_id = imService.getPatientGuaidenceConsult(sender_id, session_id, type);
|
|
|
String result = imService.patientGuaidenceAppend(sender_id, sender_name, session_id, content_type, content, "1", extend);
|
|
|
robotService.sendReplyMap(map);
|
|
|
//消息存在时文本及问题集类型发送时自动回复
|
|
|
robotService.replyGuaidenceContent(session_id, type, content, content_type, "1", extend);
|
|
|
List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
|
|
|
for (BaseDoctorRoleDO doctorRoleDO : doctorRoleDOS) {
|
|
|
System.out.println("发送外层SOCKET消息:通知医生导诊");
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("socket_sms_type", 13);
|
|
|
object.put("relation_code", session_id);
|
|
|
imService.sendWaiSocketMessage(sender_id, doctorRoleDO.getDoctorCode(), object.toString(), "1");
|
|
|
}
|
|
|
|
|
|
return success(result);
|
|
|
} catch (Exception e) {
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getDoctorConsultCount)
|
|
|
@ApiOperation(value = "医生端:查询会话视频邀请状态", notes = "医生端:查询会话视频邀请状态")
|
|
|
public Envelop getDoctorConsultCount(@ApiParam(name = "doctorids", value = "会话ID")
|
|
|
@RequestParam(value = "doctorids", required = true) String doctorids) throws Exception {
|
|
|
return success("查询成功", imService.getDoctorConsultCount(doctorids));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.Prescription.followOrgByPatient)
|
|
|
@ApiOperation(value = "居民关注医院", notes = "居民关注医院")
|
|
|
public Envelop followOrgByPatient(
|
|
|
@ApiParam(name = "patientid", value = "居民ID", defaultValue = "")
|
|
|
@RequestParam(value = "patientid", required = true) String patientid,
|
|
|
@ApiParam(name = "orgid", value = "医生ID", defaultValue = "")
|
|
|
@RequestParam(value = "orgid", required = true) String orgid,
|
|
|
@ApiParam(name = "type", value = "1关注 0取消关注", defaultValue = "")
|
|
|
@RequestParam(value = "type", required = true) String type
|
|
|
) throws Exception {
|
|
|
prescriptionService.followOrgByPatient(patientid, orgid, type);
|
|
|
return success("操作成功!");
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.Prescription.selectByGuidance)
|
|
|
@ApiOperation(value = "查询是否有导诊助手", notes = "查询是否有导诊助手")
|
|
|
public MixEnvelop selectByGuidance() throws Exception {
|
|
|
return MixEnvelop.getSuccessList("查询成功", doctorInfoService.selectByGuidance());
|
|
|
}
|
|
|
}
|