Date: 201710
Local time of day: 0601-1200
Location: ZZZ.TRACON, US
Aircraft: B737-800
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Mission: Passenger
Flight phase: Cruise
Airspace: Class A ZZZ
ATC / advisory: Center ZZZ
Aircraft component: Hydraulic Main System
Component problem: Malfunctioning
Reporter organization: Air Carrier
Reporter function: Captain; Pilot Flying
Reporter qualification: Flight Crew Air Transport Pilot (ATP)
Human factors: Situational Awareness
Anomaly: Aircraft Equipment Problem Less Severe
Detector: Automation Aircraft Other Automation; Person Flight Crew
When detected: In-flight
Result: Air Traffic Control Provided Assistance; Flight Crew Diverted; Flight Crew Requested ATC Assistance / Clarification; Flight Crew Overcame Equipment Problem; Flight Crew Landed in Emergency Condition
Contributing factors: Aircraft
Primary problem: Aircraft

Narrative: The plane we picked up had been in maintenance for Hydraulic system B failure. This was the first flight since the repair. I briefed the First Officer (FO) about the issue and with this being the first flight; we are going to be on the lookout for any hydraulic system anomalies. At about 1;000 FT. from our cruise altitude of FL280; the hydraulic engine 2 system B 'Low Pressure' light illuminated. We leveled at FL280 and completed the HYDRAULIC PUMP LOW PRESSURE checklist. At this time; we were approximately 80 miles north of ZZZ. I gave control of the plane to the FO and called dispatch on the Dispatch Direct VHF Network. Dispatch patched me in with Tech. We agreed that; at this time; all other indications were normal so we would continue pending all conditions remained normal.I took over the pilot flying duties. FO and I conferred and agreed it to be prudent to start reviewing the checklists for a possible hydraulic system B failure and that we were in range of ZZZ for a landing if our scenario played out as in the previous flight. About 5 minutes later; hydraulic system B quantity rose to 106% and system A dropped to 71%. Pressures remained at 3;000 psi in both systems. Shortly thereafter; hydraulic system B pressure dropped to 50% with pressure remaining around 3;000 psi. Quantity then oscillated up and down then both pressure and quantity in system B dropped to zero. The FO started the LOSS OF SYSTEM B checklist and declared the emergency with ATC and instructed them that we were going to divert to ZZZ. I called the Flight Attendant (FA) and gave them the TEST items. While reviewing the LOSS OF SYSTEM B checklist and while getting vectors for ZZZ; we received an 'Oil Filter Bypass' alert for engine 2. FO then started the ENGINE OIL FILTER BYPASS checklist. The 'Oil Filter Bypass' alert remained on while the #2 throttle was at idle.I got clearance to descend. The descent was eventually stopped at 15;000 FT.; being vectored to stay on the northeast side of the airport close to the approach when we were ready to land. We advised ATC that we also had to shut our #2 engine down and ensured that CFR was advised. I stopped the descent at 15;000 ft. due to a solid overcast that topped at around 13;000 FT. with icing reported in the clouds. I wanted to stay VMC and out of the ice until we accomplished all of the checklists and were ready to be vectored for approach. We advised approach that we will need a long approach in order to configure using alternate flaps.  The FO accomplished the ENGINE FAILURE OR SHUTDOWN checklist and ONE ENGINE INOPERATIVE LANDING checklist except for the deferred item of the Ground Proximity Flap switch. I advised ZZZ approach we were ready to be vectored for approach to 30L. We were vectored on a right base for approach. The FO accomplished the deferred item of the Ground Proximity Flap switch; the DESCENT and BEFORE LANDING checklists.The landing was uneventful. The aircraft was stopped straight ahead on the runway. I advised the passengers to remain seated. We asked CFR to get a brake temperature reading just as a precaution. They advised the right engine was dripping something but all temps were normal. I advised the passengers we would be taxiing close to the gate then; as a precaution; get towed the rest of the way in. CFR followed us to the gate.Time of windmill was approximately 10 to 15 minutes. Oil pressure and temp were normal. Landing weight approximately 136;000 lbs. FO did an outstanding job of checklist management and keeping things coordinated during this multi-emergency event.I don't know exactly what maintenance procedures were performed on the hydraulic system prior to us getting the airplane; other than changing the standby pump due to the fact that it was running while dry and refilling the system. Details weren't given in the aircraft log. I don't want to second-guess maintenance since I don't have all of the information. Perhaps better troubleshooting the indications prior to failure as to why the failure occurred in the first place.Thinking about this event; there are a few items of note that may be good to debrief flight crews on. The first is that I did TEST the Flight Attendants after the hydraulic issue and told them we would be landing in around 10 minutes. We were setting up for that emergency when the engine emergency happened. I did briefly consider calling the FA's back but decided there was no real difference in our landing situation as far as they may be concerned; i.e.; evacuation; fire; etc. After the event in the crew room; one of the FA's stated they were wondering when we were going to land because the time I told them had come and gone and we were still above the clouds. I didn't realize that time for them is much different than time for us in the cockpit in that we were constantly busy; but they now were not doing anything but waiting to land wondering why we were not. Going forward; finding the time; either through me; the FO; or jumpseat rider (if there is one) to call back to give a 10 second brief of what's going on would greatly help the FA's.The second is that when on the extended final and it came time to extend the flaps electrically; the FO held the switch; but it seemed nothing happened to the point where we both were wondering if anything was going to happen. I started going through my mind the possibility of a go-around to set up for a flap up landing. Then finally things moved. After the flaps started to move; they seemed to move at a descent rate. This might be a sim briefing item.Lastly; with the integration of the 737 Max in the checklist; the FO had to be very diligent in making sure he was not only in the correctly named checklist; but the correct checklist for the specific plane. I held above the clouds in VMC while we were going through the checklists in so as not to add icing and IMC into the mix. It also served to slow things down a little to ensure we were doing everything correctly. While I didn't want to needlessly delay our landing; I wanted to ensure everything was complete. Doing this gave us both time to ensure we were in the right checklist and all bases were covered.




Synopsis: B737-800 pilot reported that hydraulic system 'B' had erratic indications prior to a complete loss of the 'B' hydraulics.