| 
															
																@ -1,22 +1,21 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																package com.yihu.wlyy.service.service.prescription; 
															 | 
															
															 | 
															
																package com.yihu.wlyy.service.service.prescription; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.common.model.Result; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.common.model.Result; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.dao.DoctorMappingDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.dao.HospitalDao; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.dao.HospitalDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.dao.prescription.PrescriptionDao; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.dao.prescription.PrescriptionExpressageDao; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.dao.prescription.PrescriptionInfoDao; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.dao.prescription.PrescriptionLogDao; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.dao.PatientDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.dao.SignFamilyDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.dao.prescription.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.entity.Hospital; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.entity.Hospital; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.entity.prescription.Prescription; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.entity.prescription.PrescriptionExpressage; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.entity.prescription.PrescriptionLog; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.entity.Patient; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.entity.SignFamily; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.entity.prescription.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.service.ZysoftBaseService; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.service.ZysoftBaseService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import net.sf.json.JSONArray; 
															 | 
															
															 | 
															
																import net.sf.json.JSONArray; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import net.sf.json.JSONException; 
															 | 
															
															 | 
															
																import net.sf.json.JSONException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import net.sf.json.JSONObject; 
															 | 
															
															 | 
															
																import net.sf.json.JSONObject; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.apache.commons.lang.StringUtils; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import org.apache.commons.lang3.StringUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.slf4j.Logger; 
															 | 
															
															 | 
															
																import org.slf4j.Logger; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.slf4j.LoggerFactory; 
															 | 
															
															 | 
															
																import org.slf4j.LoggerFactory; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
															
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -46,11 +45,19 @@ public class PrescriptionService extends ZysoftBaseService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private StringRedisTemplate redisTemplate; 
															 | 
															
															 | 
															
																    private StringRedisTemplate redisTemplate; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private PrescriptionInfoDao prescriptionInfoDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private PatientDao patientDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private DoctorMappingDao doctorMappingDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private SignFamilyDao signFamilyDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private PrescriptionDiagnosisDao prescriptionDiagnosisDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private PrescriptionExpressageDao prescriptionExpressageDao; 
															 | 
															
															 | 
															
																    private PrescriptionExpressageDao prescriptionExpressageDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private HospitalDao hospitalDao; 
															 | 
															
															 | 
															
																    private HospitalDao hospitalDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private PrescriptionInfoDao prescriptionInfoDao; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private String channelTopic = "redisPrescription"; 
															 | 
															
															 | 
															
																    private String channelTopic = "redisPrescription"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -290,17 +297,15 @@ public class PrescriptionService extends ZysoftBaseService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 7.1字典获取接口 
															 | 
															
															 | 
															
																     * 7.1字典获取接口 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param dictName 字典名称 
															 | 
															
															 | 
															
																     * @param dictName 字典名称 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param hospital 
															 | 
															
															 | 
															
																     * @param hospital 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param licence 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @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<>(); 
															 | 
															
															 | 
															
																        Map<String,String> header = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
															
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -319,17 +324,14 @@ public class PrescriptionService extends ZysoftBaseService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param staffCode 员工编码 
															 | 
															
															 | 
															
																     * @param staffCode 员工编码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param deptCode 部门编码 
															 | 
															
															 | 
															
																     * @param deptCode 部门编码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param hospital 
															 | 
															
															 | 
															
																     * @param hospital 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param licence 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @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<>(); 
															 | 
															
															 | 
															
																        Map<String,String> header = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
															
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -346,20 +348,25 @@ public class PrescriptionService extends ZysoftBaseService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 调阅历史处方接口 
															 | 
															
															 | 
															
																     * 调阅历史处方接口 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param cardNo 卡号 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param cardNo 社保卡号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param recipeNo 医嘱号 
															 | 
															
															 | 
															
																     * @param recipeNo 医嘱号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param hospital 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param licence 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param applyTimeFrom 开始时间 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param applyTimeEnd 结束时间 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @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<>(); 
															 | 
															
															 | 
															
																        Map<String,String> header = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
															
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -368,6 +375,8 @@ public class PrescriptionService extends ZysoftBaseService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Map<String,String> params = new HashMap<>(); 
															 | 
															
															 | 
															
																        Map<String,String> params = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        params.put("cardNo",cardNo); 
															 | 
															
															 | 
															
																        params.put("cardNo",cardNo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        params.put("recipeNo",recipeNo); 
															 | 
															
															 | 
															
																        params.put("recipeNo",recipeNo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        params.put("applyTimeFrom",applyTimeFrom); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        params.put("applyTimeEnd",applyTimeEnd); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String response = postSecond("getLastRecipe","调阅历史处方接口",params,null,header,false,2); 
															 | 
															
															 | 
															
																        String response = postSecond("getLastRecipe","调阅历史处方接口",params,null,header,false,2); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -376,27 +385,63 @@ public class PrescriptionService extends ZysoftBaseService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 7.4 挂号开处方接口 
															 | 
															
															 | 
															
																     * 7.4 挂号开处方接口 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param json 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param hospital 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param licence 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param prescriptionCode 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @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<>(); 
															 | 
															
															 | 
															
																        Map<String,String> header = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
															
															 | 
															
																        header.put("ORGCODE",hospital); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        header.put("LICENCE",licence); 
															 | 
															
															 | 
															
																        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); 
															 | 
															
															 | 
															
																        String response = postSecond("saveRecipe","挂号开处方接口",null,json,header,false,2); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return response; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -453,15 +498,13 @@ public class PrescriptionService extends ZysoftBaseService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /*********************************************请求智业接口数据 end**************************************************/ 
															 | 
															
															 | 
															
																    /*********************************************请求智业接口数据 end**************************************************/ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /*********************************************智业请求顺丰快递接口数据 START**************************************************/ 
															 | 
															
															 | 
															
																    /*********************************************智业请求顺丰快递接口数据 START**************************************************/ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 根据基卫处方编码获取顺丰快递相关信息 
															 | 
															
															 | 
															
																     * 根据基卫处方编码获取顺丰快递相关信息 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param jwCode 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param visitNo 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public Result getSFExpressInfoByVisitNo(String visitNo) { 
															 | 
															
															 | 
															
																    public Result getSFExpressInfoByVisitNo(String visitNo) { 
															 |