Skip to content

Commit

Permalink
Merge pull request #21 from yokenzan/yokenzan/suppress-zero-point-nyu…
Browse files Browse the repository at this point in the history
…uinryou

fix(preview): 入院料の点数集計欄で、病床報告コードがあると0点の行が出力されてしまう不具合を修正
  • Loading branch information
yokenzan authored Jan 22, 2023
2 parents 55744ad + 9828a47 commit 0a3210e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion lib/receiptisan/output/preview/parameter/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ class Tenki < CodedItem
:total_kaisuu,
:total_tensuu,
keyword_init: true
)
) do
def zero_point?
tensuu.zero?
end
end
# 点数欄「97食事・生活」の「基準」および「基準(生)」に埋め込む、
# 算定食事・生活療養費のローマ数字による略号
ShokujiSeikatsuKijunMarks = Struct.new(:shokuji, :seikatsu, keyword_init: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ def calculate_section(parameter, receipt)
combine_units
end

def combine_units
def combine_units # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
entries = @shuukei_entries.reject(&:zero_point?)

CombinedTensuuShuukeiUnit.new(
tensuu: @shuukei_entries.map(&:tensuu).then { | ary | ary.uniq.length == 1 ? ary.first : nil },
total_kaisuu: @shuukei_entries.map(&:total_kaisuu).sum.then { | sum | sum.zero? ? nil : sum },
total_tensuu: @shuukei_entries.map(&:total_tensuu).sum.then { | sum | sum.zero? ? nil : sum },
units: @shuukei_entries.sort_by(&:total_tensuu).reverse
tensuu: entries.map(&:tensuu).then { | ary | ary.uniq.length == 1 ? ary.first : nil },
total_kaisuu: entries.map(&:total_kaisuu).sum.then { | sum | sum.zero? ? nil : sum },
total_tensuu: entries.map(&:total_tensuu).sum.then { | sum | sum.zero? ? nil : sum },
units: entries.sort_by(&:total_tensuu).reverse
)
end

Expand Down

0 comments on commit 0a3210e

Please sign in to comment.