|
@ -32,7 +32,6 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@ -1244,13 +1243,6 @@ public class DoorOrderService {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
BigDecimal serverPackagePrice = new BigDecimal("0.00");
|
|
|
BigDecimal cashPrice = new BigDecimal("0.00");
|
|
|
//获取居民签约服务项及次数
|
|
|
// SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
|
String sql = "SELECT ip.service_item_code as itemCode, sum(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 = '" + "" + "' and pp.`status` = 1 " +
|
|
|
// "where pp.`code` = ip.server_package_patient_code and pp.patient = '" + patient + "' and pp.hospital = '" + signFamily.getHospital() + "' and pp.`status` = 1 " +
|
|
|
"GROUP BY ip.service_item_code ";
|
|
|
List<Map<String, Object>> list =jdbcTemplate.query(sql, new BeanPropertyRowMapper(String.class));
|
|
|
|
|
|
JSONArray jsonArray = JSONArray.parseArray(jsonData);
|
|
|
for(Object o : jsonArray){
|
|
@ -1260,25 +1252,7 @@ public class DoorOrderService {
|
|
|
String itemCode = jsonObject.getString("itemCode");
|
|
|
BigDecimal fee = jsonObject.getBigDecimal("fee");
|
|
|
BigDecimal number = jsonObject.getBigDecimal("number");
|
|
|
//遍历是否是居民签约的服务项,如果是,看还剩多少次数
|
|
|
for(Map<String, Object> m : list){
|
|
|
if((m.get(itemCode) + "").equals(itemCode)){
|
|
|
b = true;
|
|
|
times = (BigDecimal)map.get("times");
|
|
|
}
|
|
|
}
|
|
|
//判断服务包里面的次数是否够抵扣,不够的仍需支付
|
|
|
if(b){
|
|
|
if(times.compareTo(number) > -1) {
|
|
|
serverPackagePrice = serverPackagePrice.add(fee.multiply(number));
|
|
|
}else {
|
|
|
//还需另外支付次数
|
|
|
BigDecimal t = number.subtract(times);
|
|
|
cashPrice = cashPrice.add(fee.multiply(t));
|
|
|
}
|
|
|
}else {
|
|
|
cashPrice = cashPrice.add(fee.multiply(number));
|
|
|
}
|
|
|
cashPrice = cashPrice.add(fee.multiply(number));
|
|
|
}
|
|
|
map.put("serverPackagePrice", serverPackagePrice);
|
|
|
map.put("cashPrice", cashPrice);
|