Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSM] PEPPER-853 sm id fix #2636

Merged
merged 7 commits into from
Aug 4, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class MercurySampleDao implements Dao<MercurySampleDto> {
+ "LEFT JOIN ddp_onc_history_detail oD on (mr.medical_record_id = oD.medical_record_id AND NOT oD.deleted <=> 1) "
+ "LEFT JOIN ddp_tissue t on (oD.onc_history_detail_id = t.onc_history_detail_id AND NOT t.deleted <=> 1) "
+ "WHERE oD.tissue_received IS NOT NULL AND p.ddp_participant_id = ? AND ddp.instance_name = ? "
+ "AND (IFNULL(t.uss_count, 0) <> 0 OR IFNULL(t.scrolls_count, 0) <> 0) "
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just avoiding the ones that are both 0 or both null should do the trick.

+ "AND IFNULL(t.uss_count, 0) = (SELECT count(*) from sm_id sm "
+ "left join sm_id_type smtype on (sm.sm_id_type_id = smtype.sm_id_type_id) "
+ "where smtype.sm_id_type = \"uss\" and sm.tissue_id = t.tissue_id and NOT sm.deleted <=> 1 "
Expand All @@ -40,7 +41,7 @@ public class MercurySampleDao implements Dao<MercurySampleDto> {
+ "From ddp_mercury_sequencing where ddp_participant_id = ? group by (tissue_id) ) as table2 "
+ "on table2.seqt = table1.tissue_id "
+ "LEFT JOIN (select order_id, mercury_sequencing_id, order_status, order_date, mercury_pdo_id "
+ "FROM ddp_mercury_sequencing WHERE ddp_participant_id = ?) as table3 ON(table3.mercury_sequencing_id = table2.ms_id)";
+ "FROM ddp_mercury_sequencing WHERE ddp_participant_id = ?) as table3 ON(table3.mercury_sequencing_id = table2.ms_id) ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I like to have an extra space at the end in case we need to concat the query with some other condition



public static String SQL_GET_ELIGIBLE_SAMPLES =
Expand Down
Loading