|
@@ -3,6 +3,7 @@ import cn.hutool.json.JSONUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fs.app.annotation.Login;
|
|
import com.fs.app.annotation.Login;
|
|
|
|
+import com.fs.app.vo.PrescribeV2VO;
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.event.TemplateBean;
|
|
import com.fs.common.event.TemplateBean;
|
|
import com.fs.common.event.TemplateEvent;
|
|
import com.fs.common.event.TemplateEvent;
|
|
@@ -22,6 +23,7 @@ import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -32,6 +34,7 @@ import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@Api("处方接口")
|
|
@Api("处方接口")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(value="/app/prescribe")
|
|
@RequestMapping(value="/app/prescribe")
|
|
@@ -81,18 +84,19 @@ public class PrescribeController extends AppBaseController {
|
|
{
|
|
{
|
|
// 封装JSON请求
|
|
// 封装JSON请求
|
|
//{"msg":"成功","code":1000,"data":{"rp_id":"202203151003300001","order_id":null,"depart_name":"内科","doctor_name":"测试账号","pharmacist_name":null,"rp_url":"https://asset.nxk520.com/202203-go/C2203151057038646.png","diagnose":"眼睑带状疱疹","rp_msg":"已开方","audit_reason":null,"drugInfo":[{"drug_name":"维力青 恩替卡韦分散片 0.5mg*7片","sale_amount":1,"drug_specification":"0.5mg*7片"}],"create_date":"2022-03-15 10:03:30","pharmacy_code":"00001","pharmacy_name":"测试门店","doctor_id":"383"}}
|
|
//{"msg":"成功","code":1000,"data":{"rp_id":"202203151003300001","order_id":null,"depart_name":"内科","doctor_name":"测试账号","pharmacist_name":null,"rp_url":"https://asset.nxk520.com/202203-go/C2203151057038646.png","diagnose":"眼睑带状疱疹","rp_msg":"已开方","audit_reason":null,"drugInfo":[{"drug_name":"维力青 恩替卡韦分散片 0.5mg*7片","sale_amount":1,"drug_specification":"0.5mg*7片"}],"create_date":"2022-03-15 10:03:30","pharmacy_code":"00001","pharmacy_name":"测试门店","doctor_id":"383"}}
|
|
|
|
+ log.info("处方回调:{}", jsonBody);
|
|
JSONObject json = JSON.parseObject(jsonBody);
|
|
JSONObject json = JSON.parseObject(jsonBody);
|
|
- PrescribeVO vo= JSONUtil.toBean(jsonBody, PrescribeVO.class);
|
|
|
|
|
|
+ PrescribeV2VO vo= JSONUtil.toBean(jsonBody, PrescribeV2VO.class);
|
|
if(vo.getCode().equals("1000")){
|
|
if(vo.getCode().equals("1000")){
|
|
- if(vo.getData().getRp_msg().equals("已开方")){
|
|
|
|
- FsPrescribe fsPrescribe=prescribeService.selectFsPrescribeByRpId(vo.getData().getRp_id());
|
|
|
|
- fsPrescribe.setRpUrl(vo.getData().getRp_url());
|
|
|
|
|
|
+ if(vo.getData().getStatus().equals("已开方")){
|
|
|
|
+ FsPrescribe fsPrescribe=prescribeService.selectFsPrescribeByRpId(vo.getData().getOnlyId());
|
|
|
|
+ fsPrescribe.setRpUrl(vo.getData().getPrescriptionUrl());
|
|
fsPrescribe.setRpCreateTime(new Date());
|
|
fsPrescribe.setRpCreateTime(new Date());
|
|
- fsPrescribe.setDoctorName(vo.getData().getDoctor_name());
|
|
|
|
|
|
+ fsPrescribe.setDoctorName(vo.getData().getDoctorName());
|
|
fsPrescribe.setDiagnose(vo.getData().getDiagnose());
|
|
fsPrescribe.setDiagnose(vo.getData().getDiagnose());
|
|
fsPrescribe.setDrugs(JSONUtil.toJsonStr(vo.getData().getDrugInfo()));
|
|
fsPrescribe.setDrugs(JSONUtil.toJsonStr(vo.getData().getDrugInfo()));
|
|
fsPrescribe.setStatus(1);
|
|
fsPrescribe.setStatus(1);
|
|
- fsPrescribe.setAuditReason(vo.getData().getAudit_reason());
|
|
|
|
|
|
+ fsPrescribe.setAuditReason(vo.getData().getAuditReason());
|
|
prescribeService.updateFsPrescribe(fsPrescribe);
|
|
prescribeService.updateFsPrescribe(fsPrescribe);
|
|
//创建OMS订单
|
|
//创建OMS订单
|
|
FsStoreOrder order= orderService.selectFsStoreOrderById(fsPrescribe.getOrderId());
|
|
FsStoreOrder order= orderService.selectFsStoreOrderById(fsPrescribe.getOrderId());
|
|
@@ -110,15 +114,15 @@ public class PrescribeController extends AppBaseController {
|
|
publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
|
|
|
|
}
|
|
}
|
|
- else if(vo.getData().getRp_msg().equals("已拒绝")){
|
|
|
|
- FsPrescribe fsPrescribe=prescribeService.selectFsPrescribeByRpId(vo.getData().getRp_id());
|
|
|
|
- fsPrescribe.setRpUrl(vo.getData().getRp_url());
|
|
|
|
|
|
+ else if(vo.getData().getStatus().equals("已拒绝")){
|
|
|
|
+ FsPrescribe fsPrescribe=prescribeService.selectFsPrescribeByRpId(vo.getData().getOnlyId());
|
|
|
|
+ fsPrescribe.setRpUrl(vo.getData().getPrescriptionUrl());
|
|
fsPrescribe.setRpCreateTime(new Date());
|
|
fsPrescribe.setRpCreateTime(new Date());
|
|
- fsPrescribe.setDoctorName(vo.getData().getDoctor_name());
|
|
|
|
|
|
+ fsPrescribe.setDoctorName(vo.getData().getDoctorName());
|
|
fsPrescribe.setDiagnose(vo.getData().getDiagnose());
|
|
fsPrescribe.setDiagnose(vo.getData().getDiagnose());
|
|
fsPrescribe.setDrugs(JSONUtil.toJsonStr(vo.getData().getDrugInfo()));
|
|
fsPrescribe.setDrugs(JSONUtil.toJsonStr(vo.getData().getDrugInfo()));
|
|
fsPrescribe.setStatus(2);
|
|
fsPrescribe.setStatus(2);
|
|
- fsPrescribe.setAuditReason(vo.getData().getAudit_reason());
|
|
|
|
|
|
+ fsPrescribe.setAuditReason(vo.getData().getAuditReason());
|
|
prescribeService.updateFsPrescribe(fsPrescribe);
|
|
prescribeService.updateFsPrescribe(fsPrescribe);
|
|
//自动退款
|
|
//自动退款
|
|
orderService.refundPrescribeOrder(fsPrescribe.getOrderId());
|
|
orderService.refundPrescribeOrder(fsPrescribe.getOrderId());
|