|
@ -6,13 +6,17 @@ import com.yihu.jw.care.dao.lifeCare.LifeCareFeeDetailDao;
|
|
|
import com.yihu.jw.care.dao.lifeCare.LifeCareItemDictDao;
|
|
|
import com.yihu.jw.care.dao.lifeCare.LifeCareOrderDao;
|
|
|
import com.yihu.jw.care.util.MessageUtil;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.lifeCare.LifeCareCancelLogDO;
|
|
|
import com.yihu.jw.entity.care.lifeCare.LifeCareFeeDetailDO;
|
|
|
import com.yihu.jw.entity.care.lifeCare.LifeCareItemDictDO;
|
|
|
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
|
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
@ -61,6 +65,10 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
|
|
|
private String wxId;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
|
@Autowired
|
|
|
private BaseOrgDao baseOrgDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
|
|
|
/**
|
|
|
* 记录完成情况
|
|
@ -68,9 +76,12 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
|
|
|
* @param complereImgs
|
|
|
* @param completeRemark
|
|
|
*/
|
|
|
public void completeOrder(String orderId,String complereImgs,String completeRemark){
|
|
|
public void completeOrder(String orderId,String complereImgs,String completeRemark,String doctorId){
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
|
|
|
LifeCareOrderDO lifeCareOrderDO = lifeCareOrderDao.findOne(orderId);
|
|
|
if(lifeCareOrderDO.getStatus().equals(LifeCareOrderDO.Status.waitForAccept.getType())){
|
|
|
lifeCareOrderDO.setDoctor(doctorId);
|
|
|
lifeCareOrderDO.setDoctorName(doctorDO.getName());
|
|
|
lifeCareOrderDO.setStatus(2);
|
|
|
lifeCareOrderDO.setCompleteImgs(complereImgs);
|
|
|
lifeCareOrderDO.setCompleteRemark(completeRemark);
|
|
@ -217,7 +228,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, "从数据库查询【调度员】生活照料工单列表信息失败:" + e.getMessage());
|
|
|
result.put(ResponseContant.resultMsg, "从数据库查询生活照料工单列表信息失败");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -226,7 +237,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
|
|
|
count = jdbcTemplate.queryForObject(finqlCountSql, Long.class);
|
|
|
} catch (Exception e) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, "从数据库统计【调度员】生活照料工单数量失败:" + e.getMessage());
|
|
|
result.put(ResponseContant.resultMsg, "从数据库统计生活照料工单数量失败" );
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -339,14 +350,14 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
|
|
|
LifeCareOrderDO orderDO = lifeCareOrderDao.findOne(orderId);
|
|
|
if(null == orderDO){
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "【取消工单】该工单不存在:," + orderId;
|
|
|
String failMsg = "【取消工单】该工单不存在";
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
logger.error(failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
if(orderDO.getStatus().equals(LifeCareOrderDO.Status.waitForAccept.getType())){
|
|
|
if(orderDO.getStatus().equals(LifeCareOrderDO.Status.complete.getType())){
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "只有医生服务前的工单才可取消:," + orderId;
|
|
|
String failMsg = "只有医生服务前的工单才可取消";
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
logger.error(failMsg);
|
|
|
return result;
|
|
@ -395,13 +406,27 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public JSONObject create(String jsonData) {
|
|
|
public JSONObject create(String jsonData,String proxyPatient) {
|
|
|
logger.info("申请生活照料jsonData参数:" + jsonData);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
JSONObject jsonObjectParam;
|
|
|
try {
|
|
|
jsonObjectParam = JSONObject.parseObject(jsonData);
|
|
|
if (jsonObjectParam.getInteger("type")==1||jsonObjectParam.getInteger("type")==2){
|
|
|
//本人或家人代发起
|
|
|
BasePatientDO patientDO = patientDao.findById(proxyPatient);
|
|
|
jsonObjectParam.put("proxyPatient",proxyPatient);
|
|
|
jsonObjectParam.put("proxyPatientName",patientDO.getName());
|
|
|
jsonObjectParam.put("proxyPatientPhone",patientDO.getMobile());
|
|
|
}
|
|
|
if (jsonObjectParam.getInteger("type")==3) {//医生代发起
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(proxyPatient);
|
|
|
jsonObjectParam.put("proxyPatient",proxyPatient);
|
|
|
jsonObjectParam.put("proxyPatientName",doctorDO.getName());
|
|
|
jsonObjectParam.put("proxyPatientPhone",doctorDO.getMobile());
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "参数转换成JSON对象异常:" + e.getMessage();
|
|
@ -439,6 +464,11 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(orderDO.getHospital())){
|
|
|
BaseOrgDO orgDO = baseOrgDao.findByCode(orderDO.getHospital());
|
|
|
orderDO.setHospitalName(orgDO.getName());
|
|
|
}
|
|
|
|
|
|
orderDO.setCreateTime(new Date());
|
|
|
//判断创建生活照料类型,发起类型(1本人发起 2家人待预约 3医生代预约)
|
|
|
if(orderDO.getProxyPatient().equals(orderDO.getPatient())){
|