Browse Source

代码修改

yeshijie 7 years ago
parent
commit
aa48db01e8

+ 111 - 9
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -6,18 +6,17 @@ import com.yihu.wlyy.service.service.prescription.PrescriptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
/**
 * 长处方接口
 * */
@Controller
@RestController
@RequestMapping(value = "/third/prescription/")
@Api(description = "长处方接口")
public class PrescriptionController extends BaseController{
@ -31,7 +30,6 @@ public class PrescriptionController extends BaseController{
	/**************************************提供智业调用的接口 start******************************************************/
	@RequestMapping(value = "prescriptionAdjustCompleted",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收线下处方调整完成消息")
	public Result prescriptionAdjustCompleted(@ApiParam(name="data",value="json串",defaultValue = "{}")
											  @RequestParam(value = "data",required = true) String data){
@ -44,7 +42,6 @@ public class PrescriptionController extends BaseController{
	}
	@RequestMapping(value = "prePayCompletion",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收预结算完成消息")
	public Result prePayCompletion(@ApiParam(name="data",value="json串",defaultValue = "{}")
								   @RequestParam(value = "data",required = true) String data){
@ -60,7 +57,6 @@ public class PrescriptionController extends BaseController{
	}
	@RequestMapping(value = "dispensingComplete",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收配药完成消息")
	public Result dispensingComplete(@ApiParam(name="data",value="json串",defaultValue = "{}")
									 @RequestParam(value = "data",required = true) String data){
@ -74,7 +70,6 @@ public class PrescriptionController extends BaseController{
	}
	@RequestMapping(value = "pharmacistPrescriptionCompletion",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收药师审方完成及结果消息")
	public Result pharmacistPrescriptionCompletion(@ApiParam(name="data",value="json串",defaultValue = "{}")
												   @RequestParam(value = "data",required = true) String data){
@ -88,7 +83,6 @@ public class PrescriptionController extends BaseController{
	}
	@RequestMapping(value = "readNewsOnline",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("提供在线问诊消息调阅")
	public String readNewsOnline(@ApiParam(name="data",value="json串",defaultValue = "{}")
								 @RequestParam(value = "data",required = true) String data){
@ -104,6 +98,114 @@ public class PrescriptionController extends BaseController{
	/**************************************提供智业调用的接口 end*******************************************************/
	/************************************ 长处方 ************************************************************/
	@RequestMapping(value = "getDictForI",method = RequestMethod.POST)
	@ApiOperation("字典获取接口")
	public Result getDictForI(@ApiParam(name="dictName",value="字典名称",defaultValue = "IV_PHYSIC_DICT")
							  @RequestParam(value = "dictName",required = true) String dictName,
							  @ApiParam(name="hospital",value="医院code",defaultValue = "3501111")
							  @RequestParam(value = "hospital",required = true) String hospital)
	{
		try {
			String re = prescriptionService.getDictForI(dictName,hospital);
			return Result.success("字典获取接口成功!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "getRecipeTemplate",method = RequestMethod.POST)
	@ApiOperation("处方模板获取接口")
	public Result getRecipeTemplate(@ApiParam(name="deptCode",value="科室编码",defaultValue = "")
									@RequestParam(value = "deptCode",required = true) String deptCode,
									@ApiParam(name="staffCode",value="人员code",defaultValue = "")
									@RequestParam(value = "staffCode",required = true) String staffCode,
									@ApiParam(name="hospital",value="医院code",defaultValue = "3501111")
									@RequestParam(value = "hospital",required = true) String hospital)
	{
		try {
			String re = prescriptionService.getRecipeTemplate(staffCode,deptCode,hospital);
			return Result.success("处方模板获取接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "getLastRecipe",method = RequestMethod.POST)
	@ApiOperation("调阅历史处方接口")
	public Result getLastRecipe(@ApiParam(name="cardNo",value="病人卡号",defaultValue = "")
								@RequestParam(value = "cardNo",required = true) String cardNo,
								@ApiParam(name="recipeNo",value="第一次获取上一方时传入0,第二次获取上一方时传入第一次返回的医嘱号,以此类推",defaultValue = "")
								@RequestParam(value = "recipeNo",required = true) String recipeNo,
								@ApiParam(name="applyTimeFrom",value="开始时间",defaultValue = "")
								@RequestParam(value = "applyTimeFrom",required = true) String applyTimeFrom,
								@ApiParam(name="applyTimeEnd",value="结束时间",defaultValue = "")
								@RequestParam(value = "applyTimeEnd",required = true) String applyTimeEnd)
	{
		try {
			String re = prescriptionService.getLastRecipe(cardNo,recipeNo,applyTimeFrom,applyTimeEnd);
			return Result.success("调阅历史处方接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "saveRecipe",method = RequestMethod.POST)
	@ApiOperation("挂号开处方接口")
	public Result saveRecipe(@ApiParam(name="prescriptionCode",value="续方code",defaultValue = "123")
							 @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode)
	{
		try {
			String re = prescriptionService.saveRecipe(prescriptionCode);
			return Result.success("挂号开处方接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "getDispUnSettleFeeList",method = RequestMethod.POST)
	@ApiOperation("查询处方结算结果列表")
	public Result getDispUnSettleFeeList(@ApiParam(name="cardNo",value="病人卡号",defaultValue = "")
										 @RequestParam(value = "cardNo",required = true) String cardNo,
										 @ApiParam(name="visitNo",value="挂号号",defaultValue = "")
										 @RequestParam(value = "visitNo",required = true) String visitNo)
	{
		try {
			String re = prescriptionService.getDispUnSettleFeeList(cardNo,null,null);
			return Result.success("查询处方结算结果列表!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "executeSickSettle",method = RequestMethod.POST)
	@ApiOperation("院内结算确认接口")
	public Result executeSickSettle(@ApiParam(name="json",value="json",defaultValue = "{}")
									@RequestParam(value = "json",required = true) String json)
	{
		try {
			String re = prescriptionService.executeSickSettle(JSONObject.fromObject(json),null,null);
			return Result.success("院内结算确认接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	/************************************ CA认证 ************************************************************/
	@RequestMapping(value = "RequestRealNameSoftCertAndSign",method = RequestMethod.POST)
	@ResponseBody

+ 9 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java

@ -34,6 +34,7 @@ public class Prescription extends IdEntity {
    private Date finishTime;                //配送员确认送达或居民确认取药的时间
    private String patient;                  //关联 wlyy_patient code
    private String patientName;             //患者名称
    private String ssc;//社保卡号
    private Integer type;                    //1 处方 2 续方
    private Integer status;                  //状态 (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 3.调整完成 4.调整失败 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败  42配送中   43配送到服务站  100配送到患者手中/已完成)
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
@ -505,4 +506,12 @@ public class Prescription extends IdEntity {
    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
}

+ 9 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionInfo.java

@ -19,6 +19,7 @@ public class PrescriptionInfo extends IdEntity {
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private String drugCode;               //药品code
    private String drugName;               //药品名称
    private String subjectClass;               //科目类别编码
    private String drugRate;               //吃药频率
    private String drugRateName;          //用药频次名称
    private String drugFormat;             //药品规格
@ -311,4 +312,12 @@ public class PrescriptionInfo extends IdEntity {
    public void setDrugRateName(String drugRateName) {
        this.drugRateName = drugRateName;
    }
    public String getSubjectClass() {
        return subjectClass;
    }
    public void setSubjectClass(String subjectClass) {
        this.subjectClass = subjectClass;
    }
}

+ 87 - 33
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -1,10 +1,17 @@
package com.yihu.wlyy.service.service.prescription;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.dao.DoctorMappingDao;
import com.yihu.wlyy.service.dao.PatientDao;
import com.yihu.wlyy.service.dao.SignFamilyDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionDiagnosisDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionLogDao;
import com.yihu.wlyy.service.entity.Patient;
import com.yihu.wlyy.service.entity.SignFamily;
import com.yihu.wlyy.service.entity.prescription.Prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
import com.yihu.wlyy.service.entity.prescription.PrescriptionLog;
import com.yihu.wlyy.service.service.ZysoftBaseService;
@ -20,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -40,6 +48,14 @@ public class PrescriptionService extends ZysoftBaseService{
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    private String channelTopic = "redisPrescription";
@ -279,17 +295,15 @@ public class PrescriptionService extends ZysoftBaseService{
     * 7.1字典获取接口
     * @param dictName 字典名称
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getDictForI(String dictName,String hospital,String licence)  throws Exception
    public String getDictForI(String dictName,String hospital)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        String[] hospitalMapping = getHospitalMapping(hospital); //获取机构映射
        hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
@ -308,17 +322,14 @@ public class PrescriptionService extends ZysoftBaseService{
     * @param staffCode 员工编码
     * @param deptCode 部门编码
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getRecipeTemplate(String staffCode,String deptCode,String hospital,String licence)  throws Exception
    public String getRecipeTemplate(String staffCode,String deptCode,String hospital)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        String[] hospitalMapping = getHospitalMapping(hospital); //获取机构映射
        hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
@ -335,20 +346,25 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 调阅历史处方接口
     * @param cardNo 卡号
     * @param cardNo 社保卡号
     * @param recipeNo 医嘱号
     * @param hospital
     * @param licence
     * @param applyTimeFrom 开始时间
     * @param applyTimeEnd 结束时间
     * @return
     * @throws Exception
     */
    public String getLastRecipe(String cardNo,String recipeNo,String hospital,String licence)  throws Exception
    public String getLastRecipe(String cardNo,String recipeNo,String applyTimeFrom,String applyTimeEnd)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        String hospital = null;
        String licence = null;
        Patient patient = patientDao.findBySsc(cardNo);
        SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
        //
        String[] hospitalMapping = getHospitalMapping(signFamily.getHospital()); //获取机构映射
        hospital = hospitalMapping[0];
        licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
@ -357,6 +373,8 @@ public class PrescriptionService extends ZysoftBaseService{
        Map<String,String> params = new HashMap<>();
        params.put("cardNo",cardNo);
        params.put("recipeNo",recipeNo);
        params.put("applyTimeFrom",applyTimeFrom);
        params.put("applyTimeEnd",applyTimeEnd);
        String response = postSecond("getLastRecipe","调阅历史处方接口",params,null,header,false,2);
@ -365,27 +383,63 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 7.4 挂号开处方接口
     * @param json
     * @param hospital
     * @param licence
     * @param prescriptionCode
     * @return
     * @throws Exception
     */
    public String saveRecipe(JSONObject json, String hospital, String licence)  throws Exception
    public String saveRecipe(String prescriptionCode)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        //拼接开方参数
        JSONObject json = new JSONObject();
        json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
//            "saveDept": "开单科室编码",
//            "REGISTER_TYPE": "挂号类型编码",
//            "RATE_TYPE": "费别类型编码",
        String jwdoctor = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(prescription.getDoctor(),hospital);
        json.put("saveOperator",jwdoctor);// "saveOperator": "开单人员编码",
        List<PrescriptionDiagnosis> prescriptionDiagnosisList = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
        json.put("DIAGNOSE_CODE",prescriptionDiagnosisList.get(0).getCode());//"DIAGNOSE_CODE": "诊断编码",
        List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
        JSONArray ja = new JSONArray();
        for (PrescriptionInfo info : list){
            JSONObject js = new JSONObject();
            js.put("ITEM_CODE",info.getDrugCode());//"ITEM_CODE": "药品代码",
            js.put("ITEM_NAME",info.getDrugName());//"ITEM_NAME": "药品名称",
            js.put("SUBJECT_CLASS",info.getSubjectClass());//"SUBJECT_CLASS": "科目类别编码",
            js.put("ITEM_QUANTITY",info.getNum());//"ITEM_QUANTITY": "药品数量",
            js.put("ITEM_UNIT",info.getDrugNumUnit());// "ITEM_UNIT": " 数量单位编码 ",
            js.put("ITEM_SPEC",info.getDrugFormat());//  "ITEM_SPEC": "药品规格",
            js.put("ITEM_PRICE",info.getPrice());// "ITEM_PRICE": "药品单价",
            js.put("COST",info.getCode());// "COST": "药品金额",
            js.put("BIND_FLAG",info.getBindFlag());// "BIND_FLAG": " 成组标志, 0.非成组,1.成组",
            js.put("FREQUENCY",info.getDrugRate());// "FREQUENCY": "用药频次编码",
            js.put("DAY_COUNT",info.getDayCount());// "DAY_COUNT": "用药天数",
            js.put("USAGE",info.getDrugUsage());// "USAGE": "用药方法编码",
            js.put("PHYSIC_DOSE",info.getPhysicDose());// "PHYSIC_DOSE": " 用药剂量",
            js.put("PHYSIC_DOSE_UNIT",info.getPhysicDoseUnit());// "PHYSIC_DOSE_UNIT": " 剂量单位编码",
            js.put("PHYSIC_AMOUNT",info.getPhysicAmount());// "PHYSIC_AMOUNT": " 用药总量",
            js.put("PHYSIC_AMOUNT_UNIT",info.getPhysicAmountUnit());// "PHYSIC_AMOUNT_UNIT": " 总量单位编码",
            js.put("PHYSIC_INJECT_PLACE",info.getPhysicInjectPlace());// "PHYSIC_INJECT_PLACE": " 注射地点编码",
            js.put("PHYSIC_SKIN_TEST",info.getPhysicSkinTest());// "PHYSIC_SKIN_TEST": " 皮试类型编码",
            js.put("REMARK",info.getRemark());// " REMARK ": " 备注"
            ja.add(js);
        }
        json.put("recipeInfo",ja);
        String response = postSecond("saveRecipe","挂号开处方接口",null,json,header,false,2);
        return response;
        return null;
    }
    /**