|  | @ -41,6 +41,8 @@ import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
	
	
		
			
				|  | @ -61,6 +63,8 @@ import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.family.dao.WlyyNatPatientFamilyMemberDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.httplog.service.BaseOperateLogService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
 | 
	
	
		
			
				|  | @ -326,8 +330,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HcyyPrescriptionService hcyyPrescriptionService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private YlzMedicailRelationDao ylzMedicailRelationDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private YlzMedicailMxDao ylzMedicailMxDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyNatPatientFamilyMemberDao natPatientFamilyMemberDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionLogDao prescriptionLogDao;
 | 
	
		
			
				|  |  |     public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public static String entranceHealthCareUrl = "http://127.0.0.1:10023/healthCare/";
 | 
	
	
		
			
				|  | @ -706,6 +715,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         rs.put("doctorCancelType", outpatientDO.getDoctorCancelType());
 | 
	
		
			
				|  |  |         rs.put("doctorCancelValue", outpatientDO.getDoctorCancelValue());
 | 
	
		
			
				|  |  |         rs.put("doctorCancelRemark", outpatientDO.getDoctorCancelRemark());
 | 
	
		
			
				|  |  |         rs.put("medicalState",outpatientDO.getMedicalState());
 | 
	
		
			
				|  |  |         rs.put("payStatus", outpatientDO.getPayStatus());
 | 
	
		
			
				|  |  |         rs.put("patientCancelType", outpatientDO.getPatientCancelType());
 | 
	
		
			
				|  |  |         rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
 | 
	
	
		
			
				|  | @ -1584,7 +1594,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 " h.dept_name AS \"deptName\","+
 | 
	
		
			
				|  |  |                 " h.org_code AS \"orgCode\","+
 | 
	
		
			
				|  |  |                 " h.org_name AS \"orgName\","+
 | 
	
		
			
				|  |  |                 " t.photo AS \"hosptialphoto\""+
 | 
	
		
			
				|  |  |                 " t.photo AS \"hosptialphoto\","+
 | 
	
		
			
				|  |  |                 " d.id_type AS \"idType\","+
 | 
	
		
			
				|  |  |                 " d.id_card_type AS \"idCardType\" "+
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " base_doctor d " +
 | 
	
		
			
				|  |  |                 " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
 | 
	
	
		
			
				|  | @ -3537,7 +3549,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 " e.id AS \"expressageId\" ,"+
 | 
	
		
			
				|  |  |                 " p.real_order AS \"realOrder\" ,"+
 | 
	
		
			
				|  |  |                 " p.origin_real_order AS \"originRealOrder\"," +
 | 
	
		
			
				|  |  |                 " o.patient_name as \"patientName\" "+
 | 
	
		
			
				|  |  |                 " o.patient_name as \"patientName\", "+
 | 
	
		
			
				|  |  |                 " p.check_status as \"checkStatus\", "+
 | 
	
		
			
				|  |  |                 " p.check_reason as \"checkReason\"  "+
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_outpatient o " +
 | 
	
		
			
				|  |  |                 " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
 | 
	
	
		
			
				|  | @ -3783,7 +3797,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             WritableSheet ws;
 | 
	
		
			
				|  |  |             ws = wwb.createSheet("sheet", 1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String[] header = {"序号","充值时间","商户订单号","医院订单号","患者姓名","证件号码","就诊卡号","手机号码","金额","状态","业务类型","咨询方式"};
 | 
	
		
			
				|  |  |             String[] header = {"序号","充值时间","商户订单号","医院订单号","患者姓名","证件号码","就诊卡号","手机号码","金额","状态","业务类型","咨询方式","代问诊人","问诊医生"};
 | 
	
		
			
				|  |  |             int k = 0;
 | 
	
		
			
				|  |  |             for (String h : header) {
 | 
	
		
			
				|  |  |                 addCell(ws, 0, k, h);//表名,行,列,header
 | 
	
	
		
			
				|  | @ -3873,12 +3887,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     time = m.get("payTime").toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 String consumerName = "";
 | 
	
		
			
				|  |  |                 if (m.get("consumerName") == null){
 | 
	
		
			
				|  |  |                     consumerName = null;
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     consumerName= m.get("consumerName").toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String doctorName ="";
 | 
	
		
			
				|  |  |                 if (m.get("doctorName") == null){
 | 
	
		
			
				|  |  |                     doctorName = null;
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     doctorName= m.get("doctorName").toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 addCell(ws, i, 0, m.get("id")!=null?m.get("id").toString():n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 1, time!=null?time:n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 2, (String) m.get("orderNo")!=null?(String) m.get("orderNo"):n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 3, (String) m.get("ykOrderNo")!=null?(String) m.get("ykOrderNo"):n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 4, (String) m.get("patientName")!=null?(String) m.get("patientName"):n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 4, consumerName!=null?consumerName:n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 5, (String) m.get("idcard")!=null?(String) m.get("idcard"):n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 6, (String) m.get("medicard")!=null?(String) m.get("medicard"):n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 7, (String) m.get("mobile")!=null?(String) m.get("mobile"):n);
 | 
	
	
		
			
				|  | @ -3886,6 +3914,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 addCell(ws, i, 9, status!=null?status:n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 10, odry!=null?odry:n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 11, odte!=null?odte:n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 12, (String) m.get("patientName")!=null?(String) m.get("patientName"):n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 13, doctorName!=null?doctorName:n);
 | 
	
		
			
				|  |  |                 i++;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             wwb.write();
 | 
	
	
		
			
				|  | @ -4359,6 +4389,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             rs.put("popularity",doctorDO.getPopularity());
 | 
	
		
			
				|  |  |             rs.put("qrcode",doctorDO.getQrcode());
 | 
	
		
			
				|  |  |             rs.put("appletQrcode",doctorDO.getAppletQrCode());
 | 
	
		
			
				|  |  |             rs.put("idType",doctorDO.getIdType());
 | 
	
		
			
				|  |  |             rs.put("idCard",doctorDO.getIdcard());
 | 
	
		
			
				|  |  |             rs.put("idCardType",doctorDO.getIdCardType());
 | 
	
		
			
				|  |  |             List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
 | 
	
		
			
				|  |  |             String sqlCharge = "SELECT\n" +
 | 
	
		
			
				|  |  |                     "\tm.req_fee as \"twfzFee\",\n" +
 | 
	
	
		
			
				|  | @ -4431,7 +4464,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     " base_doctor_role r " +
 | 
	
		
			
				|  |  |                     " JOIN base_doctor_role_dict t ON t.code = r.role_code " +
 | 
	
		
			
				|  |  |                     " WHERE " +
 | 
	
		
			
				|  |  |                     " r.doctor_code = '" + doctor + "'";
 | 
	
		
			
				|  |  |                     " r.doctor_code = '" + doctorDO.getId() + "'";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if (list != null && list.size() > 0) {
 | 
	
	
		
			
				|  | @ -4440,14 +4474,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 rs.put("roles", null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //医生预约量
 | 
	
		
			
				|  |  |             List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |             List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctor(doctorDO.getId());
 | 
	
		
			
				|  |  |             if (registerTimeDOs != null && registerTimeDOs.size() > 0) {
 | 
	
		
			
				|  |  |                 rs.put("registerCount", registerTimeDOs.size());
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 rs.put("registerCount", 0);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //医生问诊量
 | 
	
		
			
				|  |  |             List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctor);
 | 
	
		
			
				|  |  |             List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctorDO.getId());
 | 
	
		
			
				|  |  |             if (wlyyOutpatientDOs != null && wlyyOutpatientDOs.size() > 0) {
 | 
	
		
			
				|  |  |                 rs.put("outpatientCount", wlyyOutpatientDOs.size());
 | 
	
		
			
				|  |  |             } else {
 | 
	
	
		
			
				|  | @ -4459,7 +4493,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | //            rs.put("coordinationCout",coordinationCout);
 | 
	
		
			
				|  |  |             //医生关注
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(patient)){
 | 
	
		
			
				|  |  |                 List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctor,patient);
 | 
	
		
			
				|  |  |                 List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctorDO.getId(),patient);
 | 
	
		
			
				|  |  |                 if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) {
 | 
	
		
			
				|  |  |                     rs.put("attention", "1");
 | 
	
		
			
				|  |  |                 } else {
 | 
	
	
		
			
				|  | @ -4480,7 +4514,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //专家咨询
 | 
	
		
			
				|  |  |             String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='" + doctor + "' AND (type=1 OR type=15)";
 | 
	
		
			
				|  |  |             String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='" + doctorDO.getId() + "' AND (type=1 OR type=15)";
 | 
	
		
			
				|  |  |             List<Map<String, Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
 | 
	
		
			
				|  |  |             if (zjList != null && zjList.size() > 0) {
 | 
	
		
			
				|  |  |                 rs.put("zjCount", zjList.size());
 | 
	
	
		
			
				|  | @ -4495,7 +4529,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     "FROM base_evaluate a,base_evaluate_score b " +
 | 
	
		
			
				|  |  |                     "WHERE " +
 | 
	
		
			
				|  |  |                     "a.relation_code=b.id " +
 | 
	
		
			
				|  |  |                     "AND b.doctor='" + doctor + "' " +
 | 
	
		
			
				|  |  |                     "AND b.doctor='" + doctorDO.getId() + "' " +
 | 
	
		
			
				|  |  |                     "GROUP BY a.score_type ORDER BY  a.score_type ASC ";
 | 
	
		
			
				|  |  |             List<Map<String, Object>> listscore = jdbcTemplate.queryForList(sqlscore);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -4514,7 +4548,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 rs.put("scoreDoctor", null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             int count = baseBannerDoctorDao.getTotalBannerCount(doctor);
 | 
	
		
			
				|  |  |             int count = baseBannerDoctorDao.getTotalBannerCount(doctorDO.getId());
 | 
	
		
			
				|  |  |             rs.put("bannerCount",count);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //查询评价明细
 | 
	
	
		
			
				|  | @ -4532,8 +4566,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     "FROM " +
 | 
	
		
			
				|  |  |                     "base_evaluate a " +
 | 
	
		
			
				|  |  |                     "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
 | 
	
		
			
				|  |  |                     "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctor + "' " +
 | 
	
		
			
				|  |  |                     "WHERE a.relation_code=b.id AND b.doctor='" + doctor + "' order by b.create_time DESC ";
 | 
	
		
			
				|  |  |                     "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctorDO.getId() + "' " +
 | 
	
		
			
				|  |  |                     "WHERE a.relation_code=b.id AND b.doctor='" + doctorDO.getId() + "' order by b.create_time DESC ";
 | 
	
		
			
				|  |  |             List<Map<String, Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
 | 
	
		
			
				|  |  |             if (scoreList != null && scoreList.size() > 0) {
 | 
	
		
			
				|  |  | //                Set<String> datelist = new HashSet<>();
 | 
	
	
		
			
				|  | @ -6837,17 +6871,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             params.put("consultStatus", consultStatus);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+",dw.workTotal DESC";
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
 | 
	
		
			
				|  |  |                 sql+=" NULLS LAST,\n" +
 | 
	
		
			
				|  |  |                         "\tD.id DESC,dw.workTotal DESC NULLS LAST";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSort");//isSort:1按照后台顺序,0按照系统排序
 | 
	
		
			
				|  |  |         if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             sql +=" and d.del='1' order by d.sort asc  ";
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+"";
 | 
	
		
			
				|  |  |             if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+",dw.workTotal DESC";
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
 | 
	
		
			
				|  |  |                     sql+=" NULLS LAST,\n" +
 | 
	
		
			
				|  |  |                             "\tD.id DESC,dw.workTotal DESC NULLS LAST";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+"";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
 | 
	
		
			
				|  |  |         /*list.stream().forEach(e->{
 | 
	
	
		
			
				|  | @ -7318,19 +7358,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         Boolean flag = healthCareService.isHospitalFlag();
 | 
	
		
			
				|  |  |         if (flag){
 | 
	
		
			
				|  |  |             try{
 | 
	
		
			
				|  |  |                 String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |                 if (object.getString("flag").equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
 | 
	
		
			
				|  |  |                     String state = encryptData.getString("state");
 | 
	
		
			
				|  |  |                     String auth_date = encryptData.getString("auth_date");
 | 
	
		
			
				|  |  |                     basePatientDO.setMedicalState(state);
 | 
	
		
			
				|  |  |                     basePatientDO = basePatientDao.save(basePatientDO);
 | 
	
		
			
				|  |  |                 if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
 | 
	
		
			
				|  |  |                     String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |                     if (object.getString("flag").equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                         com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
 | 
	
		
			
				|  |  |                         String state = encryptData.getString("state");
 | 
	
		
			
				|  |  |                         String auth_date = encryptData.getString("auth_date");
 | 
	
		
			
				|  |  |                         basePatientDO.setMedicalState(state);
 | 
	
		
			
				|  |  |                         basePatientDO = basePatientDao.save(basePatientDO);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     String result = healthCareService.authorized(basePatientDO.getId());
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |                     if (object.getString("flag").equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                         com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
 | 
	
		
			
				|  |  |                         String state = encryptData.getString("state");
 | 
	
		
			
				|  |  |                         String auth_date = encryptData.getString("auth_date");
 | 
	
		
			
				|  |  |                         basePatientDO.setMedicalState(state);
 | 
	
		
			
				|  |  |                         basePatientDO = basePatientDao.save(basePatientDO);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patient, "1");
 | 
	
		
			
				|  |  |         List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
 | 
	
	
		
			
				|  | @ -8649,6 +8700,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 room.setDeptName(outpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                 room.setDoctor(outpatientDO.getDoctor());
 | 
	
		
			
				|  |  |                 room.setDoctorName(outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 room.setReservationTime(outpatientDO.getRegisterDate());
 | 
	
		
			
				|  |  |                 room.setConsultType(Integer.parseInt(outpatientDO.getType()));
 | 
	
		
			
				|  |  |                 room.setChargeType(chargeType);
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -11416,6 +11468,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
 | 
	
		
			
				|  |  |                 WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |                 WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutPatientIdList(prescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |                 DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
 | 
	
		
			
				|  |  |                 List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
 | 
	
	
		
			
				|  | @ -11456,8 +11509,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 wlyyHttpLogDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                 wlyyHttpLogDO.setCode(outpatientDO.getId());
 | 
	
		
			
				|  |  |                 wlyyHttpLogDao.save(wlyyHttpLogDO);
 | 
	
		
			
				|  |  |                 for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
 | 
	
		
			
				|  |  |                     wlyyPrescriptionDO.setStatus(-4);
 | 
	
		
			
				|  |  |                     wlyyPrescriptionDO.setDisableTime(new Date());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionDO.setCheckStatus(5);
 | 
	
		
			
				|  |  |                     wlyyPrescriptionDO.setCheckReason("已作废");
 | 
	
		
			
				|  |  |                     prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             prescriptionDO.setStatus(-4);
 | 
	
		
			
				|  |  |             prescriptionDO.setDisableTime(new Date());
 | 
	
		
			
				|  |  |             prescriptionDO.setCheckStatus(5);
 | 
	
	
		
			
				|  | @ -13981,36 +14040,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception {
 | 
	
		
			
				|  |  |     public com.alibaba.fastjson.JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception {
 | 
	
		
			
				|  |  |         logger.info("获取患者待结算信息开始!");
 | 
	
		
			
				|  |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |         if(outpatientDO==null){
 | 
	
		
			
				|  |  |             throw new Exception("门诊信息为空");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String registerNo = outpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode");
 | 
	
		
			
				|  |  |         if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
 | 
	
		
			
				|  |  |             xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());
 | 
	
		
			
				|  |  |             xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),outpatientId,sysDictDO.getDictValue());
 | 
	
		
			
				|  |  |             logger.info("获取患者待结算信息结束!");
 | 
	
		
			
				|  |  |             logger.info("医保挂号开始!");
 | 
	
		
			
				|  |  |             String register = healthCareService.registerToEntrance(registerNo);
 | 
	
		
			
				|  |  |             String register = healthCareService.registerToEntrance(outpatientId);
 | 
	
		
			
				|  |  |             logger.info("医保挂号结束!");
 | 
	
		
			
				|  |  |             logger.info("医保费用明细上传开始!");
 | 
	
		
			
				|  |  |             String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(registerNo);
 | 
	
		
			
				|  |  |             String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(outpatientId);
 | 
	
		
			
				|  |  |             logger.info("医保费用明细上传结束!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             logger.info("医保预结算信息开始!");
 | 
	
		
			
				|  |  |             YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(registerNo);
 | 
	
		
			
				|  |  |             YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(outpatientId);
 | 
	
		
			
				|  |  |             logger.info("医保预结算信息结束!");
 | 
	
		
			
				|  |  |             JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |             if (flag==1){
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址开始!");
 | 
	
		
			
				|  |  |                 String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo);
 | 
	
		
			
				|  |  |                 String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(outpatientId);
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址结束!");
 | 
	
		
			
				|  |  |                 object.put("getSettlementResultUrl",getSettlementResultUrl);
 | 
	
		
			
				|  |  |             }else if (flag==2){
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址开始!");
 | 
	
		
			
				|  |  |                 String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(registerNo);
 | 
	
		
			
				|  |  |                 String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(outpatientId);
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址结束!");
 | 
	
		
			
				|  |  |                 object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -14022,47 +14080,118 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             object.put("deptName",outpatientDO.getPatientName());
 | 
	
		
			
				|  |  |             return object;
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             /*entranceService.BS10108()*/
 | 
	
		
			
				|  |  |             /*entrance(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());*/
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |             logger.info("获取患者待结算信息开始!");
 | 
	
		
			
				|  |  |             entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
 | 
	
		
			
				|  |  |             YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
 | 
	
		
			
				|  |  |             ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
 | 
	
		
			
				|  |  |             if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
 | 
	
		
			
				|  |  |                 //医保已结算直接返回数据
 | 
	
		
			
				|  |  |                 List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
 | 
	
		
			
				|  |  |                 BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
 | 
	
		
			
				|  |  |                 BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
 | 
	
		
			
				|  |  |                 BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
 | 
	
		
			
				|  |  |                 Double totalPirce=b1.add(b2).add(b3).doubleValue();
 | 
	
		
			
				|  |  |                 logger.info("总费用:"+totalPirce);
 | 
	
		
			
				|  |  |                 if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
 | 
	
		
			
				|  |  |                     object.put("code","403");
 | 
	
		
			
				|  |  |                     object.put("message","金额不对无法结算!");
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     object.put("code","200");
 | 
	
		
			
				|  |  |                     object.put("message","核对金额无误!");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 object.put("getSettleInfo",ylzMedicalRelationDO);
 | 
	
		
			
				|  |  |                 return object;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO = entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 throw new Exception(e.getMessage());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (ylzMedicalRelationDO==null){
 | 
	
		
			
				|  |  |                 throw new Exception("无待结算信息");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("获取患者待结算信息结束!");
 | 
	
		
			
				|  |  |             logger.info("医保挂号开始!");
 | 
	
		
			
				|  |  |             String register = healthCareService.register(registerNo);
 | 
	
		
			
				|  |  |             logger.info("医保挂号结束!");
 | 
	
		
			
				|  |  |             logger.info("医保费用明细上传开始!");
 | 
	
		
			
				|  |  |             String feeDetailUpload= healthCareService.feeDetailUpload(registerNo);
 | 
	
		
			
				|  |  |             logger.info("医保费用明细上传结束!");
 | 
	
		
			
				|  |  |             if(outpatientDO!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                 logger.info("医保挂号开始!");
 | 
	
		
			
				|  |  |                 String register = healthCareService.register(outpatientId);
 | 
	
		
			
				|  |  |                 logger.info("医保挂号结束!");
 | 
	
		
			
				|  |  |                 logger.info("医保费用明细上传开始!");
 | 
	
		
			
				|  |  |                 String feeDetailUpload= healthCareService.feeDetailUpload(outpatientId);
 | 
	
		
			
				|  |  |                 logger.info("医保费用明细上传结束!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 logger.info("医保预结算信息开始!");
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO =  healthCareService.preSettlement(outpatientId);
 | 
	
		
			
				|  |  |                 logger.info("医保预结算信息结束!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 if (flag==1){
 | 
	
		
			
				|  |  |                     logger.info("获取医保结算页面地址开始!");
 | 
	
		
			
				|  |  |                     String getSettlementResultUrl = healthCareService.getSettlementResultUrl(outpatientId);
 | 
	
		
			
				|  |  |                     logger.info("获取医保结算页面地址结束!");
 | 
	
		
			
				|  |  |                     object.put("getSettlementResultUrl",getSettlementResultUrl);
 | 
	
		
			
				|  |  |                 }else if (flag==2){
 | 
	
		
			
				|  |  |                     logger.info("获取医保结算页面地址开始!");
 | 
	
		
			
				|  |  |                     String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(outpatientId);
 | 
	
		
			
				|  |  |                     logger.info("获取医保结算页面地址结束!");
 | 
	
		
			
				|  |  |                     object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (ylzMedicalRelationDO.getPersonCash()!=null){
 | 
	
		
			
				|  |  |                     BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
 | 
	
		
			
				|  |  |                     BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
 | 
	
		
			
				|  |  |                     BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
 | 
	
		
			
				|  |  |                     Double totalPirce=b1.add(b2).add(b3).doubleValue();
 | 
	
		
			
				|  |  |                     logger.info("总费用:"+totalPirce);
 | 
	
		
			
				|  |  |                     if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
 | 
	
		
			
				|  |  |                         object.put("code","403");
 | 
	
		
			
				|  |  |                         object.put("message","金额不对无法结算!");
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         object.put("code","200");
 | 
	
		
			
				|  |  |                         object.put("message","核对金额无误!");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 object.put("getSettleInfo",ylzMedicalRelationDO);
 | 
	
		
			
				|  |  |                 return object;
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
 | 
	
		
			
				|  |  |                 BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
 | 
	
		
			
				|  |  |                 BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
 | 
	
		
			
				|  |  |                 Double totalPirce=b1.add(b2).add(b3).doubleValue();
 | 
	
		
			
				|  |  |                 logger.info("总费用:"+totalPirce);
 | 
	
		
			
				|  |  |                 if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
 | 
	
		
			
				|  |  |                     object.put("code","403");
 | 
	
		
			
				|  |  |                     object.put("message","金额不对无法结算!");
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     object.put("code","200");
 | 
	
		
			
				|  |  |                     object.put("message","核对金额无误!");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 object.put("getSettleInfo",ylzMedicalRelationDO);
 | 
	
		
			
				|  |  |                 return object;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             logger.info("医保预结算信息开始!");
 | 
	
		
			
				|  |  |             YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlement(registerNo);
 | 
	
		
			
				|  |  |             logger.info("医保预结算信息结束!");
 | 
	
		
			
				|  |  |             JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |             if (flag==1){
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址开始!");
 | 
	
		
			
				|  |  |                 String getSettlementResultUrl = healthCareService.getSettlementResultUrl(registerNo);
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址结束!");
 | 
	
		
			
				|  |  |                 object.put("getSettlementResultUrl",getSettlementResultUrl);
 | 
	
		
			
				|  |  |             }else if (flag==2){
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址开始!");
 | 
	
		
			
				|  |  |                 String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(registerNo);
 | 
	
		
			
				|  |  |                 logger.info("获取医保结算页面地址结束!");
 | 
	
		
			
				|  |  |                 object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
 | 
	
		
			
				|  |  |     public YlzMedicalRelationDO selectByOutpatientId(String outpatientId){
 | 
	
		
			
				|  |  |         YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
 | 
	
		
			
				|  |  |         return ylzMedicalRelationDO;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String electronicPrescriptionReceiving(String outpatientId) {
 | 
	
		
			
				|  |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |         if (outpatientDO.getMedicalState()!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 healthCareService.electronicPrescriptionReceiving(outpatientId);
 | 
	
		
			
				|  |  |                 return "上传成功";
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             object.put("register",register);
 | 
	
		
			
				|  |  |             object.put("feeDetailUpload",feeDetailUpload);
 | 
	
		
			
				|  |  |             object.put("preSettlement",ylzMedicalRelationDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             object.put("cardNo",outpatientDO.getCardNo());
 | 
	
		
			
				|  |  |             object.put("deptName",outpatientDO.getPatientName());
 | 
	
		
			
				|  |  |             return object;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医保结算页面
 | 
	
		
			
				|  |  |      * 医保结算结果
 | 
	
		
			
				|  |  |      * @param outpatientId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
	
		
			
				|  | @ -14079,15 +14208,210 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             result = healthCareService.getSettlementResult(code);
 | 
	
		
			
				|  |  |             logger.info("医保结算结果获取end!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |         }/*else{
 | 
	
		
			
				|  |  |             logger.info("医保结算页面start!");
 | 
	
		
			
				|  |  |             String registerNo = outpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |             result = healthCareService.getSettlementResultUrl(registerNo);
 | 
	
		
			
				|  |  |             logger.info("医保结算页面end!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         }*/
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医保结算后确认his结算
 | 
	
		
			
				|  |  |      * @param outpatientId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String confirmSettlementService(String outpatientId) throws Exception {
 | 
	
		
			
				|  |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |         if (outpatientDO==null){
 | 
	
		
			
				|  |  |             throw new Exception("未找到待结算记录");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
 | 
	
		
			
				|  |  |         if (ylzMedicalRelationDO.getState()!=null&&ylzMedicalRelationDO.getState()==1){
 | 
	
		
			
				|  |  |             return "已结算";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //用医保结算直接调用确认结算
 | 
	
		
			
				|  |  |         confirmSettlement(outpatientId);
 | 
	
		
			
				|  |  |         return "结算成功";
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 费用结算
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param outpatientId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String confirmSettlement(String outpatientId) throws Exception {
 | 
	
		
			
				|  |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |         if (outpatientDO==null){
 | 
	
		
			
				|  |  |             throw new Exception("未找到待结算记录");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
 | 
	
		
			
				|  |  |         BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
 | 
	
		
			
				|  |  |         String depositType = "";
 | 
	
		
			
				|  |  |         String depositAmount = "";
 | 
	
		
			
				|  |  |         String outChargeNo = "";
 | 
	
		
			
				|  |  |         if (businessOrderDO!=null){
 | 
	
		
			
				|  |  |             depositType = businessOrderDO.getDepositType();
 | 
	
		
			
				|  |  |             depositAmount = businessOrderDO.getPayPrice()+"";
 | 
	
		
			
				|  |  |             outChargeNo = businessOrderDO.getTraceNo();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         if (ylzMedicalRelationDO.getMedicalState()==null||(ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0)){
 | 
	
		
			
				|  |  |             WlyyHisSettleVO wlyyHisSettleVO = new WlyyHisSettleVO();
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setCardNo(ylzMedicalRelationDO.getCardNo());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setXtgzh0(ylzMedicalRelationDO.getHisSettleNo());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setDepositType(depositType);
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setDepositAmount(depositAmount);
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setOutChargeNo(outChargeNo);
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setOrgCode("6");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setXyzf00("0");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setChannelType("09");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setDjlsh0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setMzlsh0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setZhzfe0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setGrzfe0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setJjzfe0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setGwybz0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setFybfy0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setCfdxje("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBjjjzf("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSybxzf("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBcbxf0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSfrq00("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSfsj00("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSfrxm0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBzjjzf("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setGrzhye("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setYlzfje("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setJkzhye("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setJkzhye("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setGrzhye("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setYbmxls("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBdgjzf("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setYdgjzf("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBckbcs("");
 | 
	
		
			
				|  |  |             jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
 | 
	
		
			
				|  |  |             WlyyHisSettleVO wlyyHisSettleVO = new WlyyHisSettleVO();
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setCardNo(ylzMedicalRelationDO.getCardNo());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setXtgzh0(ylzMedicalRelationDO.getHisSettleNo());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setDepositType(depositType);
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setDepositAmount(depositAmount);
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setOutChargeNo(outChargeNo);
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setOrgCode("6");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setXyzf00("0");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setChannelType("09");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setDjlsh0(ylzMedicalRelationDO.getBillSerial());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setMzlsh0(ylzMedicalRelationDO.getInsuranceSerial());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setZhzfe0(ylzMedicalRelationDO.getPersonAccount());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setGrzfe0(ylzMedicalRelationDO.getPersonCash());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setJjzfe0(ylzMedicalRelationDO.getMedicalPrice());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setGwybz0(ylzMedicalRelationDO.getGwyPay());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setFybfy0(ylzMedicalRelationDO.getPersonCash());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setCfdxje("0");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBjjjzf("0");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSybxzf(ylzMedicalRelationDO.getSbjjPay());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBcbxf0(ylzMedicalRelationDO.getTotalAmount());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSfrq00(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSfsj00("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSfrxm0("");
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBzjjzf(ylzMedicalRelationDO.getYljzPay());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setGrzhye(ylzMedicalRelationDO.getAccountBalance());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setYlzfje(ylzMedicalRelationDO.getOwnPay());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setJkzhye(ylzMedicalRelationDO.getJkzhPay());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setYbmxls(ylzMedicalRelationDO.getDetailSerial());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBdgjzf(ylzMedicalRelationDO.getJtgjPay());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setYdgjzf(ylzMedicalRelationDO.getJtgjPay());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setBckbcs(ylzMedicalRelationDO.getHospitalizationQty());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setPsnNo(ylzMedicalRelationDO.getPersonalCode());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setAab301(ylzMedicalRelationDO.getAdministrativeArea());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setInsutype(ylzMedicalRelationDO.getInsuranceType());
 | 
	
		
			
				|  |  |             wlyyHisSettleVO.setSetlTime(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
 | 
	
		
			
				|  |  |             jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (jsonArray!=null&&jsonArray.size()!=0){
 | 
	
		
			
				|  |  |             net.sf.json.JSONObject object = jsonArray.getJSONObject(0);
 | 
	
		
			
				|  |  |             net.sf.json.JSONObject jsonObject = object.getJSONObject("retInfo");
 | 
	
		
			
				|  |  |             net.sf.json.JSONObject msgInfoJson = object.getJSONObject("msgInfo");
 | 
	
		
			
				|  |  |             if (jsonObject.getString("retCode").equalsIgnoreCase("00")){
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO.setState(1);
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO.setHisBillSerial(msgInfoJson.getString("callSn"));
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO.setHisDesc(msgInfoJson.getString("jsxxts"));
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO.setSettleDate(new Date());
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
 | 
	
		
			
				|  |  |                 List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
 | 
	
		
			
				|  |  |                 boolean hisState = false;
 | 
	
		
			
				|  |  |                 for (YlzMedicalMxDO mxDO:mxDOList){
 | 
	
		
			
				|  |  |                     if (mxDO.getItemName().contains("互联网医院复诊诊查费")){
 | 
	
		
			
				|  |  |                         hisState = true;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 logger.info("变更医保结算状态成功");
 | 
	
		
			
				|  |  |                 String realOrder = msgInfoJson.getString("xtgzh0");
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderAndStatusList(realOrder);
 | 
	
		
			
				|  |  |                 for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
 | 
	
		
			
				|  |  |                     WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |                     String title = "";
 | 
	
		
			
				|  |  |                     if (wlyyOutpatientDO.getHisStatus()==null){
 | 
	
		
			
				|  |  |                         title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!";
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     if (hisState){
 | 
	
		
			
				|  |  |                         wlyyOutpatientDO.setHisStatus(1);
 | 
	
		
			
				|  |  |                         outpatientDao.save(wlyyOutpatientDO);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setStatus(30);
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setUserType(1);
 | 
	
		
			
				|  |  |                     prescriptionLogDO.setDatajson("处方结算");
 | 
	
		
			
				|  |  |                     prescriptionLogDao.save(prescriptionLogDO);
 | 
	
		
			
				|  |  |                     prescriptionDO.setStatus(30);
 | 
	
		
			
				|  |  |                     prescriptionDO.setPayTime(new Date());
 | 
	
		
			
				|  |  |                     prescriptionDao.save(prescriptionDO);
 | 
	
		
			
				|  |  |                     logger.info("变更处方结算状态成功");
 | 
	
		
			
				|  |  |                     String fee = ylzMedicalRelationDO.getTotalAmount();
 | 
	
		
			
				|  |  |                     String pushPayLog =  payInfoNoticeService.pushPrescriptionPayMedicare(wlyyOutpatientDO.getConsumer(),prescriptionDO.getDoctorName(),prescriptionDO.getVoucherNo(),prescriptionDO.getOutpatientId(),prescriptionDO.getId(),fee,ylzMedicalRelationDO.getMedicalPrice(),ylzMedicalRelationDO.getPersonCash(),title,null);
 | 
	
		
			
				|  |  |                     logger.info("处方结算成功"+pushPayLog+"====="+realOrder);
 | 
	
		
			
				|  |  |                     //2.6.1	电子处方订单接收
 | 
	
		
			
				|  |  |                     logger.info("医保电子处方订单");
 | 
	
		
			
				|  |  |                     if (ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0){
 | 
	
		
			
				|  |  |                         List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(ylzMedicalRelationDO.getRelationCode());
 | 
	
		
			
				|  |  |                         if (expressageDOList!=null&&expressageDOList.size()!=0){
 | 
	
		
			
				|  |  |                             WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
 | 
	
		
			
				|  |  |                             if (expressageDO.getOneselfPickupFlg()==1){
 | 
	
		
			
				|  |  |                                 healthCareService.electronicPrescriptionReceiving(ylzMedicalRelationDO.getRelationCode());
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 logger.info("电子发票开具开始");
 | 
	
		
			
				|  |  |                 /*try {
 | 
	
		
			
				|  |  |                     entranceService.dzpjServer(patientMappingDO.getMappingCode(),realOrder);
 | 
	
		
			
				|  |  |                 }catch (Exception e){
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }*/
 | 
	
		
			
				|  |  |                 logger.info("电子发票开具结束");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonArray.toString();
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
	
		
			
				|  | @ -14514,6 +14838,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(prescriptionDO);
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionInfoDO> infoDOList = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |             objectString.put("info",infoDOList);
 | 
	
		
			
				|  |  |             WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |             if (outpatientDO!=null){
 | 
	
		
			
				|  |  |                 objectString.put("consumerName",outpatientDO.getConsumerName());
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 objectString.put("consumerName","");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("prescription",objectString);
 | 
	
		
			
				|  |  |             mapList.add(map);
 | 
	
	
		
			
				|  | @ -14524,7 +14854,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 药品明细表导出
 | 
	
		
			
				|  |  |      * @param os
 | 
	
		
			
				|  |  |      * @param osmergeCells(a,b,c,d)
 | 
	
		
			
				|  |  |      * @param ls
 | 
	
		
			
				|  |  |      * @param startTime
 | 
	
		
			
				|  |  |      * @param endTime
 | 
	
	
		
			
				|  | @ -14548,7 +14878,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 addCell(ws, 1, k1, h);//表名,行,列,header
 | 
	
		
			
				|  |  |                 k1++;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String[] header2 = {"患者名称","订单药品","规格","总量","单位","进价","零售价","进货金额","零售金额","发药时间","审方时间","开方时间","开方医生"};//
 | 
	
		
			
				|  |  |             String[] header2 = {"患者名称","代问诊人","订单药品","规格","总量","单位","进价","零售价","进货金额","零售金额","发药时间","审方时间","开方时间","开方医生"};//
 | 
	
		
			
				|  |  |             int k2 = 0;
 | 
	
		
			
				|  |  |             for (String h : header2) {
 | 
	
		
			
				|  |  |                 addCell(ws, 2, k2, h);//表名,行,列,header
 | 
	
	
		
			
				|  | @ -14563,31 +14893,34 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONArray array = jsonObject.getJSONArray("info");
 | 
	
		
			
				|  |  |                 int j = i;
 | 
	
		
			
				|  |  |                 addCell(ws, i, 0,jsonObject.get("patientName")!=null?jsonObject.get("patientName").toString():n);
 | 
	
		
			
				|  |  |                 addCell(ws, i, 1,jsonObject.get("consumerName")!=null?jsonObject.get("consumerName").toString():n);
 | 
	
		
			
				|  |  |                 DecimalFormat df = new DecimalFormat("#.00");
 | 
	
		
			
				|  |  |                 if(array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                     for (int z=0;z<array.size();z++){
 | 
	
		
			
				|  |  |                         com.alibaba.fastjson.JSONObject object = array.getJSONObject(z);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 1, object.get("drugName")!=null?object.get("drugName").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 2, object.get("specification")!=null?object.get("specification").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 3, object.get("quantity")!=null?object.get("quantity").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 4, object.get("packUnitName")!=null?object.get("packUnitName").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 5, "无");
 | 
	
		
			
				|  |  |                         addCell(ws, i, 6, object.get("packRetprice")!=null?object.get("packRetprice").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 7, "无");
 | 
	
		
			
				|  |  |                         addCell(ws, i, 2, object.get("drugName")!=null?object.get("drugName").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 3, object.get("specification")!=null?object.get("specification").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 4, object.get("quantity")!=null?object.get("quantity").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 5, object.get("packUnitName")!=null?object.get("packUnitName").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 6, "无");
 | 
	
		
			
				|  |  |                         addCell(ws, i, 7, object.get("packRetprice")!=null?object.get("packRetprice").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 8, "无");
 | 
	
		
			
				|  |  |                         if (object.get("quantity")!=null){
 | 
	
		
			
				|  |  |                             Double quantity = Double.parseDouble(object.get("quantity").toString());
 | 
	
		
			
				|  |  |                             Double packRetprice = Double.parseDouble(object.get("packRetprice").toString());
 | 
	
		
			
				|  |  |                             addCell(ws, i, 8,df.format(packRetprice*quantity));
 | 
	
		
			
				|  |  |                             addCell(ws, i, 9,df.format(packRetprice*quantity));
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                             addCell(ws, i, 8,"");
 | 
	
		
			
				|  |  |                             addCell(ws, i, 9,"");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         addCell(ws, i, 9,jsonObject.get("dispDate")!=null?DateUtil.stampToString(jsonObject.get("dispDate").toString()):n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 10,jsonObject.get("checkTime")!=null?DateUtil.stampToString(jsonObject.get("checkTime").toString()):n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 11,jsonObject.get("createTime")!=null?DateUtil.stampToString(jsonObject.get("createTime").toString()):n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 12,jsonObject.get("doctorName")!=null?jsonObject.get("doctorName").toString():n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 10,jsonObject.get("dispDate")!=null?DateUtil.stampToString(jsonObject.get("dispDate").toString()):n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 11,jsonObject.get("checkTime")!=null?DateUtil.stampToString(jsonObject.get("checkTime").toString()):n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 12,jsonObject.get("createTime")!=null?DateUtil.stampToString(jsonObject.get("createTime").toString()):n);
 | 
	
		
			
				|  |  |                         addCell(ws, i, 13,jsonObject.get("doctorName")!=null?jsonObject.get("doctorName").toString():n);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         i++;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     ws.mergeCells(0,j,0,i-1);
 | 
	
		
			
				|  |  |                     ws.mergeCells(1,j,1,i-1);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     i++;
 | 
	
		
			
				|  |  |                 }
 | 
	
	
		
			
				|  | @ -14595,8 +14928,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             ws.mergeCells(0,0,12,0);
 | 
	
		
			
				|  |  |             ws.mergeCells(0,1,12,1);
 | 
	
		
			
				|  |  |             ws.mergeCells(0,0,13,0);
 | 
	
		
			
				|  |  |             ws.mergeCells(0,1,13,1);
 | 
	
		
			
				|  |  |             wwb.write();
 | 
	
		
			
				|  |  |             wwb.close();
 | 
	
		
			
				|  |  |         } catch (IOException e) {
 |