|
@ -1039,8 +1039,7 @@ public class DoorOrderService {
|
|
|
// 更新记录
|
|
|
this.setUpdateColumnInfo(one);
|
|
|
doorServiceOrderDao.save(one);
|
|
|
// 更新居民签约服务包服务项次数
|
|
|
this.reduceServiceItemTimes(serverPackagePriceByOrderId(orderId), one.getPatient());
|
|
|
|
|
|
// 发送微信消息通知--用户评价//·
|
|
|
BasePatientDO patient = patientInfoService.findById(one.getPatient());
|
|
|
// 获取微信模板 fwyspf-服务医生评分
|
|
@ -1285,42 +1284,6 @@ public class DoorOrderService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新居民签约服务包服务项次数
|
|
|
* @param itemInfo 格式[{"itemCode":"","fee":"","number":""}]
|
|
|
* @param patient 居民code
|
|
|
*/
|
|
|
public void reduceServiceItemTimes(String itemInfo, String patient){
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
//获取居民签约服务项及次数
|
|
|
// SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
|
String sql = "SELECT ip.`code`,ip.service_item_code as itemCode, ip.service_times as times FROM wlyy_server_package_patient pp , wlyy_server_package_item_patient ip " +
|
|
|
// "where pp.`code` = ip.server_package_patient_code and pp.patient = '" + patient + "' and pp.hospital = '" + signFamily.getHospital() + "' and pp.`status` = 1 " +
|
|
|
"where pp.`code` = ip.server_package_patient_code and pp.patient = '" + patient + "' and pp.hospital = '" + "" + "' and pp.`status` = 1 " +
|
|
|
"order BY pp.end_time ";
|
|
|
List<Map<String, Object>> list =jdbcTemplate.query(sql, new BeanPropertyRowMapper(String.class));
|
|
|
|
|
|
JSONArray jsonArray = JSONArray.parseArray(itemInfo);
|
|
|
for(Object o : jsonArray) {
|
|
|
JSONObject jsonObject = (JSONObject) o;
|
|
|
String itemCode = jsonObject.getString("itemCode");
|
|
|
Integer number = jsonObject.getInteger("number");
|
|
|
//遍历是否是居民签约的服务项,如果是,看服务项次数够不够减,不够减的继续遍历其他服务项,够减则跳出循环更新次数
|
|
|
for (Map<String, Object> m : list) {
|
|
|
if ((m.get(itemCode) + "").equals(itemCode)) {
|
|
|
String itemPatientCode = map.get("code") + "";
|
|
|
Integer times = (Integer) map.get("times");
|
|
|
if (number <= times) {
|
|
|
// serverPackageItemPatientDao.updateTimesByCode(itemPatientCode, times - number);
|
|
|
break;
|
|
|
} else {
|
|
|
// serverPackageItemPatientDao.updateTimesByCode(itemPatientCode, 0);
|
|
|
number -= times;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取订单下服务包数量、单价
|