Browse Source

代码修改

yeshijie 7 years ago
parent
commit
e140cb50f4

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java

@ -177,7 +177,7 @@ public class PresModeAdapter {
                            prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                            prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                            prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                            prescriptionInfo.setPrice(info.getInteger("ITEM_PRICE"));//药品单价
                            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("ITEM_PRICE")));//药品单价
                            prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
                            prescriptionInfo.setJwSubCode(info.getString("RECIPE_SUB_NO"));//智业子处方号
                            prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
@ -278,7 +278,7 @@ public class PresModeAdapter {
                    prescriptionInfo.put("drugRate",info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                    prescriptionInfo.put("drugRateName",info.getString("FREQUENCY_NAME"));
                    prescriptionInfo.put("drugFormat",info.getString("ITEM_SPEC"));//药品规格
                    prescriptionInfo.put("price",info.getInteger("ITEM_PRICE"));//药品单价
                    prescriptionInfo.put("price",info.getDouble("ITEM_PRICE"));//药品单价
                    prescriptionInfo.put("num",info.getInteger("ITEM_QUANTITY"));//药品数目
                    prescriptionInfo.put("jwSubCode",info.getString("RECIPE_SUB_NO"));//智业子处方号
                    prescriptionInfo.put("drugNumUnit",info.getString("ITEM_UNIT"));//数量单位编码

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

@ -1131,7 +1131,7 @@ public class ConsultTeamService extends ConsultService {
            prescriptionInfo.setDrugName(info.getString("drugName"));//药品名称
            prescriptionInfo.setDrugRate(info.getString("drugRate"));//吃药频率
            prescriptionInfo.setDrugFormat(info.getString("drugFormat"));//药品规格
            prescriptionInfo.setNum(CommonUtil.doubleToInt(info.getDouble("num")));//药品数目
            prescriptionInfo.setNum(info.getInteger("num"));//药品数目
            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
            prescriptionInfo.setJwSubCode(info.getString("jwSubCode"));//智业子处方号

+ 105 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionAdjustService.java

@ -4,11 +4,19 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionReviewed;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionReviewedDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
 * 线下调整处方
@ -23,16 +31,28 @@ public class PrescriptionAdjustService extends BaseService {
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private PrescriptionReviewedDao prescriptionReviewedDao;
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
    @Autowired
    private ImUtill imUtill;
    /**
     * 线下调整处方
     * @param code
     */
    public void adjustPrescription(String code){
    @Transactional
    public JSONObject adjustPrescription(String code){
        JSONObject re = new JSONObject();
        Prescription prescription = prescriptionDao.findByCode(code);
        if(prescription.getStatus()== PrescriptionLog.PrescriptionLogStatus.revieweding.getValue()){
        if(prescription.getStatus()== PrescriptionLog.PrescriptionLogStatus.revieweding.getValue()||
                prescription.getStatus()== PrescriptionLog.PrescriptionLogStatus.change_error.getValue()){
            //待审核状态才可以线下调整处方
            String response = jwPrescriptionService.saveRecipe(code,prescription.getJwGisterTypeCode(),prescription.getJwDeptCode());
            JSONObject json = JSONObject.parseObject(response);
            if(json.getInteger("status")==200){
@ -49,27 +69,107 @@ public class PrescriptionAdjustService extends BaseService {
                        prescription.setRecipeNo(recipeNo);
                        prescriptionDao.save(prescription);
                        //发送Im消息
                        JSONObject content = new JSONObject();
                        content.put("title", "我已经审核您" + DateUtil.dateToStr(prescription.getCreateTime(), "yyyy-MM-dd") + "发起的续方申请");
                        content.put("result", "审核通过");
                        content.put("reason", "");
                        content.put("url", "");
                        imUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "15", content.toString(), null);
                        //添加日志
                        prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),1,2);
                        re.put("status",200);
                    }else {
                        //请求失败
                        prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                        JSONArray byRefParaData = data.getJSONArray("byRefParaData");
                        re.put("status",-1);
                        re.put("msg",byRefParaData.getJSONObject(0).getString("errorMsg"));
                    }
                }else {
                    //调整请求失败
                    prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                    re.put("status",-1);
                    re.put("msg",data.getString("MESSAGE"));
                }
            }else{
                //请求报错
                prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                re.put("status",-1);
                re.put("msg","请求调整失败");
            }
        }else {
            re.put("status",-1);
            re.put("msg","只有待审核和调整失败的续方可以转线下调整");
        }
        return  re;
    }
    /**
     * 上传ca认证信息
     * @param code
     */
    public JSONObject uploadCaDigital(String code){
        JSONObject re = new JSONObject();
        Prescription prescription = prescriptionDao.findByCode(code);
        if(prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.change_success.getValue()){
            String response = jwPrescriptionService.affirmCARecipe(code);
            JSONObject json = JSONObject.parseObject(response);
            if(json.getInteger("status")==200){
                JSONObject data = json.getJSONObject("data");
                String zyCode = data.getString("CODE");
                if("1".equals(zyCode)){
                    JSONArray returnData = data.getJSONArray("returnData");
                    if(returnData.size()>0){
                        JSONObject pre = returnData.getJSONArray(0).getJSONObject(0);
                        //认证成功-审核完成
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
                        //设置审核通过
                        PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
                        reviewed.setStatus(1);
                        reviewed.setReviewedTime(new Date());
                        prescriptionDao.save(prescription);
                        //审核通过模板消息
                        prescriptionInfoService.sendRMess(prescription.getCode(), 1);
        }
                        //修改系统的续方消息的审核状态
                        messageDao.updatePreScriptionMessage(prescription.getConsult(), "1", 6);
                        //获取智业待结算接口,更新药品金额
                        prescriptionService.getPerscriptionInfoCostFromPayInfo(prescription.getCode());
                        //添加日志
                        prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),1,2);
                        re.put("status",200);
                    }else {
                        //请求失败
                        prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                        JSONArray byRefParaData = data.getJSONArray("byRefParaData");
                        re.put("status",-1);
                        re.put("msg",byRefParaData.getJSONObject(0).getString("errorMsg"));
                    }
                }else {
                    //调整请求失败
                    prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                    re.put("status",-1);
                    re.put("msg",data.getString("MESSAGE"));
                }
            }else{
                //请求报错
                prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                re.put("status",-1);
                re.put("msg","请求调整失败");
            }
        }else {
            re.put("status",-1);
            re.put("msg","只有调整成功的续方才可上传ca认证信息");
        }
        return  re;
    }
}

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -400,6 +400,15 @@ public class PrescriptionInfoService extends BaseService {
                //获取智业待结算接口,更新药品金额
                prescriptionService.getPerscriptionInfoCostFromPayInfo(p.getCode());
                //发送Im消息
                JSONObject content = new JSONObject();
                content.put("title", "我已经审核您" + DateUtil.dateToStr(p.getCreateTime(), "yyyy-MM-dd") + "发起的续方申请");
                content.put("result", "审核通过");
                content.put("reason", "");
                content.put("url", "");
                imUtill.sendTopicIM(p.getDoctor(), p.getDoctorName(), p.getConsult(), "15", content.toString(), null);
                return 1;
            } else {
                p.setStatus(PrescriptionLog.PrescriptionLogStatus.add_error.getValue());

+ 37 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionAdjustController.java

@ -1,13 +1,16 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.prescription.PrescriptionAdjustService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * Created by yeshijie on 2017/8/17.
@ -24,8 +27,39 @@ public class PrescriptionAdjustController extends BaseController {
    @Autowired
    private PrescriptionAdjustService prescriptionAdjustService;
    @RequestMapping(value = "adjustPrescription",method = RequestMethod.POST)
    @ObserverRequired
    @ApiOperation("线下调整处方")
    public String adjustPrescription(@ApiParam(name = "code", value = "续方code", defaultValue = "10")
                                     @RequestParam(value = "code", required = true) String code){
        try{
            JSONObject json = prescriptionAdjustService.adjustPrescription(code);
            if(json.getInteger("status")==-1){
                return error(-1,json.getString("msg"));
            }
            return write(200,"请求调整成功");
        }catch (Exception e){
            error(e);
            return error(-1,"调整失败");
        }
    }
    @RequestMapping(value = "uploadCaDigital",method = RequestMethod.POST)
    @ObserverRequired
    @ApiOperation("上传基位ca认证信息")
    public String uploadCaDigital(@ApiParam(name = "code", value = "续方code", defaultValue = "10")
                                  @RequestParam(value = "code", required = true) String code){
        try{
            JSONObject json = prescriptionAdjustService.uploadCaDigital(code);
            if(json.getInteger("status")==-1){
                return error(-1,json.getString("msg"));
            }
            return write(200,"请求调整成功");
        }catch (Exception e){
            error(e);
            return error(-1,"调整失败");
        }
    }