Bladeren bron

Merge branch 'dev' of yeshijie/patient-co-management into dev

yeshijie 7 jaren geleden
bovenliggende
commit
57d700135a

File diff suppressed because it is too large
+ 7 - 5
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java


+ 3 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDao.java

@ -18,6 +18,9 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query("from Prescription p where p.recipeNo=?1")
    @Query("from Prescription p where p.recipeNo=?1")
    Prescription findByRecipeNo(String recipeNo);
    Prescription findByRecipeNo(String recipeNo);
    @Query(value = "SELECT a.* from wlyy_prescription a WHERE a.jw_code = ?1 ORDER BY create_time LIMIT 0,1",nativeQuery = true)
    Prescription findByJwCode(String jwCode);
    @Modifying
    @Modifying
    @Query("update Prescription p set p.status=?2 where p.code=?1")
    @Query("update Prescription p set p.status=?2 where p.code=?1")
    void updateStatus(String prescriptionCode, Integer status);
    void updateStatus(String prescriptionCode, Integer status);

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

@ -9,6 +9,7 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Transient;
import java.util.Date;
import java.util.Date;
import java.util.List;
/**
/**
 * Created by Administrator on 2017/7/21.
 * Created by Administrator on 2017/7/21.
@ -72,6 +73,15 @@ public class Prescription extends IdEntity {
    private String strOriginalData; //CA原文数据
    private String strOriginalData; //CA原文数据
    private List<PrescriptionInfo> prescriptionInfo;
    private String reviewedState;
    private String jwDeptCode;  //基卫-开处方的科室编码
    private String jwHospital;  //基卫-开处方的医院编码
    private String jwDoctorCode; //基卫-开方医生的编码
    private String jwGisterTypeCode;//基卫-挂号类型编码
    private String jwRateTypeCode;//基卫-费别类型编码
    @Column(name = "code", unique = true, nullable = false)
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
    public String getCode() {
@ -545,4 +555,61 @@ public class Prescription extends IdEntity {
        this.strOriginalData = strOriginalData;
        this.strOriginalData = strOriginalData;
    }
    }
    @Transient
    public List<PrescriptionInfo> getPrescriptionInfo() {
        return prescriptionInfo;
    }
    public void setPrescriptionInfo(List<PrescriptionInfo> prescriptionInfo) {
        this.prescriptionInfo = prescriptionInfo;
    }
    @Transient
    public String getReviewedState() {
        return reviewedState;
    }
    public void setReviewedState(String reviewedState) {
        this.reviewedState = reviewedState;
    }
    public String getJwDeptCode() {
        return jwDeptCode;
    }
    public void setJwDeptCode(String jwDeptCode) {
        this.jwDeptCode = jwDeptCode;
    }
    public String getJwDoctorCode() {
        return jwDoctorCode;
    }
    public void setJwDoctorCode(String jwDoctorCode) {
        this.jwDoctorCode = jwDoctorCode;
    }
    public String getJwGisterTypeCode() {
        return jwGisterTypeCode;
    }
    public void setJwGisterTypeCode(String jwGisterTypeCode) {
        this.jwGisterTypeCode = jwGisterTypeCode;
    }
    public String getJwRateTypeCode() {
        return jwRateTypeCode;
    }
    public void setJwRateTypeCode(String jwRateTypeCode) {
        this.jwRateTypeCode = jwRateTypeCode;
    }
    public String getJwHospital() {
        return jwHospital;
    }
    public void setJwHospital(String jwHospital) {
        this.jwHospital = jwHospital;
    }
}
}

+ 19 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZyDictService.java

@ -0,0 +1,19 @@
package com.yihu.wlyy.service.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
/**
 * 智业字典接口
 * Created by yeshijie on 2017/8/14.
 */
@Service
public class ZyDictService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
}

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

@ -411,12 +411,13 @@ public class PrescriptionService extends ZysoftBaseService{
     * 调阅历史处方接口
     * 调阅历史处方接口
     * @param cardNo 社保卡号
     * @param cardNo 社保卡号
     * @param recipeNo 医嘱号
     * @param recipeNo 医嘱号
     * @param recipeNo 指定医嘱(处方)号时,直接返回该指定医嘱(处方)的信息
     * @param applyTimeFrom 开始时间
     * @param applyTimeFrom 开始时间
     * @param applyTimeEnd 结束时间
     * @param applyTimeEnd 结束时间
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String getLastRecipe(String cardNo,String recipeNo,String applyTimeFrom,String applyTimeEnd)  throws Exception
    public String getLastRecipe(String cardNo,String recipeNo,String appointRecipeNo,String applyTimeFrom,String applyTimeEnd)  throws Exception
    {
    {
        Patient patient = patientDao.findBySsc(cardNo);
        Patient patient = patientDao.findBySsc(cardNo);
        SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
        SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
@ -436,6 +437,9 @@ public class PrescriptionService extends ZysoftBaseService{
            recipeNo = "0";
            recipeNo = "0";
        }
        }
        params.put("recipeNo",recipeNo);
        params.put("recipeNo",recipeNo);
        if(StringUtils.isEmpty(appointRecipeNo)){
            params.put("appointRecipeNo",appointRecipeNo);
        }
        if(StringUtils.isEmpty(applyTimeFrom)){
        if(StringUtils.isEmpty(applyTimeFrom)){
            applyTimeEnd = DateUtil.getStringDateShort();
            applyTimeEnd = DateUtil.getStringDateShort();
            applyTimeFrom = DateUtil.getNextDay(new Date(),-60);
            applyTimeFrom = DateUtil.getNextDay(new Date(),-60);
@ -448,6 +452,54 @@ public class PrescriptionService extends ZysoftBaseService{
        return response;
        return response;
    }
    }
    /**
     * 调阅处方详情接口
     * @param cardNo 社保卡号
     * @param appointRecipeNo 指定医嘱(处方)号时,直接返回该指定医嘱(处方)的信息
     * @return
     * @throws Exception
     */
    public String getRecipe(String cardNo,String appointRecipeNo)  throws Exception
    {
        Patient patient = patientDao.findBySsc(cardNo);
        SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
        //
        String[] hospitalMapping = getHospitalMapping(signFamily.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("cardNo",cardNo);
        params.put("recipeNo","0");
        if(StringUtils.isEmpty(appointRecipeNo)){
            params.put("appointRecipeNo",appointRecipeNo);
        }
        String applyTimeEnd = null;
        String applyTimeFrom = null;
        //判断是否存在续方记录,存在就取续方的创建时间为开始时间,保证从续方详情跳转处方详情是有数据
        Prescription prescription = prescriptionDao.findByJwCode(appointRecipeNo);
        if(prescription == null){
            applyTimeEnd = DateUtil.getStringDateShort();
            applyTimeFrom = DateUtil.getNextDay(new Date(),-60);
        }else{
            applyTimeEnd = DateUtil.getNextDay(prescription.getCreateTime(),10);
            applyTimeFrom = DateUtil.getNextDay(prescription.getCreateTime(),-10);
        }
        params.put("applyTimeFrom",applyTimeFrom);
        params.put("applyTimeEnd",applyTimeEnd);
        String response = postSecond("getLastRecipe","调阅处方详情接口",params,null,header,false,2);
        return response;
    }
    /**
    /**
     * 7.4 挂号开处方接口,调整处方接口
     * 7.4 挂号开处方接口,调整处方接口
     * 开方和调整处方接口的区别-开方会传ca认证
     * 开方和调整处方接口的区别-开方会传ca认证
@ -455,7 +507,6 @@ public class PrescriptionService extends ZysoftBaseService{
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    @Transactional
    public String saveRecipe(String prescriptionCode)  throws Exception
    public String saveRecipe(String prescriptionCode)  throws Exception
    {
    {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
@ -471,25 +522,28 @@ public class PrescriptionService extends ZysoftBaseService{
        //拼接开方参数
        //拼接开方参数
        JSONObject json = new JSONObject();
        JSONObject json = new JSONObject();
        json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
        json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
//            "saveDept": "开单科室编码",
//            "REGISTER_TYPE": "挂号类型编码",
//            "RATE_TYPE": "费别类型编码",
        String jwdoctor = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(prescription.getDoctor(),hospital);
        json.put("saveOperator",jwdoctor);// "saveOperator": "开单人员编码",
        json.put("saveDept",prescription.getJwDeptCode());//开单科室编码
        json.put("saveOperator",prescription.getJwDoctorCode());// "saveOperator": "开单人员编码",
        json.put("RATE_TYPE","2");//费别类型编码
        json.put("REGISTER_TYPE",prescription.getJwGisterTypeCode());//挂号类型编码
        List<PrescriptionDiagnosis> prescriptionDiagnosisList = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
        List<PrescriptionDiagnosis> prescriptionDiagnosisList = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
        json.put("DIAGNOSE_CODE",prescriptionDiagnosisList.get(0).getCode());//"DIAGNOSE_CODE": "诊断编码",
        json.put("DIAGNOSE_CODE",prescriptionDiagnosisList.get(0).getCode());//"DIAGNOSE_CODE": "诊断编码",
        if(prescriptionDiagnosisList.size()>1){
            json.put("DIAGNOSE_SUB_CODE",prescriptionDiagnosisList.get(1).getCode());//"DIAGNOSE_CODE": "次诊断编码",
        }
        if(prescription.getCaCertData()==null){
        if(prescription.getCaCertData()==null){
            json.put("OriginalData",prescription.getStrOriginalData());//原文
            json.put("OriginalDataMD5",prescription.getOriginalDataAbstract());//原文的MD5摘要
            json.put("CA_SignData",prescription.getCaMessage());//签名值
            json.put("CA_CertMainData",prescription.getCaCertData());//签名证书主体数据
            json.put("CA_DigitalSignStreamNoUuid",prescription.getDigitalSignNo());//CA数字签名唯一流水号
            json.put("ORIGINAL_DATA",prescription.getStrOriginalData());//原文
            json.put("ORIGINAL_DATA_MD5",prescription.getOriginalDataAbstract());//原文的MD5摘要
            json.put("CA_SIGN_DATA",prescription.getCaMessage());//签名值
            json.put("CA_CERTMAIN_DATA",prescription.getCaCertData());//签名证书主体数据
            json.put("CA_DIGITAL_SIGN_STREAM_NO_UUID",prescription.getDigitalSignNo());//CA数字签名唯一流水号
        }else {
        }else {
            json.put("OriginalData",null);
            json.put("OriginalDataMD5",null);
            json.put("CA_SignData",null);
            json.put("CA_CertMainData",null);
            json.put("CA_DigitalSignStreamNoUuid",null);
            json.put("ORIGINAL_DATA",null);
            json.put("ORIGINAL_DATA_MD5",null);
            json.put("CA_SIGN_DATA",null);
            json.put("CA_CERTMAIN_DATA",null);
            json.put("CA_DIGITAL_SIGN_STREAM_NO_UUID",null);
        }
        }
        List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
        List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
@ -502,8 +556,8 @@ public class PrescriptionService extends ZysoftBaseService{
            js.put("ITEM_QUANTITY",info.getNum());//"ITEM_QUANTITY": "药品数量",
            js.put("ITEM_QUANTITY",info.getNum());//"ITEM_QUANTITY": "药品数量",
            js.put("ITEM_UNIT",info.getDrugNumUnit());// "ITEM_UNIT": " 数量单位编码 ",
            js.put("ITEM_UNIT",info.getDrugNumUnit());// "ITEM_UNIT": " 数量单位编码 ",
            js.put("ITEM_SPEC",info.getDrugFormat());//  "ITEM_SPEC": "药品规格",
            js.put("ITEM_SPEC",info.getDrugFormat());//  "ITEM_SPEC": "药品规格",
            js.put("ITEM_PRICE",info.getPrice());// "ITEM_PRICE": "药品单价",
            js.put("COST",info.getCode());// "COST": "药品金额",
            js.put("ITEM_PRICE",intToDouble(info.getPrice()));// "ITEM_PRICE": "药品单价",
            js.put("COST",intToDouble(info.getCost()));// "COST": "药品金额",
            js.put("BIND_FLAG",info.getBindFlag());// "BIND_FLAG": " 成组标志, 0.非成组,1.成组",
            js.put("BIND_FLAG",info.getBindFlag());// "BIND_FLAG": " 成组标志, 0.非成组,1.成组",
            js.put("FREQUENCY",info.getDrugRate());// "FREQUENCY": "用药频次编码",
            js.put("FREQUENCY",info.getDrugRate());// "FREQUENCY": "用药频次编码",
            js.put("DAY_COUNT",info.getDayCount());// "DAY_COUNT": "用药天数",
            js.put("DAY_COUNT",info.getDayCount());// "DAY_COUNT": "用药天数",
@ -524,6 +578,19 @@ public class PrescriptionService extends ZysoftBaseService{
        return response;
        return response;
    }
    }
    /**
     * 整型除以100转
     * @param num
     * @return
     */
    private Double intToDouble(Integer num){
        if(num==null){
            return 0.0d;
        }
        return (double)num/100;
    }
    /**
    /**
     * 7.5 查询处方结算结果列表
     * 7.5 查询处方结算结果列表
     * @param cardNo 病人卡号
     * @param cardNo 病人卡号

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

@ -363,7 +363,7 @@ public class PrescriptionInfoService extends BaseService {
            int st = respone.getInteger("status");
            int st = respone.getInteger("status");
            com.alibaba.fastjson.JSONObject data = respone.getJSONObject("data");
            com.alibaba.fastjson.JSONObject data = respone.getJSONObject("data");
            String code = data.getString("CODE");
            String code = data.getString("CODE");
            if(st==200&&"1".equals(code)){
            if(st==200&&"1".equals(code)&&data.getJSONArray("returnData").size()>0){
                //开方成功返回遗嘱号
                //开方成功返回遗嘱号
                com.alibaba.fastjson.JSONArray returnDatas = data.getJSONArray("returnData");
                com.alibaba.fastjson.JSONArray returnDatas = data.getJSONArray("returnData");
                com.alibaba.fastjson.JSONObject returnData = (com.alibaba.fastjson.JSONObject)returnDatas.get(0);
                com.alibaba.fastjson.JSONObject returnData = (com.alibaba.fastjson.JSONObject)returnDatas.get(0);