|
@ -129,6 +129,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
}
|
|
|
BaseDoorCoachOrderDO orderDO = null;
|
|
|
try {
|
|
|
System.out.println(jsonObjectParam.get("order").toString());
|
|
|
orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), BaseDoorCoachOrderDO.class);
|
|
|
} catch (Exception e) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
@ -149,7 +150,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
orderDO.setPayStatus(0);//待付款
|
|
|
// orderDO.setConclusionStatus(1);
|
|
|
|
|
|
if(StringUtils.isEmpty(orderDO.getPatient())){
|
|
|
if (StringUtils.isEmpty(orderDO.getPatient())) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "当前服务对象code为空,请联系管理员检查参数!patient = " + orderDO.getPatient();
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -157,7 +158,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isEmpty(orderDO.getProxyPatient())){
|
|
|
if (StringUtils.isEmpty(orderDO.getProxyPatient())) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "当前代理对象code为空,请联系管理员检查参数!proxyPatient = " + orderDO.getProxyPatient();
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -175,7 +176,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
BaseDoorCoachOrderDO.Status.accept.getType(),
|
|
|
});
|
|
|
|
|
|
if(bool){
|
|
|
if (bool) {
|
|
|
String failMsg = "当前服务对象存在未支付或未完成的上门预约,无法再次申请!";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -186,9 +187,9 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
orderDO.setHospital(jsonObjectParam.getJSONObject("hospital").get("code").toString());
|
|
|
orderDO.setCreateTime(new Date());
|
|
|
//判断创建上门预约类型,发起类型(1本人发起 2家人待预约 3医生代预约)
|
|
|
if(orderDO.getProxyPatient().equals(orderDO.getPatient())){
|
|
|
if (orderDO.getProxyPatient().equals(orderDO.getPatient())) {
|
|
|
orderDO.setType(1);
|
|
|
}else if(!orderDO.getProxyPatient().equals(orderDO.getPatient())){
|
|
|
} else if (!orderDO.getProxyPatient().equals(orderDO.getPatient())) {
|
|
|
orderDO.setType(2);
|
|
|
}
|
|
|
orderDO.setServiceStatus("1");
|
|
@ -208,25 +209,27 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
baseAdminServiceDynamic.setPhoto(patientDO.getPhoto());
|
|
|
}
|
|
|
baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
|
|
|
}catch (Exception e) {
|
|
|
} catch (Exception e) {
|
|
|
logger.info(e.getMessage());
|
|
|
}
|
|
|
|
|
|
this.save(orderDO);
|
|
|
result.put("orderId",orderDO.getId());
|
|
|
result.put("orderId", orderDO.getId());
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
|
result.put(ResponseContant.resultMsg, orderDO);
|
|
|
orderDO.setTotalFee(new BigDecimal(0));
|
|
|
//新增工单与服务项费用关联关系
|
|
|
if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,null)) {return result;}
|
|
|
if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO, null)) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//发起支付订单
|
|
|
payService.submitOrder(orderDO.getPatient(),"3",orderDO.getId(),orderDO.getTotalFee().doubleValue());
|
|
|
payService.submitOrder(orderDO.getPatient(), "3", orderDO.getId(), orderDO.getTotalFee().doubleValue());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
public JSONObject proxyCreate(String jsonData,String doctorCode) {
|
|
|
public JSONObject proxyCreate(String jsonData, String doctorCode) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
//医养暂无该功能--屏蔽
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
@ -337,25 +340,25 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
JSONObject result = new JSONObject();
|
|
|
try {
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderId);
|
|
|
if (businessOrderDO==null){
|
|
|
if (businessOrderDO == null) {
|
|
|
String failMsg = "未查询到该订单";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
BaseDoorCoachOrderDO orderDO= baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO!=null){
|
|
|
BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO != null) {
|
|
|
orderDO.setPayStatus(1);
|
|
|
orderDO.setPayWay(1);
|
|
|
orderDO.setPayTime(new Date());
|
|
|
if (orderDO.getType()== 3){//医生代预约
|
|
|
if (orderDO.getType() == 3) {//医生代预约
|
|
|
orderDO.setStatus(2);//待接单
|
|
|
this.save(orderDO);
|
|
|
// 给服务医生发接单消息
|
|
|
this.createMessage("服务工单待接单","707",orderDO.getProxyPatient(),orderDO.getProxyPatientName(), orderDO.getId(),orderDO.getDoctor(),orderDO.getDoctorName(), null,"您有新的服务工单,请前往处理");
|
|
|
this.createMessage("服务工单待接单", "707", orderDO.getProxyPatient(), orderDO.getProxyPatientName(), orderDO.getId(), orderDO.getDoctor(), orderDO.getDoctorName(), null, "您有新的服务工单,请前往处理");
|
|
|
//发送智能助手消息
|
|
|
sendWeixinMessage(4,orderDO.getDoctor(),orderDO.getPatient());
|
|
|
}else {
|
|
|
sendWeixinMessage(4, orderDO.getDoctor(), orderDO.getPatient());
|
|
|
} else {
|
|
|
//创建咨询
|
|
|
JSONObject successOrNot = null;
|
|
|
try {
|
|
@ -372,47 +375,46 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return JSONObject.parseObject(successOrNot.toString());
|
|
|
}
|
|
|
|
|
|
ConsultTeamDo consultTeam = (ConsultTeamDo)successOrNot.get(ResponseContant.resultMsg);
|
|
|
ConsultTeamDo consultTeam = (ConsultTeamDo) successOrNot.get(ResponseContant.resultMsg);
|
|
|
//发送智能助手消息
|
|
|
sendWeixinMessage(4,orderDO.getDoctor(),orderDO.getPatient());
|
|
|
sendWeixinMessage(4, orderDO.getDoctor(), orderDO.getPatient());
|
|
|
|
|
|
//发送 预约卡片信息(2201类型)
|
|
|
JSONObject orderInfoContent = this.queryOrderCardInfo(orderDO);
|
|
|
orderInfoContent.put("re_msg_type",0);//居民预约
|
|
|
orderInfoContent.put("re_msg_type", 0);//居民预约
|
|
|
this.qucikSendIM(orderDO.getId(), "system", "智能助手", "2201", orderInfoContent.toJSONString());
|
|
|
|
|
|
if(StringUtils.isNoneBlank(orderDO.getDoctor())){
|
|
|
if (StringUtils.isNoneBlank(orderDO.getDoctor())) {
|
|
|
//期望服务医生存在,直接转派
|
|
|
BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
|
|
|
sendOrderToDoctor(orderDO.getId(),null,"system","系统",transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName());
|
|
|
}else {
|
|
|
sendOrderToDoctor(orderDO.getId(), null, "system", "系统", transDoctor.getId(), transDoctor.getName(), transDoctor.getJobTitleName());
|
|
|
} else {
|
|
|
orderDO.setStatus(1);//待派单
|
|
|
this.save(orderDO);
|
|
|
JSONObject dispatcherJson = queryDispatcherInfoByPatient(orderDO.getHospital());
|
|
|
if (dispatcherJson.getInteger("resultFlag")==1){
|
|
|
List<Map<String,Object>> dispatcherInfoList = (List<Map<String, Object>>) dispatcherJson.get(ResponseContant.resultMsg);
|
|
|
for(Map<String,Object> map: dispatcherInfoList){
|
|
|
if (dispatcherJson.getInteger("resultFlag") == 1) {
|
|
|
List<Map<String, Object>> dispatcherInfoList = (List<Map<String, Object>>) dispatcherJson.get(ResponseContant.resultMsg);
|
|
|
for (Map<String, Object> map : dispatcherInfoList) {
|
|
|
String dispatcher = map.get("code").toString();
|
|
|
BaseDoctorDO doctorVO = doctorDao.findById(dispatcher);
|
|
|
// 派单消息-首页
|
|
|
this.createMessage("新增居民预约服务申请","702","system","system", orderDO.getId(), dispatcher,doctorVO.getName() ,doctorVO.getIdcard(), orderDO.getPatientName() + "提交了服务预约申请,请您前往处理");
|
|
|
this.createMessage("新增居民预约服务申请", "702", "system", "system", orderDO.getId(), dispatcher, doctorVO.getName(), doctorVO.getIdcard(), orderDO.getPatientName() + "提交了服务预约申请,请您前往处理");
|
|
|
// 派单-实时工单消息 430 居民提交工单申请-- 张三提交了服务工单12345678申请
|
|
|
this.createMessage("居民提交工单申请","730","system","system", orderDO.getId(), dispatcher,doctorVO.getName() ,doctorVO.getIdcard(), orderDO.getPatientName() + "提交了服务工单"+orderDO.getNumber()+"申请");
|
|
|
this.createMessage("居民提交工单申请", "730", "system", "system", orderDO.getId(), dispatcher, doctorVO.getName(), doctorVO.getIdcard(), orderDO.getPatientName() + "提交了服务工单" + orderDO.getNumber() + "申请");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
serviceNewsService.addServiceNews(orderDO.getPatientName(),orderDO.getPatient(),"1",null,orderId,1);
|
|
|
serviceNewsService.addServiceNews(orderDO.getPatientName(), orderDO.getPatient(), "1", null, orderId, 1);
|
|
|
String failMsg = "success";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
String failMsg = "工单不存在";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return result;
|
|
@ -422,8 +424,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
public JSONObject refundOrderAfter(String orderId) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
try {
|
|
|
BaseDoorCoachOrderDO orderDO= baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO == null){
|
|
|
BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO == null) {
|
|
|
String failMsg = "工单不存在";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -434,7 +436,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
String failMsg = "success";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return result;
|
|
@ -442,26 +444,27 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
/**
|
|
|
* 根据接单医生code获取最近一次服务orderId
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public String getOrderIdByPatient(String patient) {
|
|
|
String sql = "SELECT id as orderId from base_door_coach_order where patient=? and status in(1,2,3,4,5,6) ORDER BY patient_expected_serve_time desc,update_time desc,create_time desc, status ASC limit 1";
|
|
|
List<String> orderId = jdbcTemplate.queryForList(sql, String.class, new Object[]{patient});
|
|
|
if (orderId.size()>0){
|
|
|
if (orderId.size() > 0) {
|
|
|
return orderId.get(0);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> selectItemsByHospital(String hospital,String serverItemName){
|
|
|
String sql ="select org_code,dict_code code,dict_value name,ext1 fee from base_business_sys_dict where dict_name='DOOR_APPLY_ITEM' ";
|
|
|
if (StringUtils.isNotBlank(hospital)){
|
|
|
sql +=" and org_code='"+hospital+"' ";
|
|
|
public List<Map<String, Object>> selectItemsByHospital(String hospital, String serverItemName) {
|
|
|
String sql = "select org_code,dict_code code,dict_value name,ext1 fee from base_business_sys_dict where dict_name='DOOR_APPLY_ITEM' ";
|
|
|
if (StringUtils.isNotBlank(hospital)) {
|
|
|
sql += " and org_code='" + hospital + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(serverItemName)){
|
|
|
sql += " and dict_value like '%"+serverItemName+"%' ";
|
|
|
if (StringUtils.isNotBlank(serverItemName)) {
|
|
|
sql += " and dict_value like '%" + serverItemName + "%' ";
|
|
|
}
|
|
|
List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@ -471,7 +474,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject queryDoctorListWithNotStopped(String hospital,int page, int size) {
|
|
|
public JSONObject queryDoctorListWithNotStopped(String hospital, int page, int size) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
int start = 0 == page ? page++ : (page - 1) * size;
|
|
|
int end = 0 == size ? 15 : page * size;
|
|
@ -480,26 +483,26 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
" from base_door_coach_doctor_status ds " +
|
|
|
" JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code='" + hospital + "') d on ds.doctor = d.id " +
|
|
|
" where ds.status in (1,2,3,4) " +
|
|
|
" limit " + start + "," + end ;
|
|
|
" limit " + start + "," + end;
|
|
|
|
|
|
String countSql = "select DISTINCT count(ds.id) " +
|
|
|
"from base_door_coach_doctor_status ds " +
|
|
|
" JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code= '" + hospital + "') d on ds.doctor = d.id " +
|
|
|
" LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4) ";
|
|
|
List<Map<String,Object>> doctorList = new ArrayList<>();
|
|
|
List<Map<String, Object>> doctorList = new ArrayList<>();
|
|
|
try {
|
|
|
doctorList = jdbcTemplate.queryForList(sql);
|
|
|
} catch (Exception e) {
|
|
|
String failMsg = "从数据库查询 可接单状态的服务医生人员 列表信息失败:" + e.getMessage();
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,failMsg );
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
logger.error(failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
Integer count = 0;
|
|
|
try {
|
|
|
count = jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
|
count = jdbcTemplate.queryForObject(countSql, Integer.class);
|
|
|
} catch (Exception e) {
|
|
|
String failMsg = "从数据库统计 可接单状态的服务医生人员 数量失败:" + e.getMessage();
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
@ -548,25 +551,25 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
/**
|
|
|
* 删除出诊医生或服务项
|
|
|
* @param jsonObjectParam
|
|
|
* {
|
|
|
* "deleteItemArr":[
|
|
|
* {
|
|
|
* "id":""
|
|
|
* },
|
|
|
* {
|
|
|
* "id":""
|
|
|
* }
|
|
|
* ],
|
|
|
* "deleteDoctorArr":[
|
|
|
* {
|
|
|
* "id":""
|
|
|
* },
|
|
|
* {
|
|
|
* "id":""
|
|
|
* }
|
|
|
* ]
|
|
|
* }
|
|
|
*
|
|
|
* @param jsonObjectParam {
|
|
|
* "deleteItemArr":[
|
|
|
* {
|
|
|
* "id":""
|
|
|
* },
|
|
|
* {
|
|
|
* "id":""
|
|
|
* }
|
|
|
* ],
|
|
|
* "deleteDoctorArr":[
|
|
|
* {
|
|
|
* "id":""
|
|
|
* },
|
|
|
* {
|
|
|
* "id":""
|
|
|
* }
|
|
|
* ]
|
|
|
* }
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@ -578,10 +581,10 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
List<BaseDoorCoachFeeDetailDO> list = new ArrayList<>();
|
|
|
//删除的服务项要减去服务项费用
|
|
|
BigDecimal itemFee = new BigDecimal(0);
|
|
|
for(Object oneId : itemArray) {
|
|
|
for (Object oneId : itemArray) {
|
|
|
JSONObject oneIdJson = (JSONObject) oneId;
|
|
|
BaseDoorCoachFeeDetailDO doorFeeDetail = baseDoorCoachFeeDetailDao.findOne(String.valueOf(oneIdJson.get("id")));
|
|
|
if(doorFeeDetail.getPayStatus()==0){
|
|
|
if (doorFeeDetail.getPayStatus() == 0) {
|
|
|
doorFeeDetail.setStatus(3);
|
|
|
doorFeeDetail.setUpdateTime(new Date());
|
|
|
list.add(doorFeeDetail);
|
|
@ -618,7 +621,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
/**
|
|
|
* 查询预约简要卡片信息
|
|
|
*
|
|
|
* <p>
|
|
|
* 服务时间:2019-01-01 12:30
|
|
|
* 服务对象:张三
|
|
|
* 联系电话:13125256565(儿子)
|
|
@ -627,54 +630,56 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
* @param orderDO
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject queryOrderCardInfo(BaseDoorCoachOrderDO orderDO){
|
|
|
public JSONObject queryOrderCardInfo(BaseDoorCoachOrderDO orderDO) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("patientCode", orderDO.getPatient());
|
|
|
BasePatientDO patientDO = patientDao.findById(orderDO.getPatient());
|
|
|
result.put("title","预约服务信息如下:");
|
|
|
result.put("orderId",orderDO.getId());
|
|
|
result.put("status",orderDO.getStatus());
|
|
|
result.put("number",orderDO.getNumber());
|
|
|
result.put("serveDesc",orderDO.getServeDesc());
|
|
|
result.put("expectedDoctor",orderDO.getExpectedDoctorName());
|
|
|
result.put("serviceStatus",orderDO.getServiceStatus());
|
|
|
if(orderDO.getStatus() < 4){
|
|
|
if(StringUtils.isBlank(orderDO.getPatientExpectedServeTime())){
|
|
|
result.put("time","工作时间");
|
|
|
}else {
|
|
|
result.put("title", "预约服务信息如下:");
|
|
|
result.put("orderId", orderDO.getId());
|
|
|
result.put("status", orderDO.getStatus());
|
|
|
result.put("number", orderDO.getNumber());
|
|
|
result.put("serveDesc", orderDO.getServeDesc());
|
|
|
result.put("expectedDoctor", orderDO.getExpectedDoctorName());
|
|
|
result.put("serviceStatus", orderDO.getServiceStatus());
|
|
|
if (orderDO.getStatus() < 4) {
|
|
|
if (StringUtils.isBlank(orderDO.getPatientExpectedServeTime())) {
|
|
|
result.put("time", "工作时间");
|
|
|
} else {
|
|
|
result.put("time", orderDO.getPatientExpectedServeTime());
|
|
|
}
|
|
|
}else {
|
|
|
if(StringUtils.isBlank(orderDO.getDoctorArrivingTime())){
|
|
|
result.put("time","工作时间");
|
|
|
}else{
|
|
|
} else {
|
|
|
if (StringUtils.isBlank(orderDO.getDoctorArrivingTime())) {
|
|
|
result.put("time", "工作时间");
|
|
|
} else {
|
|
|
result.put("time", orderDO.getDoctorArrivingTime());
|
|
|
}
|
|
|
}
|
|
|
result.put("patientName",patientDO.getName());
|
|
|
result.put("patientName", patientDO.getName());
|
|
|
result.put("patientSex", IdCardUtil.getSexNameForIdcard_new(patientDO.getIdcard()));
|
|
|
result.put("patientAge", IdCardUtil.getAgeByIdcardOrBirthday(patientDO.getIdcard(),patientDO.getBirthday()));
|
|
|
result.put("phone",orderDO.getPatientPhone());
|
|
|
result.put("serveDesc",orderDO.getServeDesc());
|
|
|
if(StringUtils.equalsIgnoreCase(orderDO.getPatient(),orderDO.getProxyPatient())){
|
|
|
result.put("relation","");
|
|
|
}else{
|
|
|
result.put("relation",orderDO.getPatientRelation());
|
|
|
}
|
|
|
result.put("serveTown",orderDO.getServeTown());
|
|
|
result.put("serveAddress",orderDO.getServeAddress());
|
|
|
result.put("type",21);
|
|
|
result.put("patientAge", IdCardUtil.getAgeByIdcardOrBirthday(patientDO.getIdcard(), patientDO.getBirthday()));
|
|
|
result.put("phone", orderDO.getPatientPhone());
|
|
|
result.put("serveDesc", orderDO.getServeDesc());
|
|
|
if (StringUtils.equalsIgnoreCase(orderDO.getPatient(), orderDO.getProxyPatient())) {
|
|
|
result.put("relation", "");
|
|
|
} else {
|
|
|
result.put("relation", orderDO.getPatientRelation());
|
|
|
}
|
|
|
result.put("serveTown", orderDO.getServeTown());
|
|
|
result.put("serveAddress", orderDO.getServeAddress());
|
|
|
result.put("type", 21);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 【调度员,医生】快速发送IM消息
|
|
|
*
|
|
|
* @param orderId
|
|
|
* @param sendId
|
|
|
* @param sendName
|
|
|
* @param content
|
|
|
* @return
|
|
|
*/
|
|
|
public int qucikSendIM(String orderId,String sendId,String sendName,String contentType,String content) {
|
|
|
public int qucikSendIM(String orderId, String sendId, String sendName, String contentType, String content) {
|
|
|
int result = -1;
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
if (null == consult) {
|
|
@ -685,14 +690,14 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
BaseDoorCoachOrderDO baseDoorCoachOrderDO = null;
|
|
|
String response = null;
|
|
|
|
|
|
if(StringUtils.isBlank(sendId)){
|
|
|
if (StringUtils.isBlank(sendId)) {
|
|
|
baseDoorCoachOrderDO = baseDoorCoachOrderDao.findOne(orderId);
|
|
|
String sender = "system";
|
|
|
if(StringUtils.isNoneBlank(baseDoorCoachOrderDO.getDispatcher())){
|
|
|
if (StringUtils.isNoneBlank(baseDoorCoachOrderDO.getDispatcher())) {
|
|
|
sender = baseDoorCoachOrderDO.getDispatcher();
|
|
|
}
|
|
|
response = imUtill.sendTopicIM(sender, "智能助手", consult.getId(), contentType, content, null);
|
|
|
}else{
|
|
|
} else {
|
|
|
response = imUtill.sendTopicIM(sendId, sendName, consult.getId(), contentType, content, null);
|
|
|
}
|
|
|
JSONObject resObj = JSONObject.parseObject(response);
|
|
@ -712,11 +717,11 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public JSONObject sendOrderToDoctor(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName){
|
|
|
public JSONObject sendOrderToDoctor(String orderId, String remark, String dispatcher, String dispathcherName, String doctor, String doctorName, String doctorJobName) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
BaseDoorCoachOrderDO doorServiceOrderDO = baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if(null == doorServiceOrderDO){
|
|
|
if (null == doorServiceOrderDO) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "当前工单不存在,id:" + orderId;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -724,19 +729,19 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
BaseDoorCoachDoctorStatusDO doorDoctorStatusDO = baseDoorCoachDoctorStatusDao.queryByDoctorAndStatusIn(doctor,new Integer[]{BaseDoorCoachOrderDO.Status.waitForSend.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO doorDoctorStatusDO = baseDoorCoachDoctorStatusDao.queryByDoctorAndStatusIn(doctor, new Integer[]{BaseDoorCoachOrderDO.Status.waitForSend.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO.Status.waitForAccept.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO.Status.waitForServe.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO.Status.serving.getType(),
|
|
|
});
|
|
|
if(null == doorDoctorStatusDO){
|
|
|
if (null == doorDoctorStatusDO) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "当前派单的医生不存在或禁止接单,doctor:" + doctor;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
logger.error(failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(remark)&&!"null".equals(remark)){
|
|
|
if (StringUtils.isNotBlank(remark) && !"null".equals(remark)) {
|
|
|
doorServiceOrderDO.setRemark(remark);
|
|
|
}
|
|
|
doorServiceOrderDO.setDoctor(doctor);
|
|
@ -751,19 +756,19 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
this.save(doorServiceOrderDO);
|
|
|
|
|
|
// 给医生发派单消息
|
|
|
if(BaseDoorCoachOrderDO.IsTransOtherOrg.yes.getType().equals(doorServiceOrderDO.getIsTransOtherOrg())){
|
|
|
this.createMessage("服务工单待接单","707",doorServiceOrderDO.getTransedDispatcher(),doorServiceOrderDO.getTransedDispatcherName(), orderId,doctor,doctorName, null,"您有新的服务工单,请前往处理");
|
|
|
}else{
|
|
|
this.createMessage("服务工单待接单","707",doorServiceOrderDO.getDispatcher(),doorServiceOrderDO.getDispatcherName(), orderId,doctor,doctorName, null,"您有新的服务工单,请前往处理");
|
|
|
if (BaseDoorCoachOrderDO.IsTransOtherOrg.yes.getType().equals(doorServiceOrderDO.getIsTransOtherOrg())) {
|
|
|
this.createMessage("服务工单待接单", "707", doorServiceOrderDO.getTransedDispatcher(), doorServiceOrderDO.getTransedDispatcherName(), orderId, doctor, doctorName, null, "您有新的服务工单,请前往处理");
|
|
|
} else {
|
|
|
this.createMessage("服务工单待接单", "707", doorServiceOrderDO.getDispatcher(), doorServiceOrderDO.getDispatcherName(), orderId, doctor, doctorName, null, "您有新的服务工单,请前往处理");
|
|
|
}
|
|
|
//发送智能助手消息//·
|
|
|
sendWeixinMessage(4,doctor,doorServiceOrderDO.getPatient());
|
|
|
sendWeixinMessage(4, doctor, doorServiceOrderDO.getPatient());
|
|
|
|
|
|
// 派单时,把医生拉入会话,作为其中一个成员,医生拒单时,退出会话
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
String sessionId = doorServiceOrderDO.getPatient() + "_" + consult.getType();
|
|
|
imUtill.updateParticipantNew(sessionId,doctor,null);
|
|
|
messageUtil.updateDoorCoachMessage(doorServiceOrderDO,new String[]{"702","703","730","735"},"731",dispatcher,dispatcher);
|
|
|
imUtill.updateParticipantNew(sessionId, doctor, null);
|
|
|
messageUtil.updateDoorCoachMessage(doorServiceOrderDO, new String[]{"702", "703", "730", "735"}, "731", dispatcher, dispatcher);
|
|
|
|
|
|
// 工单状态变更记录
|
|
|
BaseDoorCoachProcessLogDO processLogDO = new BaseDoorCoachProcessLogDO();
|
|
@ -778,8 +783,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
result.put(ResponseContant.resultMsg, doorServiceOrderDO);
|
|
|
|
|
|
// 发送IM消息通知患者医生已派单
|
|
|
String noticeContent = "已分派"+doorServiceOrderDO.getDoctorName()+"医生为您服务,请耐心等待医生接单";
|
|
|
this.qucikSendIM(doorServiceOrderDO.getId(), doorServiceOrderDO.getDispatcher(), "智能助手","1", noticeContent);
|
|
|
String noticeContent = "已分派" + doorServiceOrderDO.getDoctorName() + "医生为您服务,请耐心等待医生接单";
|
|
|
this.qucikSendIM(doorServiceOrderDO.getId(), doorServiceOrderDO.getDispatcher(), "智能助手", "1", noticeContent);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -791,10 +796,10 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public JSONObject transferOrder(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName){
|
|
|
public JSONObject transferOrder(String orderId, String remark, String dispatcher, String dispathcherName, String doctor, String doctorName, String doctorJobName) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
BaseDoorCoachOrderDO doorServiceOrderDO = baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if(null == doorServiceOrderDO){
|
|
|
if (null == doorServiceOrderDO) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "当前工单不存在,id:" + orderId;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -802,12 +807,12 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
BaseDoorCoachDoctorStatusDO doorDoctorStatusDO = baseDoorCoachDoctorStatusDao.queryByDoctorAndStatusIn(doctor,new Integer[]{BaseDoorCoachDoctorStatusDO.Status.waitForSend.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO doorDoctorStatusDO = baseDoorCoachDoctorStatusDao.queryByDoctorAndStatusIn(doctor, new Integer[]{BaseDoorCoachDoctorStatusDO.Status.waitForSend.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO.Status.waitForAccept.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO.Status.waitForServe.getType(),
|
|
|
BaseDoorCoachDoctorStatusDO.Status.serving.getType(),
|
|
|
});
|
|
|
if(null == doorDoctorStatusDO){
|
|
|
if (null == doorDoctorStatusDO) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "当前转派单的医生不存在或禁止接单,doctor:" + doctor;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -824,26 +829,26 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
doorServiceOrderDO.setUpdateUserName(dispathcherName);
|
|
|
doorServiceOrderDO.setDispatcherResponseTime(new Date());
|
|
|
|
|
|
System.out.println(dispathcherName+"医生派单给"+doctorName+"医生");
|
|
|
System.out.println(dispathcherName + "医生派单给" + doctorName + "医生");
|
|
|
// String sql = "DELETE FROM wlyy_door_doctor WHERE order_id ='"+orderId+"' AND doctor = '"+dispatcher+"'";
|
|
|
// jdbcTemplate.execute(sql);
|
|
|
this.save(doorServiceOrderDO);
|
|
|
|
|
|
// 给医生发派单消息
|
|
|
if(BaseDoorCoachOrderDO.IsTransOtherOrg.yes.getType().equals(doorServiceOrderDO.getIsTransOtherOrg())){
|
|
|
this.createMessage("服务工单待接单","707",doorServiceOrderDO.getTransedDispatcher(),doorServiceOrderDO.getTransedDispatcherName(), orderId,doctor,doctorName, null,"您有新的服务工单,请前往处理");
|
|
|
}else{
|
|
|
this.createMessage("服务工单待接单","707",doorServiceOrderDO.getDispatcher(),doorServiceOrderDO.getDispatcherName(), orderId,doctor,doctorName, null,"您有新的服务工单,请前往处理");
|
|
|
if (BaseDoorCoachOrderDO.IsTransOtherOrg.yes.getType().equals(doorServiceOrderDO.getIsTransOtherOrg())) {
|
|
|
this.createMessage("服务工单待接单", "707", doorServiceOrderDO.getTransedDispatcher(), doorServiceOrderDO.getTransedDispatcherName(), orderId, doctor, doctorName, null, "您有新的服务工单,请前往处理");
|
|
|
} else {
|
|
|
this.createMessage("服务工单待接单", "707", doorServiceOrderDO.getDispatcher(), doorServiceOrderDO.getDispatcherName(), orderId, doctor, doctorName, null, "您有新的服务工单,请前往处理");
|
|
|
}
|
|
|
//发送智能助手消息
|
|
|
sendWeixinMessage(4,doctor,doorServiceOrderDO.getPatient());
|
|
|
sendWeixinMessage(4, doctor, doorServiceOrderDO.getPatient());
|
|
|
|
|
|
// 派单时,把医生拉入会话,作为其中一个成员,医生拒单时,退出会话
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
String sessionId = doorServiceOrderDO.getPatient() + "_" + consult.getType();
|
|
|
imUtill.updateParticipantNew(sessionId,doctor,null);
|
|
|
imUtill.updateParticipantNew(sessionId, doctor, null);
|
|
|
|
|
|
messageUtil.updateDoorCoachMessage(doorServiceOrderDO,new String[]{"702","703","730","735"},"731",dispatcher,dispatcher);
|
|
|
messageUtil.updateDoorCoachMessage(doorServiceOrderDO, new String[]{"702", "703", "730", "735"}, "731", dispatcher, dispatcher);
|
|
|
|
|
|
// 工单状态变更记录
|
|
|
BaseDoorCoachProcessLogDO processLogDO = new BaseDoorCoachProcessLogDO();
|
|
@ -858,29 +863,30 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
result.put(ResponseContant.resultMsg, doorServiceOrderDO);
|
|
|
|
|
|
// 发送IM消息通知患者医生已派单
|
|
|
String noticeContent = "已转派"+doorServiceOrderDO.getDoctorName()+"医生为您服务,请耐心等待医生接单";
|
|
|
this.qucikSendIM(doorServiceOrderDO.getId(), dispatcher, "智能助手","1", noticeContent);
|
|
|
String noticeContent = "已转派" + doorServiceOrderDO.getDoctorName() + "医生为您服务,请耐心等待医生接单";
|
|
|
this.qucikSendIM(doorServiceOrderDO.getId(), dispatcher, "智能助手", "1", noticeContent);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取消工单
|
|
|
*
|
|
|
* @param orderId
|
|
|
* @param type 取消类型
|
|
|
* @param reason 取消理由
|
|
|
* @param type 取消类型
|
|
|
* @param reason 取消理由
|
|
|
*/
|
|
|
public JSONObject cancelOrder(String orderId,int type,String reason,String dispatcher,String dispatcherName){
|
|
|
public JSONObject cancelOrder(String orderId, int type, String reason, String dispatcher, String dispatcherName) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if(null == orderDO){
|
|
|
if (null == orderDO) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "【取消工单】该工单不存在:," + orderId;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
logger.error(failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
if(type==2){//v0.5.1 患者仅未支付的订单能取消此时未正式开始工单,未创建咨询
|
|
|
if(orderDO.getStatus() != BaseDoorCoachOrderDO.Status.waitForPay.getType()){
|
|
|
if (type == 2) {//v0.5.1 患者仅未支付的订单能取消此时未正式开始工单,未创建咨询
|
|
|
if (orderDO.getStatus() != BaseDoorCoachOrderDO.Status.waitForPay.getType()) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "无法取消工单,已支付的工单需要到我的订单中进行申请退款," + orderId;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -890,60 +896,59 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderDO.getId());
|
|
|
businessOrderDO.setStatus(2);
|
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
}else{//调度员拒单,此时工单已支付抵达调度员
|
|
|
} else {//调度员拒单,此时工单已支付抵达调度员
|
|
|
try {
|
|
|
if (orderDO.getStatus() > BaseDoorCoachOrderDO.Status.waitForPay.getType()&&1==orderDO.getPayWay()){
|
|
|
if (orderDO.getStatus() > BaseDoorCoachOrderDO.Status.waitForPay.getType() && 1 == orderDO.getPayWay()) {
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderDO.getId());
|
|
|
if (businessOrderDO!=null){
|
|
|
if (businessOrderDO != null) {
|
|
|
//1.4.2 上门辅导费用0时 无需走退款流程
|
|
|
if (1 == businessOrderDO.getStatus()&&businessOrderDO.getPayPrice()>0.0){
|
|
|
if (1 == businessOrderDO.getStatus() && businessOrderDO.getPayPrice() > 0.0) {
|
|
|
//退款流程
|
|
|
try {
|
|
|
payService.dispatcherOrderRefund(businessOrderDO.getOrderNo(),"调度员拒单退款");
|
|
|
payService.dispatcherOrderRefund(businessOrderDO.getOrderNo(), "调度员拒单退款");
|
|
|
orderDO.setPayStatus(2);
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,"退款失败,无法拒绝工单!");
|
|
|
result.put(ResponseContant.resultMsg, "退款失败,无法拒绝工单!");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//如果是调度员取消,推送IM取消工单json消息,
|
|
|
if (StringUtils.isNotBlank(dispatcher)){
|
|
|
if (!consultTeamService.finishConsult(orderDO.getId(),orderDO.getPatient(),dispatcher,2)){
|
|
|
if (StringUtils.isNotBlank(dispatcher)) {
|
|
|
if (!consultTeamService.finishConsult(orderDO.getId(), orderDO.getPatient(), dispatcher, 2)) {
|
|
|
String failMsg = "咨询结束失败 无法取消工单";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,failMsg);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(dispatcher)){
|
|
|
if (!StringUtils.isEmpty(dispatcher)) {
|
|
|
orderDO.setDoctor(dispatcher);
|
|
|
orderDO.setDoctorName(dispatcherName);
|
|
|
orderDO.setDispatcher(dispatcher);
|
|
|
orderDO.setDispatcherName(dispatcherName);
|
|
|
}
|
|
|
if(type == BaseDoorCoachOrderDO.CancelType.dispatcher.getType()){
|
|
|
messageUtil.updateDoorCoachMessage(orderDO,new String[]{"702","703","730"},"732",dispatcher,dispatcher);
|
|
|
}
|
|
|
else if(type == BaseDoorCoachOrderDO.CancelType.patient.getType()){ //居民取消,消息列表也应该不显示
|
|
|
messageUtil.updateDoorCoachMessage(orderDO,new String[]{"702","703","730"},"patientCancel",dispatcher,dispatcher);
|
|
|
if (type == BaseDoorCoachOrderDO.CancelType.dispatcher.getType()) {
|
|
|
messageUtil.updateDoorCoachMessage(orderDO, new String[]{"702", "703", "730"}, "732", dispatcher, dispatcher);
|
|
|
} else if (type == BaseDoorCoachOrderDO.CancelType.patient.getType()) { //居民取消,消息列表也应该不显示
|
|
|
messageUtil.updateDoorCoachMessage(orderDO, new String[]{"702", "703", "730"}, "patientCancel", dispatcher, dispatcher);
|
|
|
}
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
// 发送微信模板消息,通知居民工单已取消(smyyyqx-上门预约已取消)
|
|
|
String first = "key1您好,您的上门预约订单已退回,点击查看原因";
|
|
|
BasePatientDO patient = patientDao.findById(orderDO.getPatient());
|
|
|
first = first.replace("key1", null != patient.getName() ? patient.getName() : "");
|
|
|
first = first.replace("key1", null != patient.getName() ? patient.getName() : "");
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", orderDO.getId());
|
|
|
List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
|
|
|
if (basePatientWechatDos.size()>0){
|
|
|
List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId, patient.getId());
|
|
|
if (basePatientWechatDos.size() > 0) {
|
|
|
String openId = basePatientWechatDos.get(0).getOpenid();
|
|
|
messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,null,null,2,json, DateUtil.dateToChineseDate(new Date()),"上门预约已取消","已取消");
|
|
|
messageUtil.putTemplateWxMessage(wxId, "template_process_feedback", "smyyyqx", openId, first, null, null, 2, json, DateUtil.dateToChineseDate(new Date()), "上门预约已取消", "已取消");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
String failMsg = "退款失败,无法取消工单:," + orderId;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -969,14 +974,14 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
//保存居民确认取消记录
|
|
|
JSONObject confirmInfo = new JSONObject();
|
|
|
confirmInfo.put("orderId",orderId);
|
|
|
confirmInfo.put("patient",orderDO.getProxyPatient());
|
|
|
confirmInfo.put("patientName",orderDO.getProxyPatientName());
|
|
|
confirmInfo.put("type",4);
|
|
|
confirmInfo.put("description",reason);
|
|
|
confirmInfo.put("orderId", orderId);
|
|
|
confirmInfo.put("patient", orderDO.getProxyPatient());
|
|
|
confirmInfo.put("patientName", orderDO.getProxyPatientName());
|
|
|
confirmInfo.put("type", 4);
|
|
|
confirmInfo.put("description", reason);
|
|
|
JSONObject confirmInfoJson = new JSONObject();
|
|
|
confirmInfoJson.put("confirmInfo",confirmInfo);
|
|
|
this.orderWithConfirmLogAdd(result,confirmInfo,orderId);
|
|
|
confirmInfoJson.put("confirmInfo", confirmInfo);
|
|
|
this.orderWithConfirmLogAdd(result, confirmInfo, orderId);
|
|
|
|
|
|
|
|
|
// 工单状态变更记录
|
|
@ -994,14 +999,14 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
/**
|
|
|
* 服务工单居民确认操作日志记录
|
|
|
*
|
|
|
* <p>
|
|
|
* {
|
|
|
* "confirmInfo":{
|
|
|
* "patient":"",
|
|
|
* "patientName":"",
|
|
|
* "type":"",
|
|
|
* "description":""
|
|
|
* }
|
|
|
* "confirmInfo":{
|
|
|
* "patient":"",
|
|
|
* "patientName":"",
|
|
|
* "type":"",
|
|
|
* "description":""
|
|
|
* }
|
|
|
* }
|
|
|
*
|
|
|
* @param result
|
|
@ -1039,8 +1044,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public void sendWeixinMessage(Integer type,String doctorCode,String patient){
|
|
|
if (type==3){
|
|
|
public void sendWeixinMessage(Integer type, String doctorCode, String patient) {
|
|
|
if (type == 3) {
|
|
|
//上门预约申请
|
|
|
try {
|
|
|
/* WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","zztj");
|
|
@ -1065,7 +1070,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}else if (type==4){
|
|
|
} else if (type == 4) {
|
|
|
try {
|
|
|
//社区调度员指派服务工单给家签医生
|
|
|
/* WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","zztj");
|
|
@ -1096,6 +1101,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
/**
|
|
|
* 调度员进入聊天室
|
|
|
*
|
|
|
* @param dispatcher
|
|
|
* @param orderId
|
|
|
*/
|
|
@ -1110,21 +1116,23 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return result;
|
|
|
}
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
String sessionId = orderDO.getPatient() + "_" + consult.getType();
|
|
|
String sessionId = orderDO.getPatient() + "_" + consult.getType();
|
|
|
// 把调度员拉入会话,作为其中一个成员,第一个进入会话的调度员,系统发送欢迎语和居民的预约卡片信息
|
|
|
if (org.apache.commons.lang3.StringUtils.isEmpty(orderDO.getDispatcher())) {
|
|
|
orderDO.setDispatcher(dispatcher);
|
|
|
orderDO.setDispatcherName(dispatcherName);
|
|
|
this.save(orderDO);
|
|
|
// 先进入会话,再聊天
|
|
|
imUtill.updateParticipantNew(sessionId,dispatcher,null);
|
|
|
String imMsg = imUtill.updateParticipantNew(sessionId, dispatcher, null);
|
|
|
System.out.println("先进入会话,再聊天==>" + imMsg);
|
|
|
String noticeContent = hospitalName + dispatcherName + "为您服务";
|
|
|
this.qucikSendIM(orderId, dispatcher, "智能助手", "1", noticeContent);
|
|
|
}
|
|
|
// 把调度员拉入会话,作为其中一个成员
|
|
|
imUtill.updateParticipantNew(sessionId,dispatcher,null);
|
|
|
String imMsg = imUtill.updateParticipantNew(sessionId, dispatcher, null);
|
|
|
System.out.println("把调度员拉入会话,作为其中一个成员:" + imMsg);
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
|
result.put(ResponseContant.resultMsg, "调度员["+dispatcherName+"]进入会话成功");
|
|
|
result.put(ResponseContant.resultMsg, "调度员[" + dispatcherName + "]进入会话成功");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -1133,30 +1141,28 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
*
|
|
|
* @param result
|
|
|
* @param jsonObjectParam
|
|
|
* @param order
|
|
|
* {
|
|
|
* "packageItemArr":[
|
|
|
* {
|
|
|
* "type": null,
|
|
|
* "code": null,
|
|
|
* "name": null,
|
|
|
* "fee": null,
|
|
|
* "feeDiscount": null,
|
|
|
* "number": null,
|
|
|
* "status": null
|
|
|
* },
|
|
|
* ],
|
|
|
* "orderId": null,
|
|
|
* "status":""
|
|
|
* }
|
|
|
*
|
|
|
* @param order {
|
|
|
* "packageItemArr":[
|
|
|
* {
|
|
|
* "type": null,
|
|
|
* "code": null,
|
|
|
* "name": null,
|
|
|
* "fee": null,
|
|
|
* "feeDiscount": null,
|
|
|
* "number": null,
|
|
|
* "status": null
|
|
|
* },
|
|
|
* ],
|
|
|
* "orderId": null,
|
|
|
* "status":""
|
|
|
* }
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean orderWithPackageItemFeeAdd(JSONObject result, JSONObject jsonObjectParam, BaseDoorCoachOrderDO order, String doctorId) {
|
|
|
List<BaseDoorCoachFeeDetailDO> feeDetailDOList = new ArrayList<>();
|
|
|
BigDecimal totalFee = order.getTotalFee();
|
|
|
if(null == totalFee){
|
|
|
if (null == totalFee) {
|
|
|
totalFee = new BigDecimal(0);
|
|
|
}
|
|
|
|
|
@ -1167,7 +1173,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
if (!CollectionUtils.isEmpty(packageItemArray)) {
|
|
|
for (Object one : packageItemArray) {
|
|
|
BaseDoorCoachFeeDetailDO feeDetailDO = null;
|
|
|
JSONObject oneJson = (JSONObject)one;
|
|
|
JSONObject oneJson = (JSONObject) one;
|
|
|
try {
|
|
|
feeDetailDO = EntityUtils.jsonToEntity(one.toString(), BaseDoorCoachFeeDetailDO.class);
|
|
|
} catch (Exception e) {
|
|
@ -1190,20 +1196,20 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
// 服务项可能一开始由居民预约,后期由医生新增或医生删除
|
|
|
Integer status = jsonObjectParam.getInteger("status");
|
|
|
if(null == status || status == 1){
|
|
|
if (null == status || status == 1) {
|
|
|
feeDetailDO.setStatus(BaseDoorCoachFeeDetailDO.Status.patient.getType());
|
|
|
}else{
|
|
|
} else {
|
|
|
feeDetailDO.setStatus(status);
|
|
|
}
|
|
|
|
|
|
// feeDetailDO.setNumber(1);
|
|
|
feeDetailDO.setOrderId(order.getId());
|
|
|
if(StringUtils.isBlank(feeDetailDO.getId())) {
|
|
|
if (StringUtils.isBlank(feeDetailDO.getId())) {
|
|
|
feeDetailDO.setCreateTime(new Date());
|
|
|
}else {
|
|
|
} else {
|
|
|
feeDetailDO.setUpdateTime(new Date());
|
|
|
}
|
|
|
if(StringUtils.isBlank(feeDetailDO.getId())){
|
|
|
if (StringUtils.isBlank(feeDetailDO.getId())) {
|
|
|
feeDetailDO.setPayStatus(0);
|
|
|
addNum++;
|
|
|
feeDetailDOList.add(feeDetailDO);
|
|
@ -1225,8 +1231,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> queryDispatcherInfoByHospital(String hospital){
|
|
|
String sql =" SELECT" +
|
|
|
public List<Map<String, Object>> queryDispatcherInfoByHospital(String hospital) {
|
|
|
String sql = " SELECT" +
|
|
|
" d.`code`, " +
|
|
|
" d.`name`, " +
|
|
|
" d.`hospital_name` as hospitalName " +
|
|
@ -1234,7 +1240,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
" base_doctor_role m " +
|
|
|
" JOIN base_doctor_role_dict r ON m.role_code = r.code " +
|
|
|
" JOIN (select a.id code,a.name,o.org_name hospital_name from base_doctor_hospital o,base_doctor a " +
|
|
|
" where a.id = o.doctor_code and o.del=1 and o.org_code = '"+hospital+"') as d ON m.doctor_code = d.code" +
|
|
|
" where a.id = o.doctor_code and o.del=1 and o.org_code = '" + hospital + "') as d ON m.doctor_code = d.code" +
|
|
|
" WHERE " +
|
|
|
" r.code = 'dispatcher'";
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
@ -1243,6 +1249,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
/**
|
|
|
* 获取居民所签约的机构的调度员(一个机构可以有多个调度员)
|
|
|
* doctor中,level -- 11-- 调度员
|
|
|
*
|
|
|
* @param hospitalCode
|
|
|
* @return
|
|
|
*/
|
|
@ -1250,8 +1257,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
public JSONObject queryDispatcherInfoByPatient(String hospitalCode) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
List<Map<String,Object>> dispatcherInfoList = queryDispatcherInfoByHospital(hospitalCode);
|
|
|
if(CollectionUtils.isEmpty(dispatcherInfoList)){
|
|
|
List<Map<String, Object>> dispatcherInfoList = queryDispatcherInfoByHospital(hospitalCode);
|
|
|
if (CollectionUtils.isEmpty(dispatcherInfoList)) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "当前居民所签约机构【" + hospitalCode + "】没有调度员,请联系管理员分配!";
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
@ -1267,11 +1274,12 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
/**
|
|
|
* 顶部状态栏订单各分类总条数
|
|
|
*
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String, Integer> getNumGroupByStatus(String patient) throws Exception {
|
|
|
String sql = "SELECT a.status, COUNT(DISTINCT a.id) as num FROM base_door_coach_order a where a.patient = '"+patient+"' group BY a.status " ;
|
|
|
String sql = "SELECT a.status, COUNT(DISTINCT a.id) as num FROM base_door_coach_order a where a.patient = '" + patient + "' group BY a.status ";
|
|
|
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
Map<String, Integer> map = new HashMap<>();
|
|
@ -1282,49 +1290,48 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
Integer served = 0;//已完成
|
|
|
Integer cancel = 0;//已取消
|
|
|
// -1已取消 [1,4]待服务 [5,6]已服务
|
|
|
for (Map<String, Object> tmp:list){
|
|
|
switch (String.valueOf(tmp.get("status"))){
|
|
|
for (Map<String, Object> tmp : list) {
|
|
|
switch (String.valueOf(tmp.get("status"))) {
|
|
|
case "-1":
|
|
|
cancel += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
cancel += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
case "0":
|
|
|
waitForPay += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
waitForPay += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
case "1":
|
|
|
waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
waitForAccept += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
case "2":
|
|
|
waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
waitForAccept += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
case "3":
|
|
|
waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
waitForServe += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
case "4":
|
|
|
waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
waitForServe += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
case "5":
|
|
|
waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
waitForServe += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
case "6":
|
|
|
served += Integer.valueOf(tmp.get("num").toString()) ;
|
|
|
served += Integer.valueOf(tmp.get("num").toString());
|
|
|
break;
|
|
|
default: {
|
|
|
throw new Exception("类型错误!"+String.valueOf(tmp.get("status")));
|
|
|
throw new Exception("类型错误!" + String.valueOf(tmp.get("status")));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
all = waitForAccept+waitForServe+served+cancel;
|
|
|
map.put("all",all);
|
|
|
map.put("waitForPay",waitForPay);
|
|
|
map.put("waitForAccept",waitForAccept);
|
|
|
map.put("waitForServe",waitForServe);
|
|
|
map.put("served",served);
|
|
|
map.put("cancel",cancel);
|
|
|
all = waitForAccept + waitForServe + served + cancel;
|
|
|
map.put("all", all);
|
|
|
map.put("waitForPay", waitForPay);
|
|
|
map.put("waitForAccept", waitForAccept);
|
|
|
map.put("waitForServe", waitForServe);
|
|
|
map.put("served", served);
|
|
|
map.put("cancel", cancel);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param orderId
|
|
|
* @param patientName
|
|
|
* @param patientPhone
|
|
@ -1342,111 +1349,126 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
*/
|
|
|
public JSONObject getDoorOrderList(String orderId, String patientName, String patientPhone, String hospitalCode,
|
|
|
StringBuffer status, String createTimeStart, String createTimeEnd, String serverDoctorName,
|
|
|
String patientId, Integer page, Integer pageSize, Integer type)throws Exception{
|
|
|
String patientId, Integer page, Integer pageSize, Integer type) throws Exception {
|
|
|
String sqlList = "select DISTINCT o.id as orderId,o.status,h.code orgCode,h.name as orgName,o.is_trans_other_org," +
|
|
|
"o.transed_org_code, o.patient_name, o.patient_phone,o.remark,o.serve_desc,o.create_time,o.patient as patientCode," +
|
|
|
"o.exam_paper_status as examPaperStatus,o.number as serverCode,o.total_fee,h.org_level as hosLevel, o.doctor," +
|
|
|
"o.doctor_name as doctorName, o.doctor_type as doctorType"
|
|
|
;
|
|
|
"o.doctor_name as doctorName, o.doctor_type as doctorType";
|
|
|
String sqlCount = " select count(DISTINCT o.id) as total ";
|
|
|
|
|
|
String sql = " from base_door_coach_order o LEFT JOIN base_org h on h.code=o.hospital and h.del=1 where 1=1";
|
|
|
|
|
|
if(!org.apache.commons.lang.StringUtils.isEmpty(orderId)){
|
|
|
sql+=" and o.number = '"+orderId+"'";
|
|
|
if (!org.apache.commons.lang.StringUtils.isEmpty(orderId)) {
|
|
|
sql += " and o.number = '" + orderId + "'";
|
|
|
}
|
|
|
if(!org.apache.commons.lang.StringUtils.isEmpty(patientName)){
|
|
|
sql+=" and o.patient_name like '%"+patientName+"%'";
|
|
|
if (!org.apache.commons.lang.StringUtils.isEmpty(patientName)) {
|
|
|
sql += " and o.patient_name like '%" + patientName + "%'";
|
|
|
}
|
|
|
if(!org.apache.commons.lang.StringUtils.isEmpty(patientPhone)){
|
|
|
sql+=" and o.patient_phone ='"+patientPhone+"'";
|
|
|
if (!org.apache.commons.lang.StringUtils.isEmpty(patientPhone)) {
|
|
|
sql += " and o.patient_phone ='" + patientPhone + "'";
|
|
|
}
|
|
|
if(!org.apache.commons.lang.StringUtils.isEmpty(hospitalCode)&&!"350200%".equals(hospitalCode)){
|
|
|
sql+=" and (o.hospital like '"+hospitalCode+"' or o.transed_org_code like '"+hospitalCode+"') ";
|
|
|
if (!org.apache.commons.lang.StringUtils.isEmpty(hospitalCode) && !"350200%".equals(hospitalCode)) {
|
|
|
sql += " and (o.hospital like '" + hospitalCode + "' or o.transed_org_code like '" + hospitalCode + "') ";
|
|
|
}
|
|
|
if(status!=null){
|
|
|
sql+=" and o.status in ("+status+")";
|
|
|
if (status != null) {
|
|
|
sql += " and o.status in (" + status + ")";
|
|
|
}
|
|
|
if(!org.apache.commons.lang.StringUtils.isEmpty(createTimeStart)){
|
|
|
sql+=" and o.create_time >='"+createTimeStart+"'";
|
|
|
if (!org.apache.commons.lang.StringUtils.isEmpty(createTimeStart)) {
|
|
|
sql += " and o.create_time >='" + createTimeStart + "'";
|
|
|
}
|
|
|
if(!org.apache.commons.lang.StringUtils.isEmpty(createTimeEnd)){
|
|
|
sql+=" and o.create_time <='"+createTimeEnd+"'";
|
|
|
if (!org.apache.commons.lang.StringUtils.isEmpty(createTimeEnd)) {
|
|
|
sql += " and o.create_time <='" + createTimeEnd + "'";
|
|
|
}
|
|
|
if(!org.apache.commons.lang.StringUtils.isEmpty(serverDoctorName)){
|
|
|
sql+=" and o.doctor_name like '%"+serverDoctorName+"%'";
|
|
|
if (!org.apache.commons.lang.StringUtils.isEmpty(serverDoctorName)) {
|
|
|
sql += " and o.doctor_name like '%" + serverDoctorName + "%'";
|
|
|
}
|
|
|
//获取医生代预约记录
|
|
|
if (type!=null){
|
|
|
sql += " and o.type = " + type +" ";
|
|
|
if (type != null) {
|
|
|
sql += " and o.type = " + type + " ";
|
|
|
}
|
|
|
|
|
|
if(org.apache.commons.lang.StringUtils.isNotBlank(patientId)){
|
|
|
sql += " and o.patient= '"+patientId+"' ";
|
|
|
if (org.apache.commons.lang.StringUtils.isNotBlank(patientId)) {
|
|
|
sql += " and o.patient= '" + patientId + "' ";
|
|
|
}
|
|
|
List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount+sql);
|
|
|
sql+=" order by o.create_time desc LIMIT "+(page-1)*pageSize+","+pageSize;
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sqlList+sql);
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sqlCount + sql);
|
|
|
sql += " order by o.create_time desc LIMIT " + (page - 1) * pageSize + "," + pageSize;
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sqlList + sql);
|
|
|
Long count = 0L;
|
|
|
if(rstotal!=null&&rstotal.size()>0){
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
count = (Long) rstotal.get(0).get("total");
|
|
|
}
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
for(Map<String,Object> one:list){
|
|
|
for (Map<String, Object> one : list) {
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("id",one.get("orderId"));
|
|
|
object.put("serverCode",one.get("serverCode"));
|
|
|
Integer statustemp = Integer.valueOf(one.get("status")+"");
|
|
|
object.put("id", one.get("orderId"));
|
|
|
object.put("serverCode", one.get("serverCode"));
|
|
|
Integer statustemp = Integer.valueOf(one.get("status") + "");
|
|
|
String statusName = "";
|
|
|
switch (statustemp){
|
|
|
case -1:statusName="已取消";break;
|
|
|
case 0:statusName="待付款";break;
|
|
|
case 1:statusName="待接单";break;
|
|
|
case 2:statusName="待接单";break;
|
|
|
case 3:statusName="待服务";break;
|
|
|
case 4:statusName="待服务";break;
|
|
|
case 5:statusName="待服务";break;
|
|
|
case 6:statusName="已完成";break;
|
|
|
switch (statustemp) {
|
|
|
case -1:
|
|
|
statusName = "已取消";
|
|
|
break;
|
|
|
case 0:
|
|
|
statusName = "待付款";
|
|
|
break;
|
|
|
case 1:
|
|
|
statusName = "待接单";
|
|
|
break;
|
|
|
case 2:
|
|
|
statusName = "待接单";
|
|
|
break;
|
|
|
case 3:
|
|
|
statusName = "待服务";
|
|
|
break;
|
|
|
case 4:
|
|
|
statusName = "待服务";
|
|
|
break;
|
|
|
case 5:
|
|
|
statusName = "待服务";
|
|
|
break;
|
|
|
case 6:
|
|
|
statusName = "已完成";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
object.put("status",statustemp);
|
|
|
object.put("statusName",statusName);
|
|
|
object.put("status", statustemp);
|
|
|
object.put("statusName", statusName);
|
|
|
//工单是否转给其他机构,0-不转,1-已转
|
|
|
String transOtherOrg = one.get("is_trans_other_org")+"";
|
|
|
String transOtherOrg = one.get("is_trans_other_org") + "";
|
|
|
Object hospitalName = null;
|
|
|
Object hospital = null;
|
|
|
hospital = one.get("orgCode");
|
|
|
hospitalName = one.get("orgName");//签约表中的机构
|
|
|
|
|
|
object.put("hospital",hospital);
|
|
|
object.put("hospitalName",hospitalName);
|
|
|
object.put("patient",one.get("patientCode"));
|
|
|
object.put("patientName",one.get("patient_name"));
|
|
|
object.put("patientPhone",one.get("patient_phone"));
|
|
|
object.put("remark",one.get("remark"));
|
|
|
object.put("serveDesc",one.get("serve_desc"));
|
|
|
object.put("hosLevel",one.get("hosLevel"));
|
|
|
Date date = (Date)one.get("create_time");
|
|
|
object.put("createTime",DateUtil.dateToStrLong(date));
|
|
|
object.put("examPaperStatus",one.get("examPaperStatus"));
|
|
|
object.put("totalFee",one.get("total_fee"));
|
|
|
List<BaseDoorCoachFeeDetailDO> feeDetailDOs = doorFeeDetailDao.findByOrderIdAndType(one.get("orderId")+"", 1);
|
|
|
List<Map<String,Object>> feeDetailResultList = new ArrayList();
|
|
|
for(BaseDoorCoachFeeDetailDO d:feeDetailDOs){
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("code",d.getCode());
|
|
|
map.put("name",d.getName());
|
|
|
map.put("fee",d.getFee());
|
|
|
map.put("number",d.getNumber());
|
|
|
object.put("hospital", hospital);
|
|
|
object.put("hospitalName", hospitalName);
|
|
|
object.put("patient", one.get("patientCode"));
|
|
|
object.put("patientName", one.get("patient_name"));
|
|
|
object.put("patientPhone", one.get("patient_phone"));
|
|
|
object.put("remark", one.get("remark"));
|
|
|
object.put("serveDesc", one.get("serve_desc"));
|
|
|
object.put("hosLevel", one.get("hosLevel"));
|
|
|
Date date = (Date) one.get("create_time");
|
|
|
object.put("createTime", DateUtil.dateToStrLong(date));
|
|
|
object.put("examPaperStatus", one.get("examPaperStatus"));
|
|
|
object.put("totalFee", one.get("total_fee"));
|
|
|
List<BaseDoorCoachFeeDetailDO> feeDetailDOs = doorFeeDetailDao.findByOrderIdAndType(one.get("orderId") + "", 1);
|
|
|
List<Map<String, Object>> feeDetailResultList = new ArrayList();
|
|
|
for (BaseDoorCoachFeeDetailDO d : feeDetailDOs) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("code", d.getCode());
|
|
|
map.put("name", d.getName());
|
|
|
map.put("fee", d.getFee());
|
|
|
map.put("number", d.getNumber());
|
|
|
feeDetailResultList.add(map);
|
|
|
}
|
|
|
object.put("feeDetailResultList",feeDetailResultList);
|
|
|
object.put("feeDetailResultList", feeDetailResultList);
|
|
|
|
|
|
// 获取或者基本信息
|
|
|
BasePatientDO patient = patientInfoService.findById(String.valueOf(one.get("patientCode")));
|
|
|
if (patient != null) {
|
|
|
object.put("sex", IdCardUtil.getSexForIdcard(patient.getIdcard()));
|
|
|
object.put("age", IdCardUtil.getAgeByIdcardOrBirthday(patient.getIdcard(),patient.getBirthday()));
|
|
|
object.put("age", IdCardUtil.getAgeByIdcardOrBirthday(patient.getIdcard(), patient.getBirthday()));
|
|
|
object.put("photo", patient.getPhoto());
|
|
|
|
|
|
// object.put("typeValue", "儿童");
|
|
@ -1456,9 +1478,9 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
//获取咨询
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(id);
|
|
|
if (null != consult) {
|
|
|
doorServiceOrder.setSessionId(doorServiceOrder.getPatient() + "_" + consult.getType());
|
|
|
doorServiceOrder.setSessionId(doorServiceOrder.getPatient() + "_" + consult.getType());
|
|
|
}
|
|
|
object.put("sessionId",doorServiceOrder.getSessionId());
|
|
|
object.put("sessionId", doorServiceOrder.getSessionId());
|
|
|
|
|
|
// 获取服务次数
|
|
|
Integer serviceCount = doctorDoorCoachOrderService.serviceCount(doorServiceOrder.getPatient());
|
|
@ -1472,15 +1494,15 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
}
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("total",count);
|
|
|
object.put("detailModelList",jsonArray);
|
|
|
object.put("currPage",page);
|
|
|
object.put("pageSize",pageSize);
|
|
|
object.put("total", count);
|
|
|
object.put("detailModelList", jsonArray);
|
|
|
object.put("currPage", page);
|
|
|
object.put("pageSize", pageSize);
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public JSONObject updateOrderCardInfo(String jsonData){
|
|
|
public JSONObject updateOrderCardInfo(String jsonData) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
JSONObject jsonObjectParam;
|
|
|
|
|
@ -1498,41 +1520,41 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
wlyyDoorServiceOrder.setPatientName(jsonObjectParam.getString("patientName"));
|
|
|
|
|
|
// 居民电话
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("phone"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("phone"))) {
|
|
|
wlyyDoorServiceOrder.setPatientPhone(jsonObjectParam.getString("phone"));
|
|
|
}
|
|
|
// 医生预计达到时间
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("doctorArrivingTime"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("doctorArrivingTime"))) {
|
|
|
wlyyDoorServiceOrder.setDoctorArrivingTime(jsonObjectParam.get("doctorArrivingTime").toString());
|
|
|
}
|
|
|
// 居民期望服务时间
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("patientExpectedServeTime"))){
|
|
|
wlyyDoorServiceOrder.setPatientExpectedServeTime(jsonObjectParam.get("patientExpectedServeTime").toString());
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("patientExpectedServeTime"))) {
|
|
|
wlyyDoorServiceOrder.setPatientExpectedServeTime(jsonObjectParam.get("patientExpectedServeTime").toString());
|
|
|
}
|
|
|
// 服务区
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("serveTown"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("serveTown"))) {
|
|
|
wlyyDoorServiceOrder.setServeTown(jsonObjectParam.getString("serveTown"));
|
|
|
}
|
|
|
// 服务地址
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("serveAddress"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("serveAddress"))) {
|
|
|
wlyyDoorServiceOrder.setServeAddress(jsonObjectParam.getString("serveAddress"));
|
|
|
}
|
|
|
wlyyDoorServiceOrder.setServeAddress(jsonObjectParam.getString("serveAddress"));
|
|
|
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("serveLat"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("serveLat"))) {
|
|
|
wlyyDoorServiceOrder.setServeLat(jsonObjectParam.getString("serveLat"));
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("serveLon"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("serveLon"))) {
|
|
|
wlyyDoorServiceOrder.setServeLon(jsonObjectParam.getString("serveLon"));
|
|
|
}
|
|
|
// 服务描述
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("serveDesc"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("serveDesc"))) {
|
|
|
wlyyDoorServiceOrder.setServeDesc(jsonObjectParam.getString("serveDesc"));
|
|
|
}
|
|
|
//服务类型 医生端和居民端公用接口
|
|
|
if(!StringUtils.isEmpty(jsonObjectParam.getString("serviceStatus"))){
|
|
|
if (!StringUtils.isEmpty(jsonObjectParam.getString("serviceStatus"))) {
|
|
|
wlyyDoorServiceOrder.setServiceStatus(jsonObjectParam.getString("serviceStatus"));
|
|
|
}else {
|
|
|
} else {
|
|
|
wlyyDoorServiceOrder.setServiceStatus("1");//默认为1 预约项目
|
|
|
}
|
|
|
// wlyyDoorServiceOrder.setIsPatientConfirm(WlyyDoorServiceOrderDO.IsPatientConfirm.yes.getType());
|
|
@ -1540,7 +1562,9 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
this.save(wlyyDoorServiceOrder);
|
|
|
|
|
|
//新增工单居民确认操作日志记录
|
|
|
if (orderWithConfirmLogAdd(result, jsonObjectParam, wlyyDoorServiceOrder.getId())) {return result;}
|
|
|
if (orderWithConfirmLogAdd(result, jsonObjectParam, wlyyDoorServiceOrder.getId())) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
|
result.put(ResponseContant.resultMsg, wlyyDoorServiceOrder);
|
|
@ -1548,16 +1572,15 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
//发送 预约卡片信息(2101类型)
|
|
|
JSONObject orderInfoContent = this.queryOrderCardInfo(wlyyDoorServiceOrder);
|
|
|
orderInfoContent.put("re_msg_type",1);//医生修改待确认
|
|
|
orderInfoContent.put("re_msg_type", 1);//医生修改待确认
|
|
|
this.qucikSendIM(wlyyDoorServiceOrder.getId(), wlyyDoorServiceOrder.getDispatcher(), "智能助手", "2201", orderInfoContent.toJSONString());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加【工单派单,转单】等系统消息
|
|
|
|
|
|
*/
|
|
|
public void createMessage(String title,String type,String sender,String senderName,String relationCode,String Receiver,String ReceiverName,String idCard,String msg){
|
|
|
public void createMessage(String title, String type, String sender, String senderName, String relationCode, String Receiver, String ReceiverName, String idCard, String msg) {
|
|
|
SystemMessageDO messageDO = new SystemMessageDO();
|
|
|
messageDO.setTitle(title);
|
|
|
messageDO.setType(type);//401为资质申请审核
|
|
@ -1575,22 +1598,23 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
/**
|
|
|
* 统计居民已经服务的次数
|
|
|
*
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public Integer countPatientDoorTimes(String patient){
|
|
|
public Integer countPatientDoorTimes(String patient) {
|
|
|
Integer count = 0;
|
|
|
String sql = "SELECT count(o.id) as count FROM base_door_coach_order o where o.patient = '" + patient + "' and status>="+BaseDoorCoachOrderDO.Status.waitForCommnet.getType();
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
String sql = "SELECT count(o.id) as count FROM base_door_coach_order o where o.patient = '" + patient + "' and status>=" + BaseDoorCoachOrderDO.Status.waitForCommnet.getType();
|
|
|
count = jdbcTemplate.queryForObject(sql, Integer.class);
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
|
|
|
private String getRandomIntStr(){
|
|
|
private String getRandomIntStr() {
|
|
|
Random rand = new Random();
|
|
|
int i = rand.nextInt(); //int范围类的随机数
|
|
|
i = rand.nextInt(100); //生成0-100以内的随机数
|
|
|
i = (int)(Math.random() * 100000000); //0-100以内的随机数,用Matn.random()方式
|
|
|
i = (int) (Math.random() * 100000000); //0-100以内的随机数,用Matn.random()方式
|
|
|
return String.valueOf(i);
|
|
|
}
|
|
|
}
|